mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
Add multi-database data layer
Introduce aether-data-schema and driver-specific schema generation for Postgres, MySQL, and SQLite. Split data backends, lifecycle, repositories, and gateway runtime integration across database drivers. Verified with cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, and cargo test --workspace.
This commit is contained in:
761
crates/aether-data/schema/logical/001_identity.toml
Normal file
761
crates/aether-data/schema/logical/001_identity.toml
Normal file
@@ -0,0 +1,761 @@
|
||||
[table.users]
|
||||
domain = "identity"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "external_id"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "email"
|
||||
type = "text"
|
||||
length = 320
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "password_hash"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "role"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "auth_source"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "local"
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "email_verified"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "is_active"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "is_deleted"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "allowed_models"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "allowed_providers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "allowed_api_formats"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "model_capability_settings"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "rate_limit"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "last_login_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "ldap_dn"
|
||||
type = "text"
|
||||
length = 1024
|
||||
nullable = true
|
||||
|
||||
[[table.users.columns]]
|
||||
name = "ldap_username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.users.uniques]]
|
||||
name = "users_email_key"
|
||||
columns = ["email"]
|
||||
|
||||
[[table.users.uniques]]
|
||||
name = "users_username_key"
|
||||
columns = ["username"]
|
||||
|
||||
[table.api_keys]
|
||||
domain = "identity"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "key_hash"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "key_encrypted"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "name"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "key_prefix"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "active"
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "allowed_models"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "allowed_providers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "allowed_api_formats"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "rate_limit"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
default = 100
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "concurrent_limit"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "force_capabilities"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "is_active"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "is_locked"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "is_standalone"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "auto_delete_on_expiry"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "total_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "total_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "expires_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "last_used_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.api_keys.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.api_keys.uniques]]
|
||||
name = "api_keys_key_hash_key"
|
||||
columns = ["key_hash"]
|
||||
|
||||
[[table.api_keys.indexes]]
|
||||
name = "api_keys_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.audit_logs]
|
||||
domain = "identity"
|
||||
order = 30
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "event_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "api_key_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "description"
|
||||
type = "long_text"
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "ip_address"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "user_agent"
|
||||
type = "text"
|
||||
length = 512
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "request_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "event_metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "status_code"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "error_message"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.audit_logs.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.audit_logs.indexes]]
|
||||
name = "audit_logs_created_at_idx"
|
||||
columns = ["created_at"]
|
||||
|
||||
[[table.audit_logs.indexes]]
|
||||
name = "audit_logs_event_type_idx"
|
||||
columns = ["event_type"]
|
||||
|
||||
[[table.audit_logs.indexes]]
|
||||
name = "audit_logs_request_id_idx"
|
||||
columns = ["request_id"]
|
||||
|
||||
[[table.audit_logs.indexes]]
|
||||
name = "audit_logs_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.announcements]
|
||||
domain = "identity"
|
||||
order = 40
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "title"
|
||||
type = "text"
|
||||
length = 200
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "content"
|
||||
type = "long_text"
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "type"
|
||||
type = "text"
|
||||
length = 32
|
||||
default = "info"
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "priority"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "author_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "is_active"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "is_pinned"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "start_time"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "end_time"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.announcements.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.announcements.indexes]]
|
||||
name = "announcements_author_id_idx"
|
||||
columns = ["author_id"]
|
||||
|
||||
[[table.announcements.indexes]]
|
||||
name = "announcements_created_at_idx"
|
||||
columns = ["created_at"]
|
||||
|
||||
[[table.announcements.indexes]]
|
||||
name = "announcements_is_active_idx"
|
||||
columns = ["is_active"]
|
||||
|
||||
[table.announcement_reads]
|
||||
domain = "identity"
|
||||
order = 50
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.announcement_reads.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.announcement_reads.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.announcement_reads.columns]]
|
||||
name = "announcement_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.announcement_reads.columns]]
|
||||
name = "read_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.announcement_reads.uniques]]
|
||||
name = "uq_user_announcement"
|
||||
columns = ["user_id", "announcement_id"]
|
||||
|
||||
[[table.announcement_reads.indexes]]
|
||||
name = "announcement_reads_announcement_id_idx"
|
||||
columns = ["announcement_id"]
|
||||
|
||||
[[table.announcement_reads.indexes]]
|
||||
name = "announcement_reads_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.management_tokens]
|
||||
domain = "identity"
|
||||
order = 60
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "description"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "token_hash"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "token_prefix"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "allowed_ips"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "expires_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "last_used_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "last_used_ip"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "usage_count"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "is_active"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.management_tokens.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.management_tokens.uniques]]
|
||||
name = "management_tokens_token_hash_key"
|
||||
columns = ["token_hash"]
|
||||
|
||||
[[table.management_tokens.uniques]]
|
||||
name = "uq_management_tokens_user_name"
|
||||
columns = ["user_id", "name"]
|
||||
|
||||
[[table.management_tokens.indexes]]
|
||||
name = "management_tokens_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.user_preferences]
|
||||
domain = "identity"
|
||||
order = 70
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "avatar_url"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "bio"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "default_provider_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "theme"
|
||||
type = "text"
|
||||
length = 20
|
||||
default = "light"
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "language"
|
||||
type = "text"
|
||||
length = 10
|
||||
default = "zh-CN"
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "timezone"
|
||||
type = "text"
|
||||
length = 50
|
||||
default = "Asia/Shanghai"
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "email_notifications"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "usage_alerts"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "announcement_notifications"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_preferences.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_preferences.uniques]]
|
||||
name = "user_preferences_user_id_key"
|
||||
columns = ["user_id"]
|
||||
|
||||
[[table.user_preferences.indexes]]
|
||||
name = "user_preferences_default_provider_id_idx"
|
||||
columns = ["default_provider_id"]
|
||||
|
||||
[[table.user_preferences.indexes]]
|
||||
name = "user_preferences_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.user_sessions]
|
||||
domain = "identity"
|
||||
order = 80
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "client_device_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "device_label"
|
||||
type = "text"
|
||||
length = 120
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "device_type"
|
||||
type = "text"
|
||||
length = 20
|
||||
default = "unknown"
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "browser_name"
|
||||
type = "text"
|
||||
length = 50
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "browser_version"
|
||||
type = "text"
|
||||
length = 50
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "os_name"
|
||||
type = "text"
|
||||
length = 50
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "os_version"
|
||||
type = "text"
|
||||
length = 50
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "device_model"
|
||||
type = "text"
|
||||
length = 100
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "ip_address"
|
||||
type = "text"
|
||||
length = 45
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "user_agent"
|
||||
type = "text"
|
||||
length = 1000
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "client_hints"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "refresh_token_hash"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "prev_refresh_token_hash"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "rotated_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "last_seen_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "expires_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "revoked_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "revoke_reason"
|
||||
type = "text"
|
||||
length = 100
|
||||
nullable = true
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_sessions.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_sessions.indexes]]
|
||||
name = "user_sessions_user_active_idx"
|
||||
columns = ["user_id", "revoked_at", "expires_at"]
|
||||
|
||||
[[table.user_sessions.indexes]]
|
||||
name = "user_sessions_user_device_idx"
|
||||
columns = ["user_id", "client_device_id"]
|
||||
1559
crates/aether-data/schema/logical/002_provider_catalog.toml
Normal file
1559
crates/aether-data/schema/logical/002_provider_catalog.toml
Normal file
File diff suppressed because it is too large
Load Diff
297
crates/aether-data/schema/logical/003_auth_config.toml
Normal file
297
crates/aether-data/schema/logical/003_auth_config.toml
Normal file
@@ -0,0 +1,297 @@
|
||||
[table.system_configs]
|
||||
domain = "auth_config"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "key"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "value"
|
||||
type = "long_text"
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "description"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.system_configs.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.system_configs.uniques]]
|
||||
name = "system_configs_key_key"
|
||||
columns = ["key"]
|
||||
|
||||
[table.auth_modules]
|
||||
domain = "auth_config"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "module_type"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "enabled"
|
||||
type = "bool"
|
||||
default = true
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "config"
|
||||
type = "json"
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.auth_modules.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.auth_modules.uniques]]
|
||||
name = "auth_modules_module_type_key"
|
||||
columns = ["module_type"]
|
||||
|
||||
[table.oauth_providers]
|
||||
domain = "auth_config"
|
||||
order = 30
|
||||
primary_key = ["provider_type"]
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "provider_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "display_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "client_id"
|
||||
type = "long_text"
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "client_secret_encrypted"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "authorization_url_override"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "token_url_override"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "userinfo_url_override"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "scopes"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "redirect_uri"
|
||||
type = "text"
|
||||
length = 500
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "frontend_callback_url"
|
||||
type = "text"
|
||||
length = 500
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "attribute_mapping"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "extra_config"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "is_enabled"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.oauth_providers.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[table.ldap_configs]
|
||||
domain = "auth_config"
|
||||
order = 40
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "id"
|
||||
type = "int64"
|
||||
auto_increment = true
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "server_url"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "bind_dn"
|
||||
type = "long_text"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "bind_password_encrypted"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "base_dn"
|
||||
type = "long_text"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "user_search_filter"
|
||||
type = "long_text"
|
||||
default = "(uid={username})"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "username_attr"
|
||||
type = "text"
|
||||
length = 50
|
||||
default = "uid"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "email_attr"
|
||||
type = "text"
|
||||
length = 50
|
||||
default = "mail"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "display_name_attr"
|
||||
type = "text"
|
||||
length = 50
|
||||
default = "cn"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "is_enabled"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "is_exclusive"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "use_starttls"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "connect_timeout"
|
||||
type = "int32"
|
||||
default = 10
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.ldap_configs.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[table.user_oauth_links]
|
||||
domain = "auth_config"
|
||||
order = 50
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "provider_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "provider_user_id"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "provider_username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "provider_email"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "extra_data"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "linked_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_oauth_links.columns]]
|
||||
name = "last_login_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.user_oauth_links.indexes]]
|
||||
name = "user_oauth_links_provider_type_idx"
|
||||
columns = ["provider_type"]
|
||||
|
||||
[[table.user_oauth_links.indexes]]
|
||||
name = "user_oauth_links_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[[table.user_oauth_links.uniques]]
|
||||
name = "uq_user_oauth_links_provider_user"
|
||||
columns = ["provider_type", "provider_user_id"]
|
||||
|
||||
[[table.user_oauth_links.uniques]]
|
||||
name = "uq_user_oauth_links_user_provider"
|
||||
columns = ["user_id", "provider_type"]
|
||||
182
crates/aether-data/schema/logical/004_proxy_nodes.toml
Normal file
182
crates/aether-data/schema/logical/004_proxy_nodes.toml
Normal file
@@ -0,0 +1,182 @@
|
||||
[table.proxy_nodes]
|
||||
domain = "proxy_nodes"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "ip"
|
||||
type = "text"
|
||||
length = 512
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "port"
|
||||
type = "int32"
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "region"
|
||||
type = "text"
|
||||
length = 100
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 32
|
||||
default = "online"
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "registered_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "last_heartbeat_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "heartbeat_interval"
|
||||
type = "int32"
|
||||
default = 30
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "active_connections"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "avg_latency_ms"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "is_manual"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "proxy_url"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "proxy_username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "proxy_password"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "remote_config"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "config_version"
|
||||
type = "int32"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "hardware_info"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "estimated_max_concurrency"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "tunnel_mode"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "tunnel_connected"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "tunnel_connected_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "failed_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "dns_failures"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "stream_errors"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.proxy_nodes.columns]]
|
||||
name = "proxy_metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[table.proxy_node_events]
|
||||
domain = "proxy_nodes"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "id"
|
||||
type = "int64"
|
||||
auto_increment = true
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "node_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "event_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "detail"
|
||||
type = "text"
|
||||
length = 500
|
||||
nullable = true
|
||||
|
||||
[[table.proxy_node_events.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
816
crates/aether-data/schema/logical/005_wallet_billing.toml
Normal file
816
crates/aether-data/schema/logical/005_wallet_billing.toml
Normal file
@@ -0,0 +1,816 @@
|
||||
[table.wallets]
|
||||
domain = "wallet_billing"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "api_key_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "balance"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "gift_balance"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "limit_mode"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "finite"
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "currency"
|
||||
type = "text"
|
||||
length = 16
|
||||
default = "USD"
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "active"
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "total_recharged"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "total_consumed"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "total_refunded"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "total_adjusted"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallets.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallets.uniques]]
|
||||
name = "wallets_user_id_key"
|
||||
columns = ["user_id"]
|
||||
|
||||
[[table.wallets.uniques]]
|
||||
name = "wallets_api_key_id_key"
|
||||
columns = ["api_key_id"]
|
||||
|
||||
[[table.wallets.indexes]]
|
||||
name = "wallets_api_key_id_idx"
|
||||
columns = ["api_key_id"]
|
||||
|
||||
[[table.wallets.indexes]]
|
||||
name = "wallets_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[table.wallet_transactions]
|
||||
domain = "wallet_billing"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "category"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "reason_code"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "amount"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "balance_before"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "balance_after"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "recharge_balance_before"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "recharge_balance_after"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "gift_balance_before"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "gift_balance_after"
|
||||
type = "float64"
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "link_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "link_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "operator_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "description"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_transactions.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallet_transactions.indexes]]
|
||||
name = "idx_wallet_tx_wallet_created"
|
||||
columns = ["wallet_id", "created_at"]
|
||||
|
||||
[[table.wallet_transactions.indexes]]
|
||||
name = "idx_wallet_tx_category_created"
|
||||
columns = ["category", "created_at"]
|
||||
|
||||
[[table.wallet_transactions.indexes]]
|
||||
name = "idx_wallet_tx_reason_created"
|
||||
columns = ["reason_code", "created_at"]
|
||||
|
||||
[[table.wallet_transactions.indexes]]
|
||||
name = "idx_wallet_tx_link"
|
||||
columns = ["link_type", "link_id"]
|
||||
|
||||
[[table.wallet_transactions.indexes]]
|
||||
name = "ix_wallet_transactions_operator_id"
|
||||
columns = ["operator_id"]
|
||||
|
||||
[table.wallet_daily_usage_ledgers]
|
||||
domain = "wallet_billing"
|
||||
order = 30
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "billing_date"
|
||||
type = "text"
|
||||
length = 16
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "billing_timezone"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "total_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "first_finalized_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "last_finalized_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "aggregated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.wallet_daily_usage_ledgers.indexes]]
|
||||
name = "idx_wallet_daily_usage_wallet_date"
|
||||
columns = ["wallet_id", "billing_timezone", "billing_date"]
|
||||
|
||||
[table.payment_orders]
|
||||
domain = "wallet_billing"
|
||||
order = 40
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "order_no"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "amount_usd"
|
||||
type = "float64"
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "pay_amount"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "pay_currency"
|
||||
type = "text"
|
||||
length = 16
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "exchange_rate"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "refunded_amount_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "refundable_amount_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "payment_method"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "gateway_order_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "gateway_response"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "pending"
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "paid_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "credited_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.columns]]
|
||||
name = "expires_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_orders.uniques]]
|
||||
name = "uq_payment_orders_order_no"
|
||||
columns = ["order_no"]
|
||||
|
||||
[[table.payment_orders.indexes]]
|
||||
name = "idx_payment_orders_wallet_created"
|
||||
columns = ["wallet_id", "created_at"]
|
||||
|
||||
[[table.payment_orders.indexes]]
|
||||
name = "idx_payment_orders_user_created"
|
||||
columns = ["user_id", "created_at"]
|
||||
|
||||
[[table.payment_orders.indexes]]
|
||||
name = "idx_payment_orders_status"
|
||||
columns = ["status"]
|
||||
|
||||
[[table.payment_orders.indexes]]
|
||||
name = "idx_payment_orders_gateway_order_id"
|
||||
columns = ["gateway_order_id"]
|
||||
|
||||
[table.payment_callbacks]
|
||||
domain = "wallet_billing"
|
||||
order = 50
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "payment_order_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "payment_method"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "callback_key"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "order_no"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "gateway_order_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "payload_hash"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "signature_valid"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "received"
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "payload"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "error_message"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.payment_callbacks.columns]]
|
||||
name = "processed_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.payment_callbacks.uniques]]
|
||||
name = "uq_payment_callbacks_callback_key"
|
||||
columns = ["callback_key"]
|
||||
|
||||
[[table.payment_callbacks.indexes]]
|
||||
name = "idx_payment_callbacks_order"
|
||||
columns = ["order_no"]
|
||||
|
||||
[[table.payment_callbacks.indexes]]
|
||||
name = "idx_payment_callbacks_gateway_order"
|
||||
columns = ["gateway_order_id"]
|
||||
|
||||
[[table.payment_callbacks.indexes]]
|
||||
name = "idx_payment_callbacks_created"
|
||||
columns = ["created_at"]
|
||||
|
||||
[[table.payment_callbacks.indexes]]
|
||||
name = "ix_payment_callbacks_payment_order_id"
|
||||
columns = ["payment_order_id"]
|
||||
|
||||
[table.refund_requests]
|
||||
domain = "wallet_billing"
|
||||
order = 60
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "refund_no"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "payment_order_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "source_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "source_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "refund_mode"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "amount_usd"
|
||||
type = "float64"
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "pending_approval"
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "reason"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "requested_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "approved_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "processed_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "gateway_refund_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "payout_method"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "payout_reference"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "payout_proof"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "failure_reason"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "idempotency_key"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "processed_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.columns]]
|
||||
name = "completed_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.refund_requests.uniques]]
|
||||
name = "uq_refund_requests_refund_no"
|
||||
columns = ["refund_no"]
|
||||
|
||||
[[table.refund_requests.uniques]]
|
||||
name = "uq_refund_requests_idempotency_key"
|
||||
columns = ["idempotency_key"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "idx_refund_wallet_created"
|
||||
columns = ["wallet_id", "created_at"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "idx_refund_user_created"
|
||||
columns = ["user_id", "created_at"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "idx_refund_status"
|
||||
columns = ["status"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "ix_refund_requests_payment_order_id"
|
||||
columns = ["payment_order_id"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "ix_refund_requests_requested_by"
|
||||
columns = ["requested_by"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "ix_refund_requests_approved_by"
|
||||
columns = ["approved_by"]
|
||||
|
||||
[[table.refund_requests.indexes]]
|
||||
name = "ix_refund_requests_processed_by"
|
||||
columns = ["processed_by"]
|
||||
|
||||
[table.redeem_code_batches]
|
||||
domain = "wallet_billing"
|
||||
order = 70
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "amount_usd"
|
||||
type = "float64"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "currency"
|
||||
type = "text"
|
||||
length = 16
|
||||
default = "USD"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "balance_bucket"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "gift"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "total_count"
|
||||
type = "int32"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "active"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "description"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "created_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "expires_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.redeem_code_batches.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.redeem_code_batches.indexes]]
|
||||
name = "idx_redeem_code_batches_status"
|
||||
columns = ["status", "created_at"]
|
||||
|
||||
[table.redeem_codes]
|
||||
domain = "wallet_billing"
|
||||
order = 80
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "batch_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "code_hash"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "code_prefix"
|
||||
type = "text"
|
||||
length = 16
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "code_suffix"
|
||||
type = "text"
|
||||
length = 16
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "active"
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "redeemed_by_user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "redeemed_wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "redeemed_payment_order_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "redeemed_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "disabled_by"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.redeem_codes.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.redeem_codes.uniques]]
|
||||
name = "uq_redeem_codes_code_hash"
|
||||
columns = ["code_hash"]
|
||||
|
||||
[[table.redeem_codes.indexes]]
|
||||
name = "idx_redeem_codes_batch_created"
|
||||
columns = ["batch_id", "created_at"]
|
||||
|
||||
[[table.redeem_codes.indexes]]
|
||||
name = "idx_redeem_codes_status"
|
||||
columns = ["status", "updated_at"]
|
||||
|
||||
[[table.redeem_codes.indexes]]
|
||||
name = "idx_redeem_codes_redeemed_user"
|
||||
columns = ["redeemed_by_user_id", "redeemed_at"]
|
||||
|
||||
[[table.redeem_codes.indexes]]
|
||||
name = "idx_redeem_codes_redeemed_order"
|
||||
columns = ["redeemed_payment_order_id"]
|
||||
627
crates/aether-data/schema/logical/006_usage.toml
Normal file
627
crates/aether-data/schema/logical/006_usage.toml
Normal file
@@ -0,0 +1,627 @@
|
||||
[table.usage]
|
||||
domain = "usage"
|
||||
order = 10
|
||||
primary_key = ["request_id"]
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "api_key_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
default = "unknown"
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
default = "unknown"
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "target_model"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_endpoint_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_api_key_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_type"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "api_format"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "api_family"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "endpoint_kind"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "endpoint_api_format"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_api_family"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_endpoint_kind"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "has_format_conversion"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "is_stream"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "input_output_total_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "total_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_input_tokens_5m"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_input_tokens_1h"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_ephemeral_5m_input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_ephemeral_1h_input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_read_input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "input_context_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "input_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "output_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_cost_usd_5m"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_cost_usd_1h"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_read_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_input_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_output_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_cache_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_cache_creation_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_cache_creation_cost_usd_5m"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_cache_creation_cost_usd_1h"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_cache_read_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_request_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "rate_multiplier"
|
||||
type = "float64"
|
||||
default = 1
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "input_price_per_1m"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "output_price_per_1m"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_price_per_1m"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_price_per_1m_5m"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_creation_price_per_1m_1h"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "cache_read_price_per_1m"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "price_per_request"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "status_code"
|
||||
type = "int32"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "error_message"
|
||||
type = "long_text"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "error_category"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "response_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "first_byte_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "completed"
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "billing_status"
|
||||
type = "text"
|
||||
length = 64
|
||||
default = "pending"
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "total_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "actual_total_cost_usd"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_headers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_body"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_request_headers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_request_body"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "response_headers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "response_body"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "client_response_headers"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "client_response_body"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_body_compressed"
|
||||
type = "bytes"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "provider_request_body_compressed"
|
||||
type = "bytes"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "response_body_compressed"
|
||||
type = "bytes"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "client_response_body_compressed"
|
||||
type = "bytes"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "request_metadata"
|
||||
type = "json"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "candidate_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "candidate_index"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "key_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "api_key_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "planner_kind"
|
||||
type = "text"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "route_family"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "route_kind"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "execution_path"
|
||||
type = "text"
|
||||
length = 128
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "local_execution_runtime_miss_reason"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_recharge_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_recharge_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_gift_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "wallet_gift_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "finalized_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "created_at_unix_ms"
|
||||
type = "unix_millis"
|
||||
default = 0
|
||||
|
||||
[[table.usage.columns]]
|
||||
name = "updated_at_unix_secs"
|
||||
type = "unix_seconds"
|
||||
default = 0
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_api_key_id_idx"
|
||||
columns = ["api_key_id"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_billing_status_idx"
|
||||
columns = ["billing_status"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_created_at_idx"
|
||||
columns = ["created_at_unix_ms"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_provider_api_key_id_idx"
|
||||
columns = ["provider_api_key_id"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_provider_id_idx"
|
||||
columns = ["provider_id"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_request_id_idx"
|
||||
columns = ["request_id"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_user_id_idx"
|
||||
columns = ["user_id"]
|
||||
|
||||
[[table.usage.indexes]]
|
||||
name = "usage_wallet_id_idx"
|
||||
columns = ["wallet_id"]
|
||||
|
||||
[table.usage_settlement_snapshots]
|
||||
domain = "usage"
|
||||
order = 20
|
||||
primary_key = ["request_id"]
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "request_id"
|
||||
type = "text"
|
||||
length = 128
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "billing_status"
|
||||
type = "text"
|
||||
length = 64
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_recharge_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_recharge_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_gift_balance_before"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "wallet_gift_balance_after"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "provider_monthly_used_usd"
|
||||
type = "float64"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "finalized_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.usage_settlement_snapshots.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.usage_settlement_snapshots.indexes]]
|
||||
name = "usage_settlement_snapshots_billing_status_idx"
|
||||
columns = ["billing_status"]
|
||||
|
||||
[[table.usage_settlement_snapshots.indexes]]
|
||||
name = "usage_settlement_snapshots_wallet_id_idx"
|
||||
columns = ["wallet_id"]
|
||||
921
crates/aether-data/schema/logical/007_stats.toml
Normal file
921
crates/aether-data/schema/logical/007_stats.toml
Normal file
@@ -0,0 +1,921 @@
|
||||
[table.stats_hourly]
|
||||
domain = "stats"
|
||||
order = 10
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "hour_utc"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "actual_total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "avg_response_time_ms"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "is_complete"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "aggregated_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly.uniques]]
|
||||
name = "uq_stats_hourly_hour"
|
||||
columns = ["hour_utc"]
|
||||
|
||||
[table.stats_summary]
|
||||
domain = "stats"
|
||||
order = 15
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "cutoff_date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "all_time_actual_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "total_users"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "active_users"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "total_api_keys"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "active_api_keys"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_summary.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[table.stats_hourly_user]
|
||||
domain = "stats"
|
||||
order = 20
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "hour_utc"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user.uniques]]
|
||||
name = "uq_stats_hourly_user"
|
||||
columns = ["hour_utc", "user_id"]
|
||||
|
||||
[table.stats_hourly_user_model]
|
||||
domain = "stats"
|
||||
order = 30
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "hour_utc"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user_model.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_user_model.uniques]]
|
||||
name = "uq_stats_hourly_user_model"
|
||||
columns = ["hour_utc", "user_id", "model"]
|
||||
|
||||
[table.user_model_usage_counts]
|
||||
domain = "stats"
|
||||
order = 35
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "usage_count"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_model_usage_counts.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.user_model_usage_counts.uniques]]
|
||||
name = "uq_user_model_usage_count"
|
||||
columns = ["user_id", "model"]
|
||||
|
||||
[[table.user_model_usage_counts.indexes]]
|
||||
name = "idx_user_model_usage_user"
|
||||
columns = ["user_id"]
|
||||
|
||||
[[table.user_model_usage_counts.indexes]]
|
||||
name = "idx_user_model_usage_model"
|
||||
columns = ["model"]
|
||||
|
||||
[table.stats_hourly_model]
|
||||
domain = "stats"
|
||||
order = 40
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "hour_utc"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "avg_response_time_ms"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_model.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_model.uniques]]
|
||||
name = "uq_stats_hourly_model"
|
||||
columns = ["hour_utc", "model"]
|
||||
|
||||
[table.stats_hourly_provider]
|
||||
domain = "stats"
|
||||
order = 50
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "hour_utc"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "provider_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_provider.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_hourly_provider.uniques]]
|
||||
name = "uq_stats_hourly_provider"
|
||||
columns = ["hour_utc", "provider_name"]
|
||||
|
||||
[table.stats_daily]
|
||||
domain = "stats"
|
||||
order = 60
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "actual_total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "input_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "output_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "cache_creation_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "cache_read_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "avg_response_time_ms"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "fallback_count"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "unique_models"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "unique_providers"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "is_complete"
|
||||
type = "bool"
|
||||
default = false
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "aggregated_at"
|
||||
type = "unix_seconds"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p50_response_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p90_response_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p99_response_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p50_first_byte_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p90_first_byte_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.columns]]
|
||||
name = "p99_first_byte_time_ms"
|
||||
type = "int64"
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily.uniques]]
|
||||
name = "uq_stats_daily_date"
|
||||
columns = ["date"]
|
||||
|
||||
[table.stats_daily_model]
|
||||
domain = "stats"
|
||||
order = 70
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "avg_response_time_ms"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_model.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_model.uniques]]
|
||||
name = "uq_stats_daily_model"
|
||||
columns = ["date", "model"]
|
||||
|
||||
[table.stats_daily_provider]
|
||||
domain = "stats"
|
||||
order = 80
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "provider_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_provider.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_provider.uniques]]
|
||||
name = "uq_stats_daily_provider"
|
||||
columns = ["date", "provider_name"]
|
||||
|
||||
[table.stats_daily_api_key]
|
||||
domain = "stats"
|
||||
order = 90
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "api_key_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "api_key_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_api_key.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_api_key.uniques]]
|
||||
name = "uq_stats_daily_api_key"
|
||||
columns = ["date", "api_key_id"]
|
||||
|
||||
[table.stats_daily_error]
|
||||
domain = "stats"
|
||||
order = 100
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "error_category"
|
||||
type = "text"
|
||||
length = 255
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "provider_name"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "model"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "count"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_error.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_daily_error.uniques]]
|
||||
name = "uq_stats_daily_error"
|
||||
columns = ["date", "error_category", "provider_name", "model"]
|
||||
|
||||
[table.stats_user_daily]
|
||||
domain = "stats"
|
||||
order = 110
|
||||
primary_key = ["id"]
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "user_id"
|
||||
type = "text_id"
|
||||
length = 64
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "date"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "total_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "success_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "error_requests"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "input_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "output_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "cache_creation_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "cache_read_tokens"
|
||||
type = "int64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "total_cost"
|
||||
type = "float64"
|
||||
default = 0
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "username"
|
||||
type = "text"
|
||||
length = 255
|
||||
nullable = true
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "created_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_user_daily.columns]]
|
||||
name = "updated_at"
|
||||
type = "unix_seconds"
|
||||
|
||||
[[table.stats_user_daily.uniques]]
|
||||
name = "uq_stats_user_daily"
|
||||
columns = ["date", "user_id"]
|
||||
Reference in New Issue
Block a user