CREATE TABLE "vendor_additional_info" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"business_type" varchar(50),
	"industry_type" varchar(50),
	"company_size" varchar(20),
	"revenue" numeric(15, 2),
	"factory_established_date" date,
	"preferred_contract_terms" text,
	"created_at" timestamp DEFAULT now(),
	"updated_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "vendor_business_contacts" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"contact_type" varchar(20) NOT NULL,
	"contact_name" varchar(100) NOT NULL,
	"position" varchar(50) NOT NULL,
	"department" varchar(100) NOT NULL,
	"responsibility" varchar(200) NOT NULL,
	"email" varchar(255) NOT NULL,
	"created_at" timestamp DEFAULT now(),
	"updated_at" timestamp DEFAULT now()
);
--> statement-breakpoint
CREATE TABLE "vendor_regular_registrations" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"status" varchar(50) DEFAULT 'audit_pass' NOT NULL,
	"potential_code" varchar(20),
	"major_items" text,
	"registration_request_date" date,
	"assigned_department" varchar(100),
	"assigned_department_code" varchar(20),
	"assigned_user" varchar(100),
	"assigned_user_code" varchar(20),
	"remarks" text,
	"created_at" timestamp DEFAULT now(),
	"updated_at" timestamp DEFAULT now()
);
--> statement-breakpoint
ALTER TABLE "vendor_additional_info" ADD CONSTRAINT "vendor_additional_info_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "vendor_business_contacts" ADD CONSTRAINT "vendor_business_contacts_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "vendor_regular_registrations" ADD CONSTRAINT "vendor_regular_registrations_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;