DROP VIEW "public"."view_tag_subfields";--> statement-breakpoint
ALTER TABLE "bidding-projects" RENAME TO "bidding_projects";--> statement-breakpoint
ALTER TABLE "project_series" RENAME COLUMN "kl_qtr" TO "kl_dt";--> statement-breakpoint
ALTER TABLE "bidding_projects" DROP CONSTRAINT "bidding-projects_pspid_unique";--> statement-breakpoint
ALTER TABLE "project_series" DROP CONSTRAINT "project_series_pspid_bidding-projects_pspid_fk";
--> statement-breakpoint
ALTER TABLE "rfqs" DROP CONSTRAINT "rfqs_bid_project_id_bidding-projects_id_fk";
--> statement-breakpoint
ALTER TABLE "tag_subfields" DROP CONSTRAINT "tag_subfields_tag_type_code_project_id_tag_types_code_project_id_fk";
--> statement-breakpoint
ALTER TABLE "tag_type_class_form_mappings" DROP CONSTRAINT "tag_type_class_form_mappings_project_id_projects_id_fk";
--> statement-breakpoint
ALTER TABLE "project_series" ADD COLUMN "sc_dt" char(8);--> statement-breakpoint
ALTER TABLE "project_series" ADD COLUMN "lc_dt" char(8);--> statement-breakpoint
ALTER TABLE "project_series" ADD COLUMN "dl_dt" char(8);--> statement-breakpoint
ALTER TABLE "project_series" ADD CONSTRAINT "project_series_pspid_bidding_projects_pspid_fk" FOREIGN KEY ("pspid") REFERENCES "public"."bidding_projects"("pspid") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "rfqs" ADD CONSTRAINT "rfqs_bid_project_id_bidding_projects_id_fk" FOREIGN KEY ("bid_project_id") REFERENCES "public"."bidding_projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "bidding_projects" ADD CONSTRAINT "bidding_projects_pspid_unique" UNIQUE("pspid");--> statement-breakpoint
CREATE VIEW "public"."view_tag_subfields" AS (select "tag_subfields"."id", "tag_subfields"."tag_type_code", "tag_types"."description", "tag_subfields"."attributes_id", "tag_subfields"."attributes_description", "tag_subfields"."expression", "tag_subfields"."delimiter", "tag_subfields"."sort_order", "tag_subfields"."created_at", "tag_subfields"."updated_at", "projects"."id", "projects"."code", "projects"."name" from "tag_subfields" inner join "tag_types" on ("tag_subfields"."tag_type_code" = "tag_types"."code" and "tag_subfields"."project_id" = "tag_types"."project_id") inner join "projects" on "tag_subfields"."project_id" = "projects"."id");