mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-06 17:37:47 +08:00
85 lines
3.4 KiB
SQL
85 lines
3.4 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.dashboard_activity_hour (
|
||
|
|
bucket_start timestamp with time zone NOT NULL,
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
request_count bigint NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_activity_hour ADD CONSTRAINT dashboard_activity_hour_pkey PRIMARY KEY (bucket_start, shard);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_activity_minute (
|
||
|
|
bucket_start timestamp with time zone NOT NULL,
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
request_count bigint NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_activity_minute ADD CONSTRAINT dashboard_activity_minute_pkey PRIMARY KEY (bucket_start, shard);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_actor_minute (
|
||
|
|
bucket_start timestamp with time zone NOT NULL,
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
actor_user_id character varying(255) NOT NULL,
|
||
|
|
request_count bigint NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_actor_minute ADD CONSTRAINT dashboard_actor_minute_pkey PRIMARY KEY (bucket_start, shard, actor_user_id);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_request_contributions (
|
||
|
|
request_id character varying(100) NOT NULL,
|
||
|
|
created_at timestamp with time zone NOT NULL,
|
||
|
|
actor_user_id character varying(255),
|
||
|
|
metrics jsonb NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_request_contributions ADD CONSTRAINT dashboard_request_contributions_pkey PRIMARY KEY (request_id);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_stats_minute (
|
||
|
|
bucket_start timestamp with time zone NOT NULL,
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
metrics jsonb DEFAULT '{}'::jsonb NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_stats_minute ADD CONSTRAINT dashboard_stats_minute_pkey PRIMARY KEY (bucket_start, shard);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_stats_pending (
|
||
|
|
transaction_id bigint NOT NULL,
|
||
|
|
request_id character varying(100) NOT NULL,
|
||
|
|
deleted_fact jsonb
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_stats_pending ADD CONSTRAINT dashboard_stats_pending_pkey PRIMARY KEY (transaction_id, request_id);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_stats_state (
|
||
|
|
singleton boolean DEFAULT true NOT NULL,
|
||
|
|
stats_since timestamp with time zone NOT NULL,
|
||
|
|
contributions_cleanup_cursor character varying(100)
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_stats_state ADD CONSTRAINT dashboard_stats_state_pkey PRIMARY KEY (singleton);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_stats_total (
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
metrics jsonb DEFAULT '{}'::jsonb NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_stats_total ADD CONSTRAINT dashboard_stats_total_pkey PRIMARY KEY (shard);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_user_anonymization_pending (
|
||
|
|
transaction_id bigint NOT NULL,
|
||
|
|
user_id character varying(255) NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_user_anonymization_pending ADD CONSTRAINT dashboard_user_anonymization_pending_pkey PRIMARY KEY (transaction_id, user_id);
|
||
|
|
|
||
|
|
CREATE TABLE IF NOT EXISTS public.dashboard_user_events_minute (
|
||
|
|
bucket_start timestamp with time zone NOT NULL,
|
||
|
|
shard smallint NOT NULL,
|
||
|
|
created_count bigint DEFAULT 0 NOT NULL,
|
||
|
|
deleted_count bigint DEFAULT 0 NOT NULL
|
||
|
|
);
|
||
|
|
|
||
|
|
ALTER TABLE ONLY public.dashboard_user_events_minute ADD CONSTRAINT dashboard_user_events_minute_pkey PRIMARY KEY (bucket_start, shard);
|
||
|
|
|