migration scripts

This commit is contained in:
Jun-te Kim 2026-05-26 10:23:50 +00:00
parent 1df047a84a
commit b8be604ab3
3 changed files with 9660 additions and 0 deletions

View file

@ -0,0 +1,27 @@
CREATE TYPE "public"."override_source" AS ENUM('classifier', 'user');--> statement-breakpoint
CREATE TYPE "public"."property_type" AS ENUM('House', 'Bungalow', 'Flat', 'Maisonette', 'Park home', 'Unknown');--> statement-breakpoint
CREATE TYPE "public"."wall_type" AS ENUM('Cavity', 'Solid Brick', 'Timber frame', 'Sandstone', 'Unknown');--> statement-breakpoint
CREATE TABLE "landlord_property_type_overrides" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"portfolio_id" bigint NOT NULL,
"description" text NOT NULL,
"value" "property_type" NOT NULL,
"source" "override_source" NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "landlord_property_type_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
);
--> statement-breakpoint
CREATE TABLE "landlord_wall_type_overrides" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"portfolio_id" bigint NOT NULL,
"description" text NOT NULL,
"value" "wall_type" NOT NULL,
"source" "override_source" NOT NULL,
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
CONSTRAINT "landlord_wall_type_overrides_portfolio_description_unique" UNIQUE("portfolio_id","description")
);
--> statement-breakpoint
ALTER TABLE "landlord_property_type_overrides" ADD CONSTRAINT "landlord_property_type_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "landlord_wall_type_overrides" ADD CONSTRAINT "landlord_wall_type_overrides_portfolio_id_portfolio_id_fk" FOREIGN KEY ("portfolio_id") REFERENCES "public"."portfolio"("id") ON DELETE cascade ON UPDATE no action;

File diff suppressed because it is too large Load diff

View file

@ -1436,6 +1436,13 @@
"when": 1779092260406,
"tag": "0204_bizarre_black_bird",
"breakpoints": true
},
{
"idx": 205,
"version": "7",
"when": 1779791011744,
"tag": "0205_wonderful_pixie",
"breakpoints": true
}
]
}