mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-07 01:47:47 +08:00
Add dashboard and overview analytics, health monitoring, provider expense tracking, and announcement updates across the gateway and frontend. Keep schema migrations free of historical backfills while preserving automatic backfill execution. Bound migration deadlines, run schema preparation before Compose replacement, and anonymize deleted dashboard users. Include the current documentation cleanup and regression coverage.
64 lines
2.9 KiB
SQL
64 lines
2.9 KiB
SQL
-- Generated by aether-data-schema from crates/aether-data/runtime/schema/logical/*.toml.
|
|
-- Do not edit generated files directly; edit logical schema or explicit overrides instead.
|
|
|
|
CREATE TABLE IF NOT EXISTS public.stats_bucket_state (
|
|
projection_version text NOT NULL,
|
|
granularity text NOT NULL,
|
|
bucket_start timestamp with time zone NOT NULL,
|
|
source_revision bigint DEFAULT 0 NOT NULL,
|
|
built_revision bigint DEFAULT -1 NOT NULL,
|
|
coverage_status text DEFAULT 'unbuilt' NOT NULL,
|
|
built_at timestamp with time zone,
|
|
last_error text,
|
|
last_failed_at timestamp with time zone
|
|
);
|
|
|
|
ALTER TABLE ONLY public.stats_bucket_state ADD CONSTRAINT stats_bucket_state_pkey PRIMARY KEY (projection_version, granularity, bucket_start);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.stats_overview_daily (
|
|
projection_version text NOT NULL,
|
|
bucket_start timestamp with time zone NOT NULL,
|
|
dimensions jsonb NOT NULL,
|
|
metrics jsonb NOT NULL
|
|
);
|
|
|
|
ALTER TABLE ONLY public.stats_overview_daily ADD CONSTRAINT stats_overview_daily_pkey PRIMARY KEY (projection_version, bucket_start, dimensions);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.stats_overview_dirty_events (
|
|
transaction_id bigint NOT NULL,
|
|
projection_version text NOT NULL,
|
|
granularity text NOT NULL,
|
|
bucket_start timestamp with time zone NOT NULL,
|
|
unrecoverable boolean DEFAULT false NOT NULL
|
|
);
|
|
|
|
ALTER TABLE ONLY public.stats_overview_dirty_events ADD CONSTRAINT stats_overview_dirty_events_pkey PRIMARY KEY (transaction_id, projection_version, granularity, bucket_start);
|
|
CREATE INDEX IF NOT EXISTS ix_stats_overview_dirty_events_bucket ON public.stats_overview_dirty_events USING btree (projection_version, granularity, bucket_start);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.stats_overview_hourly (
|
|
projection_version text NOT NULL,
|
|
bucket_start timestamp with time zone NOT NULL,
|
|
dimensions jsonb NOT NULL,
|
|
metrics jsonb NOT NULL
|
|
);
|
|
|
|
ALTER TABLE ONLY public.stats_overview_hourly ADD CONSTRAINT stats_overview_hourly_pkey PRIMARY KEY (projection_version, bucket_start, dimensions);
|
|
|
|
CREATE TABLE IF NOT EXISTS public.usage_attribution_snapshots (
|
|
request_id text NOT NULL,
|
|
actor_user_id text,
|
|
credential_owner_id text,
|
|
attribution_kind text DEFAULT 'unknown' NOT NULL,
|
|
attribution_source text DEFAULT 'unknown' NOT NULL,
|
|
record_kind text DEFAULT 'request' NOT NULL,
|
|
parent_request_id text,
|
|
schema_version integer DEFAULT 1 NOT NULL,
|
|
attribution_revision bigint DEFAULT 1 NOT NULL,
|
|
recorded_at timestamp with time zone DEFAULT NOW() NOT NULL
|
|
);
|
|
|
|
ALTER TABLE ONLY public.usage_attribution_snapshots ADD CONSTRAINT usage_attribution_snapshots_pkey PRIMARY KEY (request_id);
|
|
CREATE INDEX IF NOT EXISTS ix_usage_attribution_actor_request ON public.usage_attribution_snapshots USING btree (actor_user_id, request_id);
|
|
CREATE INDEX IF NOT EXISTS ix_usage_attribution_owner_request ON public.usage_attribution_snapshots USING btree (credential_owner_id, request_id);
|
|
|