stats §8: CBS Curaçao collector (topic-page scrape, sha256 manifest, CPI since 1970 from PDF, GDP by industry, government finance, population since 1900, LFS, tourism) into cw_cbs_* + stats.obs region CUW; cw_cbcs_bop for manual uploads; weekly timer
Some checks failed
Deploy production / deploy (push) Has been cancelled
Some checks failed
Deploy production / deploy (push) Has been cancelled
This commit is contained in:
78
drizzle/20261025213818_stats_curacao/migration.sql
Normal file
78
drizzle/20261025213818_stats_curacao/migration.sql
Normal file
@@ -0,0 +1,78 @@
|
||||
CREATE TABLE "stats"."cw_cbcs_bop" (
|
||||
"period" date,
|
||||
"item" text,
|
||||
"mln_ang" double precision,
|
||||
"uploaded_at" timestamp with time zone DEFAULT now() NOT NULL,
|
||||
CONSTRAINT "cw_cbcs_bop_pkey" PRIMARY KEY("period","item")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_cpi" (
|
||||
"period" date PRIMARY KEY,
|
||||
"cpi_index" double precision NOT NULL,
|
||||
"infl_mom" double precision,
|
||||
"infl_yoy" double precision,
|
||||
"infl_12m_avg" double precision,
|
||||
"base" text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_file" (
|
||||
"url" text PRIMARY KEY,
|
||||
"topic" text NOT NULL,
|
||||
"filename" text NOT NULL,
|
||||
"sha256" text NOT NULL,
|
||||
"fetched_at" timestamp with time zone DEFAULT now() NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_gdp_industry" (
|
||||
"year" integer,
|
||||
"isic" text,
|
||||
"label" text NOT NULL,
|
||||
"mln_ang" double precision,
|
||||
"provisional" boolean DEFAULT false NOT NULL,
|
||||
CONSTRAINT "cw_cbs_gdp_industry_pkey" PRIMARY KEY("year","isic")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_gov_finance" (
|
||||
"year" integer,
|
||||
"item_code" text,
|
||||
"label" text NOT NULL,
|
||||
"mln_ang" double precision,
|
||||
"provisional" boolean DEFAULT true NOT NULL,
|
||||
CONSTRAINT "cw_cbs_gov_finance_pkey" PRIMARY KEY("year","item_code")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_lfs" (
|
||||
"year" integer,
|
||||
"sex" text,
|
||||
"age_group" text,
|
||||
"measure" text,
|
||||
"value" double precision,
|
||||
CONSTRAINT "cw_cbs_lfs_pkey" PRIMARY KEY("year","sex","age_group","measure")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_population" (
|
||||
"year" integer,
|
||||
"sex" text,
|
||||
"age_group" text,
|
||||
"kind" text,
|
||||
"value" double precision,
|
||||
CONSTRAINT "cw_cbs_population_pkey" PRIMARY KEY("year","sex","age_group","kind")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."cw_cbs_tourism" (
|
||||
"period" date,
|
||||
"measure" text,
|
||||
"market" text,
|
||||
"value" double precision,
|
||||
CONSTRAINT "cw_cbs_tourism_pkey" PRIMARY KEY("period","measure","market")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
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 $$;
|
||||
Reference in New Issue
Block a user