CREATE TABLE "template_items" (
	"id" serial PRIMARY KEY NOT NULL,
	"form_mapping_id" integer NOT NULL,
	"tmpl_id" varchar(255) NOT NULL,
	"name" varchar(255) NOT NULL,
	"tmpl_type" varchar(100) NOT NULL,
	"spr_lst_setup" json NOT NULL,
	"grd_lst_setup" json NOT NULL,
	"spr_itm_lst_setup" json NOT NULL,
	"description" text,
	"is_active" boolean DEFAULT true NOT NULL,
	"created_at" timestamp with time zone DEFAULT now() NOT NULL,
	"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
	CONSTRAINT "uniq_tmpl_in_form_mapping" UNIQUE("form_mapping_id","tmpl_id"),
	CONSTRAINT "uniq_name_in_form_mapping" UNIQUE("form_mapping_id","name")
);
--> statement-breakpoint
ALTER TABLE "evaluation_submissions" DROP CONSTRAINT "evaluation_submissions_vendor_id_vendors_id_fk";
--> statement-breakpoint
ALTER TABLE "ocr_rows" ADD COLUMN "file_name" varchar(255);--> statement-breakpoint
ALTER TABLE "ocr_rows" ADD COLUMN "inspection_date" varchar(255);--> statement-breakpoint
ALTER TABLE "template_items" ADD CONSTRAINT "template_items_form_mapping_id_tag_type_class_form_mappings_id_fk" FOREIGN KEY ("form_mapping_id") REFERENCES "public"."tag_type_class_form_mappings"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "evaluation_submissions" DROP COLUMN "vendor_id";