CREATE TABLE "form_templates" (
	"id" serial PRIMARY KEY NOT NULL,
	"form_id" integer,
	"file_name" varchar(255) NOT NULL,
	"file_path" varchar(1024) NOT NULL,
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "contract_signers" ALTER COLUMN "signer_email" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "contract_signers" ALTER COLUMN "signer_name" SET NOT NULL;--> statement-breakpoint
ALTER TABLE "contract_signers" ALTER COLUMN "signer_status" SET DEFAULT 'PENDING';--> statement-breakpoint
ALTER TABLE "contract_envelopes" ADD COLUMN "file_name" varchar(255) NOT NULL;--> statement-breakpoint
ALTER TABLE "contract_envelopes" ADD COLUMN "file_path" varchar(1024) NOT NULL;--> statement-breakpoint
ALTER TABLE "contract_signers" ADD COLUMN "vendor_contact_id" integer;--> statement-breakpoint
ALTER TABLE "contract_signers" ADD COLUMN "signer_type" varchar(20) DEFAULT 'VENDOR' NOT NULL;--> statement-breakpoint
ALTER TABLE "form_templates" ADD CONSTRAINT "form_templates_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "contract_signers" ADD CONSTRAINT "contract_signers_vendor_contact_id_vendor_contacts_id_fk" FOREIGN KEY ("vendor_contact_id") REFERENCES "public"."vendor_contacts"("id") ON DELETE no action ON UPDATE no action;