CREATE TABLE "vendor_business_groups" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"business_group_code" varchar(3) NOT NULL,
	"created_date" varchar(8),
	"created_time" varchar(6),
	"creator_id" varchar(13),
	"change_date" varchar(8),
	"change_time" varchar(6),
	"changer_id" varchar(13),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_internal_partners" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"vendor_name" varchar(120),
	"representative_name" varchar(30),
	"partner_type" varchar(1),
	"internal_partner_code" varchar(3),
	"internal_partner_workplace_1" varchar(1),
	"internal_partner_workplace_2" varchar(1),
	"internal_partner_workplace_3" varchar(1),
	"job_type_code" varchar(2),
	"job_type_code_2" varchar(2),
	"individual_corporate_type" varchar(2),
	"internal_foundation_yn" varchar(1),
	"dock_number" varchar(25),
	"company_input_date" varchar(8),
	"internal_withdrawal_date" varchar(8),
	"industrial_insurance_premium_rate" integer,
	"contract_performance_guarantee" integer,
	"wage_rate" integer,
	"corresponding_department_code_1" varchar(30),
	"corresponding_department_code_2" varchar(30),
	"corresponding_team_belonging" varchar(100),
	"internal_partner_item_1" varchar(120),
	"internal_partner_item_2" varchar(120),
	"office_location" varchar(240),
	"representative_company_career" varchar(300),
	"internal_withdrawal_reason" varchar(600),
	"telephone_number" varchar(30),
	"address_1" varchar(200),
	"address_2" varchar(200),
	"old_vendor_code" varchar(10),
	"tree_number" varchar(1),
	"created_date" varchar(8),
	"created_time" varchar(6),
	"created_user_id" varchar(13),
	"change_date" varchar(8),
	"change_time" varchar(6),
	"change_user_id" varchar(13),
	"upper_job_type" varchar(2),
	"supplier_business_place_code" varchar(4),
	"remark" varchar(4000),
	"withdrawal_plan_yn" varchar(1),
	"wage_delay_occurrence" varchar(8),
	"escrow_yn" varchar(1),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_partner_functions" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"purchase_org_code" varchar(4) NOT NULL,
	"vendor_sub_number" varchar(6) NOT NULL,
	"plant_code" varchar(4) NOT NULL,
	"partner_function" varchar(2) NOT NULL,
	"partner_counter" varchar(3) NOT NULL,
	"other_reference_vendor_code" varchar(10),
	"default_partner_indicator" varchar(1),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_purchase_organizations" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"purchase_org_code" varchar(4) NOT NULL,
	"purchase_order_currency" varchar(5),
	"payment_terms" varchar(4),
	"delivery_terms_1" varchar(3),
	"delivery_terms_2" varchar(90),
	"calculation_schema_group" varchar(2),
	"gr_based_invoice_verification" varchar(1),
	"automatic_purchase_order_indicator" varchar(1),
	"purchase_hold_indicator" varchar(1),
	"delete_indicator" varchar(1),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"order_confirmation_request_indicator" varchar(1),
	"sales_manager_name" varchar(120),
	"vendor_telephone_number" varchar(30),
	"confirmation_control_key" varchar(4),
	"purchase_hold_date" varchar(8),
	"purchase_hold_reason" varchar(120),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_representative_emails" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"address_number" varchar(10),
	"representative_sequence" varchar(3) NOT NULL,
	"valid_start_date" varchar(8) NOT NULL,
	"email_address" varchar(241),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_representative_faxes" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"address_number" varchar(10),
	"representative_sequence" varchar(3) NOT NULL,
	"valid_start_date" varchar(8) NOT NULL,
	"nation_code" varchar(3),
	"fax_number" varchar(30),
	"fax_extension_number" varchar(10),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_representative_telephones" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"address_number" varchar(10),
	"representative_sequence" varchar(3) NOT NULL,
	"valid_start_date" varchar(8) NOT NULL,
	"nation_code" varchar(3),
	"telephone_number" varchar(30),
	"extension_number" varchar(10),
	"mobile_indicator" varchar(1),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_representative_urls" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"address_number" varchar(10),
	"representative_sequence" varchar(3) NOT NULL,
	"valid_start_date" varchar(8) NOT NULL,
	"url" varchar(2048),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_tax_numbers" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"tax_number_category" varchar(4) NOT NULL,
	"business_partner_tax_number" varchar(20),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "vendor_withholding_tax" (
	"id" serial PRIMARY KEY NOT NULL,
	"vendor_id" integer NOT NULL,
	"company_code" varchar(4) NOT NULL,
	"withholding_tax_type" varchar(2) NOT NULL,
	"withholding_tax_related_indicator" varchar(1),
	"recipient_type" varchar(2),
	"withholding_tax_identification_number" varchar(16),
	"withholding_tax_code" varchar(2),
	"exemption_certificate_number" varchar(15),
	"exemption_rate" integer,
	"exemption_start_date" varchar(8),
	"exemption_end_date" varchar(8),
	"exemption_reason" varchar(200),
	"interface_date" varchar(8),
	"interface_time" varchar(6),
	"interface_status" varchar(1),
	"interface_message" varchar(100),
	"created_at" timestamp DEFAULT now() NOT NULL,
	"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "account_group" varchar(4);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "account_group_type" varchar(2);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "customer_code" varchar(10);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "posting_hold_indicator" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "purchase_hold_indicator" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "hold_reason" varchar(200);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "delete_indicator" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "company_id" varchar(6);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "business_type" varchar(90);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "industry_type" varchar(90);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "registration_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "registration_time" varchar(6);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "registrar_id" varchar(13);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "approval_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "approval_time" varchar(6);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "approver_id" varchar(13);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "change_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "change_time" varchar(6);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "changer_id" varchar(13);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "nation_code" varchar(3);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "representative_tel_number" varchar(30);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "representative_fax_number" varchar(31);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "business_registration_number" varchar(10);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "corporate_registration_number_oracle" varchar(18);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "tax_code_4" varchar(54);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "company_establishment_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_type" varchar(2);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "global_top_code" varchar(11);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "global_top_name" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "domestic_top_code" varchar(11);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "domestic_top_name" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "business_unit_code" varchar(11);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "business_unit_name" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "duns_number" varchar(11);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "interface_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "interface_time" varchar(6);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "interface_status" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "interface_message" varchar(100);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "title" varchar(45);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vat_registration_number" varchar(20);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "giro_vendor_indicator" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_1" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_2" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_3" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_4" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_abbreviation_1" varchar(60);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_name_abbreviation_2" varchar(60);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "potential_vendor_code" varchar(10);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "address_1" varchar(120);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "address_2" varchar(512);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "quality_manager_name" varchar(60);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "quality_manager_tel_number" varchar(30);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "quality_manager_email" varchar(241);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "sub_workplace_sequence" varchar(16);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "overlap_cause_code" varchar(2);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "document_type" varchar(3);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "document_number" varchar(25);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "partial_document" varchar(3);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "document_version" varchar(2);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "inbound_flag" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "delete_hold_indicator" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "purchase_hold_date" varchar(8);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "post_box" varchar(30);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "international_location_check_number" integer;--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "withholding_tax_gender_key" varchar(1);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_contract_manager_1" varchar(105);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "vendor_contract_manager_2" varchar(105);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "representative_resident_number" varchar(13);--> statement-breakpoint
ALTER TABLE "vendors" ADD COLUMN "company_volume" varchar(1);--> statement-breakpoint
ALTER TABLE "vendor_business_groups" ADD CONSTRAINT "vendor_business_groups_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_internal_partners" ADD CONSTRAINT "vendor_internal_partners_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_partner_functions" ADD CONSTRAINT "vendor_partner_functions_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_purchase_organizations" ADD CONSTRAINT "vendor_purchase_organizations_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_representative_emails" ADD CONSTRAINT "vendor_representative_emails_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_representative_faxes" ADD CONSTRAINT "vendor_representative_faxes_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_representative_telephones" ADD CONSTRAINT "vendor_representative_telephones_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_representative_urls" ADD CONSTRAINT "vendor_representative_urls_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_tax_numbers" ADD CONSTRAINT "vendor_tax_numbers_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_withholding_tax" ADD CONSTRAINT "vendor_withholding_tax_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;