stats: history and culture collector (step 4): events, offices, people, holidays, UNESCO, religion, long-run series
Some checks failed
Deploy production / deploy (push) Failing after 1m0s
Some checks failed
Deploy production / deploy (push) Failing after 1m0s
This commit is contained in:
74
drizzle/20261025232448_stats_step4/migration.sql
Normal file
74
drizzle/20261025232448_stats_step4/migration.sql
Normal file
@@ -0,0 +1,74 @@
|
||||
CREATE TABLE "stats"."hist_event" (
|
||||
"place" text,
|
||||
"slug" text,
|
||||
"year" integer NOT NULL,
|
||||
"year_end" integer,
|
||||
"date_label" text,
|
||||
"title" text NOT NULL,
|
||||
"summary" text NOT NULL,
|
||||
"theme" text NOT NULL,
|
||||
"source_url" text NOT NULL,
|
||||
CONSTRAINT "hist_event_pkey" PRIMARY KEY("place","slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."hist_fact" (
|
||||
"place" text,
|
||||
"slug" text,
|
||||
"topic" text NOT NULL,
|
||||
"title" text NOT NULL,
|
||||
"body" text NOT NULL,
|
||||
"source_url" text NOT NULL,
|
||||
"sort" integer NOT NULL,
|
||||
CONSTRAINT "hist_fact_pkey" PRIMARY KEY("place","slug")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."hist_holiday" (
|
||||
"place" text,
|
||||
"date" date,
|
||||
"name" text,
|
||||
"local_name" text,
|
||||
"global" boolean NOT NULL,
|
||||
"types" jsonb,
|
||||
CONSTRAINT "hist_holiday_pkey" PRIMARY KEY("place","date","name")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."hist_office" (
|
||||
"place" text NOT NULL,
|
||||
"kind" text NOT NULL,
|
||||
"office_qid" text,
|
||||
"office_label" text NOT NULL,
|
||||
"person_qid" text,
|
||||
"person_label" text NOT NULL,
|
||||
"party" text,
|
||||
"start_date" date,
|
||||
"end_date" date,
|
||||
CONSTRAINT "hist_office_pkey" PRIMARY KEY("office_qid","person_qid","start_date")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."hist_person" (
|
||||
"place" text,
|
||||
"person_qid" text,
|
||||
"label" text NOT NULL,
|
||||
"description" text,
|
||||
"birth_year" integer,
|
||||
"death_year" integer,
|
||||
"sitelinks" integer NOT NULL,
|
||||
"url" text NOT NULL,
|
||||
"rank" integer NOT NULL,
|
||||
CONSTRAINT "hist_person_pkey" PRIMARY KEY("place","person_qid")
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "stats"."unesco_site" (
|
||||
"id_no" integer PRIMARY KEY,
|
||||
"name" text NOT NULL,
|
||||
"places" jsonb NOT NULL,
|
||||
"category" text NOT NULL,
|
||||
"year_inscribed" integer,
|
||||
"danger" boolean NOT NULL,
|
||||
"description" text,
|
||||
"lat" double precision,
|
||||
"lon" double precision,
|
||||
"image_url" text
|
||||
);
|
||||
--> 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