All checks were successful
Deploy production / deploy (push) Successful in 1m10s
120 lines
3.6 KiB
SQL
120 lines
3.6 KiB
SQL
CREATE TABLE "stats"."ec_crossborder" (
|
|
"country" text,
|
|
"neighbour" text,
|
|
"ts" timestamp with time zone,
|
|
"gw" double precision,
|
|
CONSTRAINT "ec_crossborder_pkey" PRIMARY KEY("country","neighbour","ts")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."ec_dayahead_price" (
|
|
"bzn" text,
|
|
"ts" timestamp with time zone,
|
|
"eur_mwh" double precision,
|
|
CONSTRAINT "ec_dayahead_price_pkey" PRIMARY KEY("bzn","ts")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."imf_weo" (
|
|
"vintage" text,
|
|
"indicator" text,
|
|
"country_iso3" text,
|
|
"year" integer,
|
|
"value" double precision,
|
|
"is_forecast" boolean NOT NULL,
|
|
CONSTRAINT "imf_weo_pkey" PRIMARY KEY("vintage","indicator","country_iso3","year")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."owid_energy" (
|
|
"country" text,
|
|
"iso3" text,
|
|
"year" integer,
|
|
"values" jsonb NOT NULL,
|
|
CONSTRAINT "owid_energy_pkey" PRIMARY KEY("country","year")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."owid_maddison" (
|
|
"entity" text,
|
|
"iso3" text,
|
|
"year" integer,
|
|
"gdp_pc" double precision,
|
|
CONSTRAINT "owid_maddison_pkey" PRIMARY KEY("entity","year")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."rf_budget_table" (
|
|
"year" integer,
|
|
"phase" text,
|
|
"row_key" text,
|
|
"vuo" char(1) NOT NULL,
|
|
"chapter" text NOT NULL,
|
|
"chapter_name" text NOT NULL,
|
|
"article" text,
|
|
"article_name" text,
|
|
"detail" jsonb DEFAULT '{}' NOT NULL,
|
|
"amount_eur_k" double precision,
|
|
CONSTRAINT "rf_budget_table_pkey" PRIMARY KEY("year","phase","row_key")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."usas_agency_fy" (
|
|
"toptier_code" text,
|
|
"fiscal_year" integer,
|
|
"agency_name" text NOT NULL,
|
|
"abbreviation" text,
|
|
"budgetary_resources" double precision,
|
|
"obligated" double precision,
|
|
"outlayed" double precision,
|
|
CONSTRAINT "usas_agency_fy_pkey" PRIMARY KEY("toptier_code","fiscal_year")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."ust_debt_daily" (
|
|
"record_date" date PRIMARY KEY,
|
|
"debt_held_public" double precision,
|
|
"intragov_holdings" double precision,
|
|
"total_debt" double precision
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."ust_mts_outlays" (
|
|
"record_date" date,
|
|
"classification_id" text,
|
|
"parent_id" text,
|
|
"description" text NOT NULL,
|
|
"level" integer,
|
|
"print_order" integer,
|
|
"net_month" double precision,
|
|
"net_fytd" double precision,
|
|
"gross_month" double precision,
|
|
CONSTRAINT "ust_mts_outlays_pkey" PRIMARY KEY("record_date","classification_id")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."ust_mts_receipts" (
|
|
"record_date" date,
|
|
"classification_id" text,
|
|
"parent_id" text,
|
|
"description" text NOT NULL,
|
|
"level" integer,
|
|
"print_order" integer,
|
|
"net_month" double precision,
|
|
"net_fytd" double precision,
|
|
"gross_month" double precision,
|
|
CONSTRAINT "ust_mts_receipts_pkey" PRIMARY KEY("record_date","classification_id")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE "stats"."wb_indicator" (
|
|
"indicator_id" text,
|
|
"country_iso3" text,
|
|
"year" integer,
|
|
"value" double precision,
|
|
CONSTRAINT "wb_indicator_pkey" PRIMARY KEY("indicator_id","country_iso3","year")
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX "rf_budget_table_chapter_idx" ON "stats"."rf_budget_table" ("year","vuo","chapter");--> statement-breakpoint
|
|
-- Hand-written below this line (not generated by drizzle-kit).
|
|
-- Same grants as stats_core (default privileges already cover new tables; kept idempotent).
|
|
DO $$
|
|
BEGIN
|
|
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_app') THEN
|
|
GRANT SELECT, INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA stats TO personal_app;
|
|
END IF;
|
|
IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'personal_ro') THEN
|
|
GRANT SELECT ON ALL TABLES IN SCHEMA stats TO personal_ro;
|
|
END IF;
|
|
END $$;
|