summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/migrations/0067_remarkable_doctor_doom.sql23
-rw-r--r--db/migrations/0068_silly_black_knight.sql1
-rw-r--r--db/migrations/meta/0067_snapshot.json8968
-rw-r--r--db/migrations/meta/0068_snapshot.json8974
-rw-r--r--db/migrations/meta/_journal.json14
-rw-r--r--db/schema/index.ts1
-rw-r--r--db/schema/setting.ts78
-rw-r--r--db/schema/vendorDocu.ts3
-rw-r--r--db/seeds/po-rfq.ts352
9 files changed, 18414 insertions, 0 deletions
diff --git a/db/migrations/0067_remarkable_doctor_doom.sql b/db/migrations/0067_remarkable_doctor_doom.sql
new file mode 100644
index 00000000..dcc947f7
--- /dev/null
+++ b/db/migrations/0067_remarkable_doctor_doom.sql
@@ -0,0 +1,23 @@
+CREATE TABLE "preset_shares" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "preset_id" uuid NOT NULL,
+ "shared_with_user_id" text NOT NULL,
+ "permission" text DEFAULT 'read' NOT NULL,
+ "created_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "table_presets" (
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+ "user_id" text NOT NULL,
+ "table_id" text NOT NULL,
+ "name" text NOT NULL,
+ "settings" json NOT NULL,
+ "is_default" boolean DEFAULT false NOT NULL,
+ "is_active" boolean DEFAULT false NOT NULL,
+ "is_shared" boolean DEFAULT false NOT NULL,
+ "created_by" text,
+ "created_at" timestamp DEFAULT now() NOT NULL,
+ "updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "preset_shares" ADD CONSTRAINT "preset_shares_preset_id_table_presets_id_fk" FOREIGN KEY ("preset_id") REFERENCES "public"."table_presets"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file
diff --git a/db/migrations/0068_silly_black_knight.sql b/db/migrations/0068_silly_black_knight.sql
new file mode 100644
index 00000000..5c5f5b9c
--- /dev/null
+++ b/db/migrations/0068_silly_black_knight.sql
@@ -0,0 +1 @@
+ALTER TABLE "documents" ADD COLUMN "document_type" varchar(50) NOT NULL; \ No newline at end of file
diff --git a/db/migrations/meta/0067_snapshot.json b/db/migrations/meta/0067_snapshot.json
new file mode 100644
index 00000000..220aff76
--- /dev/null
+++ b/db/migrations/meta/0067_snapshot.json
@@ -0,0 +1,8968 @@
+{
+ "id": "d17c1d28-ce01-43bc-a087-bbcda7420556",
+ "prevId": "0742d31e-63a8-49b6-a489-95f44a860199",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.companies": {
+ "name": "companies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "companies_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "taxID": {
+ "name": "taxID",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_envelopes": {
+ "name": "contract_envelopes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_envelopes_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "envelope_id": {
+ "name": "envelope_id",
+ "type": "varchar(200)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "varchar(200)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "envelope_status": {
+ "name": "envelope_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contract_envelopes_contract_id_contracts_id_fk": {
+ "name": "contract_envelopes_contract_id_contracts_id_fk",
+ "tableFrom": "contract_envelopes",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_items": {
+ "name": "contract_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_items_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "unit_price": {
+ "name": "unit_price",
+ "type": "numeric(10, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_rate": {
+ "name": "tax_rate",
+ "type": "numeric(5, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_amount": {
+ "name": "tax_amount",
+ "type": "numeric(10, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_line_amount": {
+ "name": "total_line_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "contract_items_contract_item_idx": {
+ "name": "contract_items_contract_item_idx",
+ "columns": [
+ {
+ "expression": "contract_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "contract_items_contract_id_contracts_id_fk": {
+ "name": "contract_items_contract_id_contracts_id_fk",
+ "tableFrom": "contract_items",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contract_items_item_id_items_id_fk": {
+ "name": "contract_items_item_id_items_id_fk",
+ "tableFrom": "contract_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contract_items_contract_id_item_id_unique": {
+ "name": "contract_items_contract_id_item_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_id",
+ "item_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_signers": {
+ "name": "contract_signers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_signers_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "envelope_id": {
+ "name": "envelope_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_contact_id": {
+ "name": "vendor_contact_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signer_type": {
+ "name": "signer_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'VENDOR'"
+ },
+ "signer_email": {
+ "name": "signer_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signer_name": {
+ "name": "signer_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signer_position": {
+ "name": "signer_position",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signer_status": {
+ "name": "signer_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "signed_at": {
+ "name": "signed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contract_signers_envelope_id_contract_envelopes_id_fk": {
+ "name": "contract_signers_envelope_id_contract_envelopes_id_fk",
+ "tableFrom": "contract_signers",
+ "tableTo": "contract_envelopes",
+ "columnsFrom": [
+ "envelope_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contract_signers_vendor_contact_id_vendor_contacts_id_fk": {
+ "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk",
+ "tableFrom": "contract_signers",
+ "tableTo": "vendor_contacts",
+ "columnsFrom": [
+ "vendor_contact_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contracts": {
+ "name": "contracts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contracts_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_name": {
+ "name": "contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'KRW'"
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "partial_shipping_allowed": {
+ "name": "partial_shipping_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "partial_payment_allowed": {
+ "name": "partial_payment_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contracts_project_id_projects_id_fk": {
+ "name": "contracts_project_id_projects_id_fk",
+ "tableFrom": "contracts",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contracts_vendor_id_vendors_id_fk": {
+ "name": "contracts_vendor_id_vendors_id_fk",
+ "tableFrom": "contracts",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contracts_contract_no_unique": {
+ "name": "contracts_contract_no_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_no"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.poa": {
+ "name": "poa",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "poa_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_contract_no": {
+ "name": "original_contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_contract_name": {
+ "name": "original_contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_status": {
+ "name": "original_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "change_reason": {
+ "name": "change_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_status": {
+ "name": "approval_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "poa_original_contract_no_contracts_contract_no_fk": {
+ "name": "poa_original_contract_no_contracts_contract_no_fk",
+ "tableFrom": "poa",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "original_contract_no"
+ ],
+ "columnsTo": [
+ "contract_no"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "poa_project_id_projects_id_fk": {
+ "name": "poa_project_id_projects_id_fk",
+ "tableFrom": "poa",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "poa_vendor_id_vendors_id_fk": {
+ "name": "poa_vendor_id_vendors_id_fk",
+ "tableFrom": "poa",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.item_shipbuilding": {
+ "name": "item_shipbuilding",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "work_type": {
+ "name": "work_type",
+ "type": "work_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ship_types": {
+ "name": "ship_types",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'A-MAX'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_shipbuilding_item_id_items_id_fk": {
+ "name": "item_shipbuilding_item_id_items_id_fk",
+ "tableFrom": "item_shipbuilding",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.items": {
+ "name": "items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "items_item_code_unique": {
+ "name": "items_item_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "item_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pq_criterias": {
+ "name": "pq_criterias",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "check_point": {
+ "name": "check_point",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "group_name": {
+ "name": "group_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pq_criterias_extension": {
+ "name": "pq_criterias_extension",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pq_criteria_id": {
+ "name": "pq_criteria_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_info": {
+ "name": "contract_info",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "additional_requirement": {
+ "name": "additional_requirement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": {
+ "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk",
+ "tableFrom": "pq_criterias_extension",
+ "tableTo": "pq_criterias",
+ "columnsFrom": [
+ "pq_criteria_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "pq_criterias_extension_project_id_projects_id_fk": {
+ "name": "pq_criterias_extension_project_id_projects_id_fk",
+ "tableFrom": "pq_criterias_extension",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_criteria_attachments": {
+ "name": "vendor_criteria_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_criteria_answer_id": {
+ "name": "vendor_criteria_answer_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": {
+ "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk",
+ "tableFrom": "vendor_criteria_attachments",
+ "tableTo": "vendor_pq_criteria_answers",
+ "columnsFrom": [
+ "vendor_criteria_answer_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_pq_criteria_answers": {
+ "name": "vendor_pq_criteria_answers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "criteria_id": {
+ "name": "criteria_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "answer": {
+ "name": "answer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": {
+ "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": {
+ "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "pq_criterias",
+ "columnsFrom": [
+ "criteria_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_pq_criteria_answers_project_id_projects_id_fk": {
+ "name": "vendor_pq_criteria_answers_project_id_projects_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_pq_review_logs": {
+ "name": "vendor_pq_review_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_pq_criteria_answer_id": {
+ "name": "vendor_pq_criteria_answer_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviewer_comment": {
+ "name": "reviewer_comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviewer_name": {
+ "name": "reviewer_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": {
+ "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk",
+ "tableFrom": "vendor_pq_review_logs",
+ "tableTo": "vendor_pq_criteria_answers",
+ "columnsFrom": [
+ "vendor_pq_criteria_answer_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_project_pqs": {
+ "name": "vendor_project_pqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'REQUESTED'"
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejected_at": {
+ "name": "rejected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reject_reason": {
+ "name": "reject_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_project_pqs_vendor_id_vendors_id_fk": {
+ "name": "vendor_project_pqs_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_project_pqs",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_project_pqs_project_id_projects_id_fk": {
+ "name": "vendor_project_pqs_project_id_projects_id_fk",
+ "tableFrom": "vendor_project_pqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.bidding_projects": {
+ "name": "bidding_projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pspid": {
+ "name": "pspid",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proj_nm": {
+ "name": "proj_nm",
+ "type": "varchar(90)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sector": {
+ "name": "sector",
+ "type": "char(1)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proj_msrm": {
+ "name": "proj_msrm",
+ "type": "numeric(3, 0)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kunnr": {
+ "name": "kunnr",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kunnr_nm": {
+ "name": "kunnr_nm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cls_1": {
+ "name": "cls_1",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cls1_nm": {
+ "name": "cls1_nm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ptype": {
+ "name": "ptype",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ptype_nm": {
+ "name": "ptype_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_cd": {
+ "name": "pmodel_cd",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_nm": {
+ "name": "pmodel_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_sz": {
+ "name": "pmodel_sz",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_uom": {
+ "name": "pmodel_uom",
+ "type": "char(5)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "txt04": {
+ "name": "txt04",
+ "type": "char(4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "txt30": {
+ "name": "txt30",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estm_pm": {
+ "name": "estm_pm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "bidding_projects_pspid_unique": {
+ "name": "bidding_projects_pspid_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "pspid"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_series": {
+ "name": "project_series",
+ "schema": "",
+ "columns": {
+ "pspid": {
+ "name": "pspid",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sers_no": {
+ "name": "sers_no",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sc_dt": {
+ "name": "sc_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kl_dt": {
+ "name": "kl_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lc_dt": {
+ "name": "lc_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dl_dt": {
+ "name": "dl_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dock_no": {
+ "name": "dock_no",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dock_nm": {
+ "name": "dock_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proj_no": {
+ "name": "proj_no",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "post1": {
+ "name": "post1",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "project_sersNo_unique": {
+ "name": "project_sersNo_unique",
+ "columns": [
+ {
+ "expression": "pspid",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sers_no",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_series_pspid_bidding_projects_pspid_fk": {
+ "name": "project_series_pspid_bidding_projects_pspid_fk",
+ "tableFrom": "project_series",
+ "tableTo": "bidding_projects",
+ "columnsFrom": [
+ "pspid"
+ ],
+ "columnsTo": [
+ "pspid"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.projects": {
+ "name": "projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ship'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cbe_evaluations": {
+ "name": "cbe_evaluations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluated_by": {
+ "name": "evaluated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "evaluated_at": {
+ "name": "evaluated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "result": {
+ "name": "result",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost": {
+ "name": "total_cost",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms": {
+ "name": "incoterms",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_schedule": {
+ "name": "delivery_schedule",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "cbe_evaluations_rfq_id_rfqs_id_fk": {
+ "name": "cbe_evaluations_rfq_id_rfqs_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cbe_evaluations_vendor_id_vendors_id_fk": {
+ "name": "cbe_evaluations_vendor_id_vendors_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cbe_evaluations_evaluated_by_users_id_fk": {
+ "name": "cbe_evaluations_evaluated_by_users_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "evaluated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_attachments": {
+ "name": "rfq_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluation_id": {
+ "name": "evaluation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cbe_id": {
+ "name": "cbe_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_attachments_rfq_id_rfqs_id_fk": {
+ "name": "rfq_attachments_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_vendor_id_vendors_id_fk": {
+ "name": "rfq_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": {
+ "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfq_evaluations",
+ "columnsFrom": [
+ "evaluation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_cbe_id_cbe_evaluations_id_fk": {
+ "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "cbe_evaluations",
+ "columnsFrom": [
+ "cbe_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_comment_id_rfq_comments_id_fk": {
+ "name": "rfq_attachments_comment_id_rfq_comments_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfq_comments",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_comments": {
+ "name": "rfq_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment_text": {
+ "name": "comment_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "commented_by": {
+ "name": "commented_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluation_id": {
+ "name": "evaluation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cbe_id": {
+ "name": "cbe_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_comments_rfq_id_rfqs_id_fk": {
+ "name": "rfq_comments_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_vendor_id_vendors_id_fk": {
+ "name": "rfq_comments_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_commented_by_users_id_fk": {
+ "name": "rfq_comments_commented_by_users_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "commented_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_evaluation_id_rfq_evaluations_id_fk": {
+ "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "rfq_evaluations",
+ "columnsFrom": [
+ "evaluation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_cbe_id_vendor_responses_id_fk": {
+ "name": "rfq_comments_cbe_id_vendor_responses_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "cbe_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_evaluations": {
+ "name": "rfq_evaluations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "eval_type": {
+ "name": "eval_type",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result": {
+ "name": "result",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_evaluations_rfq_id_rfqs_id_fk": {
+ "name": "rfq_evaluations_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_evaluations",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_evaluations_vendor_id_vendors_id_fk": {
+ "name": "rfq_evaluations_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_evaluations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_items": {
+ "name": "rfq_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_items_rfq_id_rfqs_id_fk": {
+ "name": "rfq_items_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_items",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "rfq_items_item_code_items_item_code_fk": {
+ "name": "rfq_items_item_code_items_item_code_fk",
+ "tableFrom": "rfq_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_code"
+ ],
+ "columnsTo": [
+ "item_code"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfqs": {
+ "name": "rfqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bid_project_id": {
+ "name": "bid_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'DRAFT'"
+ },
+ "rfq_type": {
+ "name": "rfq_type",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PURCHASE'"
+ },
+ "parent_rfq_id": {
+ "name": "parent_rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfqs_project_id_projects_id_fk": {
+ "name": "rfqs_project_id_projects_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_bid_project_id_bidding_projects_id_fk": {
+ "name": "rfqs_bid_project_id_bidding_projects_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "bidding_projects",
+ "columnsFrom": [
+ "bid_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_created_by_users_id_fk": {
+ "name": "rfqs_created_by_users_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_parent_rfq_id_rfqs_id_fk": {
+ "name": "rfqs_parent_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "parent_rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "rfqs_rfq_code_unique": {
+ "name": "rfqs_rfq_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "rfq_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_commercial_responses": {
+ "name": "vendor_commercial_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms": {
+ "name": "incoterms",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_period": {
+ "name": "delivery_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "warranty_period": {
+ "name": "warranty_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "validity_period": {
+ "name": "validity_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "price_breakdown": {
+ "name": "price_breakdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commercial_notes": {
+ "name": "commercial_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_commercial_responses_response_id_vendor_responses_id_fk": {
+ "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_commercial_responses",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_response_attachments": {
+ "name": "vendor_response_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "technical_response_id": {
+ "name": "technical_response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commercial_response_id": {
+ "name": "commercial_response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_response_attachments_response_id_vendor_responses_id_fk": {
+ "name": "vendor_response_attachments_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": {
+ "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_technical_responses",
+ "columnsFrom": [
+ "technical_response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": {
+ "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_commercial_responses",
+ "columnsFrom": [
+ "commercial_response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_responses": {
+ "name": "vendor_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'REVIEWING'"
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responded_by": {
+ "name": "responded_by",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "vendor_response_unique": {
+ "name": "vendor_response_unique",
+ "columns": [
+ {
+ "expression": "rfq_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "vendor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "vendor_responses_rfq_id_rfqs_id_fk": {
+ "name": "vendor_responses_rfq_id_rfqs_id_fk",
+ "tableFrom": "vendor_responses",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_responses_vendor_id_vendors_id_fk": {
+ "name": "vendor_responses_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_responses",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_technical_responses": {
+ "name": "vendor_technical_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_technical_responses_response_id_vendor_responses_id_fk": {
+ "name": "vendor_technical_responses_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_technical_responses",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.otps": {
+ "name": "otps",
+ "schema": "",
+ "columns": {
+ "email": {
+ "name": "email",
+ "type": "varchar(256)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(6)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "otpToken": {
+ "name": "otpToken",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "otp_expires": {
+ "name": "otp_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permissions": {
+ "name": "permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "permissions_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "permission_key": {
+ "name": "permission_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.role_permissions": {
+ "name": "role_permissions",
+ "schema": "",
+ "columns": {
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_id": {
+ "name": "permission_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "role_permissions_role_id_roles_id_fk": {
+ "name": "role_permissions_role_id_roles_id_fk",
+ "tableFrom": "role_permissions",
+ "tableTo": "roles",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "role_permissions_permission_id_permissions_id_fk": {
+ "name": "role_permissions_permission_id_permissions_id_fk",
+ "tableFrom": "role_permissions",
+ "tableTo": "permissions",
+ "columnsFrom": [
+ "permission_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.roles": {
+ "name": "roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "roles_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "user_domain",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "roles_company_id_vendors_id_fk": {
+ "name": "roles_company_id_vendors_id_fk",
+ "tableFrom": "roles",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_roles": {
+ "name": "user_roles",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_roles_user_id_users_id_fk": {
+ "name": "user_roles_user_id_users_id_fk",
+ "tableFrom": "user_roles",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_roles_role_id_roles_id_fk": {
+ "name": "user_roles_role_id_roles_id_fk",
+ "tableFrom": "user_roles",
+ "tableTo": "roles",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.users": {
+ "name": "users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "users_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "user_domain",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'partners'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "image_url": {
+ "name": "image_url",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "language": {
+ "name": "language",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'en'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "users_company_id_vendors_id_fk": {
+ "name": "users_company_id_vendors_id_fk",
+ "tableFrom": "users",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "users_email_unique": {
+ "name": "users_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.form_entries": {
+ "name": "form_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "form_entries_contract_item_id_contract_items_id_fk": {
+ "name": "form_entries_contract_item_id_contract_items_id_fk",
+ "tableFrom": "form_entries",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.form_metas": {
+ "name": "form_metas",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "columns": {
+ "name": "columns",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "form_metas_project_id_projects_id_fk": {
+ "name": "form_metas_project_id_projects_id_fk",
+ "tableFrom": "form_metas",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "form_code_project_unique": {
+ "name": "form_code_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "form_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.forms": {
+ "name": "forms",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "forms_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "eng": {
+ "name": "eng",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "im": {
+ "name": "im",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "contract_item_form_code_unique": {
+ "name": "contract_item_form_code_unique",
+ "columns": [
+ {
+ "expression": "contract_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "form_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "forms_contract_item_id_contract_items_id_fk": {
+ "name": "forms_contract_item_id_contract_items_id_fk",
+ "tableFrom": "forms",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_classes": {
+ "name": "tag_classes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "tag_classes_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_classes_project_id_projects_id_fk": {
+ "name": "tag_classes_project_id_projects_id_fk",
+ "tableFrom": "tag_classes",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": {
+ "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk",
+ "tableFrom": "tag_classes",
+ "tableTo": "tag_types",
+ "columnsFrom": [
+ "tag_type_code",
+ "project_id"
+ ],
+ "columnsTo": [
+ "code",
+ "project_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_code_in_project": {
+ "name": "uniq_code_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_subfield_options": {
+ "name": "tag_subfield_options",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_subfield_options_project_id_projects_id_fk": {
+ "name": "tag_subfield_options_project_id_projects_id_fk",
+ "tableFrom": "tag_subfield_options",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_attribute_project_code": {
+ "name": "uniq_attribute_project_code",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "attributes_id",
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_subfields": {
+ "name": "tag_subfields",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_description": {
+ "name": "attributes_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expression": {
+ "name": "expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delimiter": {
+ "name": "delimiter",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_subfields_project_id_projects_id_fk": {
+ "name": "tag_subfields_project_id_projects_id_fk",
+ "tableFrom": "tag_subfields",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_tag_type_attribute": {
+ "name": "uniq_tag_type_attribute",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "tag_type_code",
+ "attributes_id"
+ ]
+ },
+ "uniq_attribute_id_project": {
+ "name": "uniq_attribute_id_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "attributes_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_type_class_form_mappings": {
+ "name": "tag_type_class_form_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_label": {
+ "name": "tag_type_label",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "class_label": {
+ "name": "class_label",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ep": {
+ "name": "ep",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_mapping_in_project": {
+ "name": "uniq_mapping_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "tag_type_label",
+ "class_label",
+ "form_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_types": {
+ "name": "tag_types",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_types_project_id_projects_id_fk": {
+ "name": "tag_types_project_id_projects_id_fk",
+ "tableFrom": "tag_types",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "tag_types_code_project_id_pk": {
+ "name": "tag_types_code_project_id_pk",
+ "columns": [
+ "code",
+ "project_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tags": {
+ "name": "tags",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "tags_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_id": {
+ "name": "form_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag_no": {
+ "name": "tag_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type": {
+ "name": "tag_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "class": {
+ "name": "class",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tags_contract_item_id_contract_items_id_fk": {
+ "name": "tags_contract_item_id_contract_items_id_fk",
+ "tableFrom": "tags",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "tags_form_id_forms_id_fk": {
+ "name": "tags_form_id_forms_id_fk",
+ "tableFrom": "tags",
+ "tableTo": "forms",
+ "columnsFrom": [
+ "form_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contract_item_tag_no_unique": {
+ "name": "contract_item_tag_no_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_item_id",
+ "tag_no"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_data_report_temps": {
+ "name": "vendor_data_report_temps",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_id": {
+ "name": "form_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_data_report_temps_contract_item_id_contract_items_id_fk": {
+ "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk",
+ "tableFrom": "vendor_data_report_temps",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_data_report_temps_form_id_forms_id_fk": {
+ "name": "vendor_data_report_temps_form_id_forms_id_fk",
+ "tableFrom": "vendor_data_report_temps",
+ "tableTo": "forms",
+ "columnsFrom": [
+ "form_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_attachments": {
+ "name": "document_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "document_attachments_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "revision_id": {
+ "name": "revision_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_attachments_revision_id_revisions_id_fk": {
+ "name": "document_attachments_revision_id_revisions_id_fk",
+ "tableFrom": "document_attachments",
+ "tableTo": "revisions",
+ "columnsFrom": [
+ "revision_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.documents": {
+ "name": "documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "documents_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_contract_doc_status": {
+ "name": "unique_contract_doc_status",
+ "columns": [
+ {
+ "expression": "contract_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "doc_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "documents_contract_id_contracts_id_fk": {
+ "name": "documents_contract_id_contracts_id_fk",
+ "tableFrom": "documents",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_stages": {
+ "name": "issue_stages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "issue_stages_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_name": {
+ "name": "stage_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan_date": {
+ "name": "plan_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actual_date": {
+ "name": "actual_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_document_stage": {
+ "name": "unique_document_stage",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stage_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_stages_document_id_documents_id_fk": {
+ "name": "issue_stages_document_id_documents_id_fk",
+ "tableFrom": "issue_stages",
+ "tableTo": "documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revisions": {
+ "name": "revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "revisions_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "issue_stage_id": {
+ "name": "issue_stage_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploader_type": {
+ "name": "uploader_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'vendor'"
+ },
+ "uploader_id": {
+ "name": "uploader_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploader_name": {
+ "name": "uploader_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_date": {
+ "name": "approved_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_stage_rev": {
+ "name": "unique_stage_rev",
+ "columns": [
+ {
+ "expression": "issue_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_attachments": {
+ "name": "vendor_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'GENERAL'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_attachments_vendor_id_vendors_id_fk": {
+ "name": "vendor_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_candidates": {
+ "name": "vendor_candidates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_name": {
+ "name": "company_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'COLLECTED'"
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_candidates_vendor_id_vendors_id_fk": {
+ "name": "vendor_candidates_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_candidates",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_contacts": {
+ "name": "vendor_contacts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_name": {
+ "name": "contact_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_position": {
+ "name": "contact_position",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_primary": {
+ "name": "is_primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_contacts_vendor_id_vendors_id_fk": {
+ "name": "vendor_contacts_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_contacts",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_investigation_attachments": {
+ "name": "vendor_investigation_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "investigation_id": {
+ "name": "investigation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'REPORT'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": {
+ "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk",
+ "tableFrom": "vendor_investigation_attachments",
+ "tableTo": "vendor_investigations",
+ "columnsFrom": [
+ "investigation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_investigations": {
+ "name": "vendor_investigations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "investigation_status": {
+ "name": "investigation_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PLANNED'"
+ },
+ "scheduled_start_at": {
+ "name": "scheduled_start_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_end_at": {
+ "name": "scheduled_end_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "investigation_notes": {
+ "name": "investigation_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_investigations_vendor_id_vendors_id_fk": {
+ "name": "vendor_investigations_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_investigations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_possible_items": {
+ "name": "vendor_possible_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_possible_items_vendor_id_vendors_id_fk": {
+ "name": "vendor_possible_items_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_possible_items",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "vendor_possible_items_item_code_items_item_code_fk": {
+ "name": "vendor_possible_items_item_code_items_item_code_fk",
+ "tableFrom": "vendor_possible_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_code"
+ ],
+ "columnsTo": [
+ "item_code"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_types": {
+ "name": "vendor_types",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "vendor_types_code_unique": {
+ "name": "vendor_types_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendors": {
+ "name": "vendors",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "vendor_type_id": {
+ "name": "vendor_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "business_size": {
+ "name": "business_size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendors_vendor_type_id_vendor_types_id_fk": {
+ "name": "vendors_vendor_type_id_vendor_types_id_fk",
+ "tableFrom": "vendors",
+ "tableTo": "vendor_types",
+ "columnsFrom": [
+ "vendor_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tasks": {
+ "name": "tasks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(30)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'todo'"
+ },
+ "label": {
+ "name": "label",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'bug'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'low'"
+ },
+ "archived": {
+ "name": "archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "current_timestamp"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "tasks_code_unique": {
+ "name": "tasks_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_candidate_logs": {
+ "name": "vendor_candidate_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_candidate_id": {
+ "name": "vendor_candidate_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "old_status": {
+ "name": "old_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_status": {
+ "name": "new_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": {
+ "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk",
+ "tableFrom": "vendor_candidate_logs",
+ "tableTo": "vendor_candidates",
+ "columnsFrom": [
+ "vendor_candidate_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_candidate_logs_user_id_users_id_fk": {
+ "name": "vendor_candidate_logs_user_id_users_id_fk",
+ "tableFrom": "vendor_candidate_logs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendors_logs": {
+ "name": "vendors_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "old_status": {
+ "name": "old_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_status": {
+ "name": "new_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendors_logs_vendor_id_vendors_id_fk": {
+ "name": "vendors_logs_vendor_id_vendors_id_fk",
+ "tableFrom": "vendors_logs",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendors_logs_user_id_users_id_fk": {
+ "name": "vendors_logs_user_id_users_id_fk",
+ "tableFrom": "vendors_logs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.basic_contract": {
+ "name": "basic_contract",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "basic_contract_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by": {
+ "name": "requested_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "basic_contract_template_id_basic_contract_templates_id_fk": {
+ "name": "basic_contract_template_id_basic_contract_templates_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "basic_contract_templates",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "basic_contract_vendor_id_vendors_id_fk": {
+ "name": "basic_contract_vendor_id_vendors_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "basic_contract_requested_by_users_id_fk": {
+ "name": "basic_contract_requested_by_users_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "users",
+ "columnsFrom": [
+ "requested_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.basic_contract_templates": {
+ "name": "basic_contract_templates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "basic_contract_templates_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "template_name": {
+ "name": "template_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "validity_period": {
+ "name": "validity_period",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.incoterms": {
+ "name": "incoterms",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(20)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "incoterms_created_by_users_id_fk": {
+ "name": "incoterms_created_by_users_id_fk",
+ "tableFrom": "incoterms",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.payment_terms": {
+ "name": "payment_terms",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "payment_terms_created_by_users_id_fk": {
+ "name": "payment_terms_created_by_users_id_fk",
+ "tableFrom": "payment_terms",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_items": {
+ "name": "pr_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_item": {
+ "name": "rfq_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_item": {
+ "name": "pr_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_no": {
+ "name": "pr_no",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_category": {
+ "name": "material_category",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acc": {
+ "name": "acc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "size": {
+ "name": "size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gross_weight": {
+ "name": "gross_weight",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "gw_uom": {
+ "name": "gw_uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_no": {
+ "name": "spec_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_url": {
+ "name": "spec_url",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracking_no": {
+ "name": "tracking_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "major_yn": {
+ "name": "major_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "project_def": {
+ "name": "project_def",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_sc": {
+ "name": "project_sc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_kl": {
+ "name": "project_kl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_lc": {
+ "name": "project_lc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_dl": {
+ "name": "project_dl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "pr_items",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "pr_items_item_id_items_id_fk": {
+ "name": "pr_items_item_id_items_id_fk",
+ "tableFrom": "pr_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_attachments": {
+ "name": "procurement_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "procurement_rfq_details_id": {
+ "name": "procurement_rfq_details_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_file_name": {
+ "name": "original_file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": {
+ "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "procurement_rfq_details",
+ "columnsFrom": [
+ "procurement_rfq_details_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_attachments_created_by_users_id_fk": {
+ "name": "procurement_attachments_created_by_users_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "attachment_type_check": {
+ "name": "attachment_type_check",
+ "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.procurement_quotation_items": {
+ "name": "procurement_quotation_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "quotation_id": {
+ "name": "quotation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_item_id": {
+ "name": "pr_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unit_price": {
+ "name": "unit_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "vendor_material_code": {
+ "name": "vendor_material_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_material_description": {
+ "name": "vendor_material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lead_time_in_days": {
+ "name": "lead_time_in_days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_rate": {
+ "name": "tax_rate",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_amount": {
+ "name": "tax_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount_rate": {
+ "name": "discount_rate",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount_amount": {
+ "name": "discount_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_alternative": {
+ "name": "is_alternative",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "is_recommended": {
+ "name": "is_recommended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": {
+ "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk",
+ "tableFrom": "procurement_quotation_items",
+ "tableTo": "procurement_vendor_quotations",
+ "columnsFrom": [
+ "quotation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_quotation_items_pr_item_id_pr_items_id_fk": {
+ "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk",
+ "tableFrom": "procurement_quotation_items",
+ "tableTo": "pr_items",
+ "columnsFrom": [
+ "pr_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_attachments": {
+ "name": "procurement_rfq_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quotation_id": {
+ "name": "quotation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_vendor_upload": {
+ "name": "is_vendor_upload",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": {
+ "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_rfq_comments",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": {
+ "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_vendor_quotations",
+ "columnsFrom": [
+ "quotation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_uploaded_by_users_id_fk": {
+ "name": "procurement_rfq_attachments_uploaded_by_users_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "uploaded_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_vendor_id_vendors_id_fk": {
+ "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_comments": {
+ "name": "procurement_rfq_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_vendor_comment": {
+ "name": "is_vendor_comment",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "parent_comment_id": {
+ "name": "parent_comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_vendor_id_vendors_id_fk": {
+ "name": "procurement_rfq_comments_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_user_id_users_id_fk": {
+ "name": "procurement_rfq_comments_user_id_users_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": {
+ "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "procurement_rfq_comments",
+ "columnsFrom": [
+ "parent_comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_details": {
+ "name": "procurement_rfq_details",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendors_id": {
+ "name": "vendors_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms_code": {
+ "name": "payment_terms_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_code": {
+ "name": "incoterms_code",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_detail": {
+ "name": "incoterms_detail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tax_code": {
+ "name": "tax_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'VV'"
+ },
+ "place_of_shipping": {
+ "name": "place_of_shipping",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "place_of_destination": {
+ "name": "place_of_destination",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_reason": {
+ "name": "cancel_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "material_price_related_yn": {
+ "name": "material_price_related_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_vendors_id_vendors_id_fk": {
+ "name": "procurement_rfq_details_vendors_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendors_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": {
+ "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "payment_terms",
+ "columnsFrom": [
+ "payment_terms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_incoterms_code_incoterms_code_fk": {
+ "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "incoterms",
+ "columnsFrom": [
+ "incoterms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_updated_by_users_id_fk": {
+ "name": "procurement_rfq_details_updated_by_users_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "users",
+ "columnsFrom": [
+ "updated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfqs": {
+ "name": "procurement_rfqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "series": {
+ "name": "series",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rfq_send_date": {
+ "name": "rfq_send_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'RFQ Created'"
+ },
+ "rfq_sealed_yn": {
+ "name": "rfq_sealed_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "pic_code": {
+ "name": "pic_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_by": {
+ "name": "sent_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfqs_project_id_projects_id_fk": {
+ "name": "procurement_rfqs_project_id_projects_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_item_id_items_id_fk": {
+ "name": "procurement_rfqs_item_id_items_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_sent_by_users_id_fk": {
+ "name": "procurement_rfqs_sent_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "sent_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_created_by_users_id_fk": {
+ "name": "procurement_rfqs_created_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_updated_by_users_id_fk": {
+ "name": "procurement_rfqs_updated_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "updated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "procurement_rfqs_rfq_code_unique": {
+ "name": "procurement_rfqs_rfq_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "rfq_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_vendor_quotations": {
+ "name": "procurement_vendor_quotations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quotation_code": {
+ "name": "quotation_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quotation_version": {
+ "name": "quotation_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "total_items_count": {
+ "name": "total_items_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "sub_total": {
+ "name": "sub_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "tax_total": {
+ "name": "tax_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "discount_total": {
+ "name": "discount_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "valid_until": {
+ "name": "valid_until",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimated_delivery_date": {
+ "name": "estimated_delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_terms_code": {
+ "name": "payment_terms_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_code": {
+ "name": "incoterms_code",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_detail": {
+ "name": "incoterms_detail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'Draft'"
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejection_reason": {
+ "name": "rejection_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_vendor_id_vendors_id_fk": {
+ "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": {
+ "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "payment_terms",
+ "columnsFrom": [
+ "payment_terms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": {
+ "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "incoterms",
+ "columnsFrom": [
+ "incoterms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.preset_shares": {
+ "name": "preset_shares",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "preset_id": {
+ "name": "preset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "shared_with_user_id": {
+ "name": "shared_with_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'read'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "preset_shares_preset_id_table_presets_id_fk": {
+ "name": "preset_shares_preset_id_table_presets_id_fk",
+ "tableFrom": "preset_shares",
+ "tableTo": "table_presets",
+ "columnsFrom": [
+ "preset_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.table_presets": {
+ "name": "table_presets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "settings": {
+ "name": "settings",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_shared": {
+ "name": "is_shared",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.work_type": {
+ "name": "work_type",
+ "schema": "public",
+ "values": [
+ "기장",
+ "전장",
+ "선실",
+ "배관",
+ "철의"
+ ]
+ },
+ "public.user_domain": {
+ "name": "user_domain",
+ "schema": "public",
+ "values": [
+ "evcp",
+ "partners"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {
+ "public.contracts_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contracts_detail_view_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_name": {
+ "name": "contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'KRW'"
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "partial_shipping_allowed": {
+ "name": "partial_shipping_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "partial_payment_allowed": {
+ "name": "partial_payment_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "contracts_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.poa_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "poa_detail_view_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "change_reason": {
+ "name": "change_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_status": {
+ "name": "approval_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"",
+ "name": "poa_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.project_approved_vendors": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ship'"
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_project_pqs\".\"submitted_at\", \"vendor_project_pqs\".\"approved_at\" from \"vendors\" inner join \"vendor_project_pqs\" on \"vendor_project_pqs\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_project_pqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_project_pqs\".\"status\" = 'APPROVED'",
+ "name": "project_approved_vendors",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.cbe_view": {
+ "columns": {},
+ "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"",
+ "name": "cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.rfqs_view": {
+ "columns": {},
+ "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"",
+ "name": "rfqs_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_cbe_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")",
+ "name": "vendor_cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_response_cbe_view": {
+ "columns": {},
+ "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"",
+ "name": "vendor_response_cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_responses_view": {
+ "columns": {},
+ "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")",
+ "name": "vendor_responses_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_rfq_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"",
+ "name": "vendor_rfq_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_tbe_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")",
+ "name": "vendor_tbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.role_view": {
+ "columns": {},
+ "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"",
+ "name": "role_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.user_view": {
+ "columns": {},
+ "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"",
+ "name": "user_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.view_tag_subfields": {
+ "columns": {
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_description": {
+ "name": "attributes_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expression": {
+ "name": "expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delimiter": {
+ "name": "delimiter",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"tag_subfields\".\"id\" as \"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\" as \"project_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\"",
+ "name": "view_tag_subfields",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.document_stages_view": {
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_count": {
+ "name": "stage_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_list": {
+ "name": "stage_list",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n\n (\n SELECT COUNT(*)\n FROM issue_stages\n WHERE document_id = d.id\n ) AS stage_count,\n\n COALESCE( \n (\n SELECT json_agg(i.stage_name)\n FROM issue_stages i\n WHERE i.document_id = d.id\n ), \n '[]'\n ) AS stage_list,\n\n d.created_at,\n d.updated_at\n FROM documents d\n",
+ "name": "document_stages_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_documents_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "latest_stage_id": {
+ "name": "latest_stage_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_name": {
+ "name": "latest_stage_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_plan_date": {
+ "name": "latest_stage_plan_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_actual_date": {
+ "name": "latest_stage_actual_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_id": {
+ "name": "latest_revision_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision": {
+ "name": "latest_revision",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_uploader_type": {
+ "name": "latest_revision_uploader_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_uploader_name": {
+ "name": "latest_revision_uploader_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_count": {
+ "name": "attachment_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n \n d.contract_id,\n \n (\n SELECT id FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_id,\n (\n SELECT stage_name FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_name,\n (\n SELECT plan_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_plan_date,\n (\n SELECT actual_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_actual_date,\n \n (\n SELECT r.id FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_id,\n (\n SELECT r.revision FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision,\n (\n SELECT r.uploader_type FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_type,\n (\n SELECT r.uploader_name FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_name,\n \n (\n SELECT COUNT(*) FROM document_attachments a\n JOIN revisions r ON a.revision_id = r.id\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ",
+ "name": "vendor_documents_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_candidates_with_vendor_info": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_name": {
+ "name": "company_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'COLLECTED'"
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "vendor_candidates_with_vendor_info",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"",
+ "name": "vendor_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_investigations_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "investigation_status": {
+ "name": "investigation_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PLANNED'"
+ },
+ "scheduled_start_at": {
+ "name": "scheduled_start_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_end_at": {
+ "name": "scheduled_end_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "investigation_notes": {
+ "name": "investigation_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "vendor_investigations_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_items_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"",
+ "name": "vendor_items_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendors_with_types": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "vendor_type_id": {
+ "name": "vendor_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"address\", \"vendors\".\"country\", \"vendors\".\"phone\", \"vendors\".\"email\", \"vendors\".\"website\", \"vendors\".\"status\", \"vendors\".\"vendor_type_id\", \"vendors\".\"representative_name\", \"vendors\".\"representative_birth\", \"vendors\".\"representative_email\", \"vendors\".\"representative_phone\", \"vendors\".\"corporate_registration_number\", \"vendors\".\"items\", \"vendors\".\"credit_agency\", \"vendors\".\"credit_rating\", \"vendors\".\"cash_flow_rating\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"vendor_types\".\"code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"",
+ "name": "vendors_with_types",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.basic_contract_view": {
+ "columns": {},
+ "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"",
+ "name": "basic_contract_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.pr_items_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_item": {
+ "name": "rfq_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_item": {
+ "name": "pr_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_no": {
+ "name": "pr_no",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_category": {
+ "name": "material_category",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acc": {
+ "name": "acc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "size": {
+ "name": "size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gross_weight": {
+ "name": "gross_weight",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "gw_uom": {
+ "name": "gw_uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_no": {
+ "name": "spec_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_url": {
+ "name": "spec_url",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracking_no": {
+ "name": "tracking_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "major_yn": {
+ "name": "major_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "project_def": {
+ "name": "project_def",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_sc": {
+ "name": "project_sc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_kl": {
+ "name": "project_kl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_lc": {
+ "name": "project_lc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_dl": {
+ "name": "project_dl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"item_id\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"items\".\"item_code\", \"items\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\" left join \"items\" on \"pr_items\".\"item_id\" = \"items\".\"id\"",
+ "name": "pr_items_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.procurement_rfq_details_view": {
+ "columns": {},
+ "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"items\".\"item_code\" as \"item_code\", \"items\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"items\" on \"rfqs\".\"item_id\" = \"items\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"",
+ "name": "procurement_rfq_details_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.procurement_rfqs_view": {
+ "columns": {},
+ "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"items\".\"item_code\" as \"item_code\", \"items\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"items\" on \"procurement_rfqs\".\"item_id\" = \"items\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"",
+ "name": "procurement_rfqs_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ }
+ },
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+} \ No newline at end of file
diff --git a/db/migrations/meta/0068_snapshot.json b/db/migrations/meta/0068_snapshot.json
new file mode 100644
index 00000000..0090c73e
--- /dev/null
+++ b/db/migrations/meta/0068_snapshot.json
@@ -0,0 +1,8974 @@
+{
+ "id": "7869e5d4-1b5c-480a-af0a-efc70e6c32f6",
+ "prevId": "d17c1d28-ce01-43bc-a087-bbcda7420556",
+ "version": "7",
+ "dialect": "postgresql",
+ "tables": {
+ "public.companies": {
+ "name": "companies",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "companies_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "taxID": {
+ "name": "taxID",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_envelopes": {
+ "name": "contract_envelopes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_envelopes_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "envelope_id": {
+ "name": "envelope_id",
+ "type": "varchar(200)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "varchar(200)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "envelope_status": {
+ "name": "envelope_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contract_envelopes_contract_id_contracts_id_fk": {
+ "name": "contract_envelopes_contract_id_contracts_id_fk",
+ "tableFrom": "contract_envelopes",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_items": {
+ "name": "contract_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_items_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 1
+ },
+ "unit_price": {
+ "name": "unit_price",
+ "type": "numeric(10, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_rate": {
+ "name": "tax_rate",
+ "type": "numeric(5, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_amount": {
+ "name": "tax_amount",
+ "type": "numeric(10, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_line_amount": {
+ "name": "total_line_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "contract_items_contract_item_idx": {
+ "name": "contract_items_contract_item_idx",
+ "columns": [
+ {
+ "expression": "contract_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "contract_items_contract_id_contracts_id_fk": {
+ "name": "contract_items_contract_id_contracts_id_fk",
+ "tableFrom": "contract_items",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contract_items_item_id_items_id_fk": {
+ "name": "contract_items_item_id_items_id_fk",
+ "tableFrom": "contract_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contract_items_contract_id_item_id_unique": {
+ "name": "contract_items_contract_id_item_id_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_id",
+ "item_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contract_signers": {
+ "name": "contract_signers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contract_signers_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "envelope_id": {
+ "name": "envelope_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_contact_id": {
+ "name": "vendor_contact_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signer_type": {
+ "name": "signer_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'VENDOR'"
+ },
+ "signer_email": {
+ "name": "signer_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signer_name": {
+ "name": "signer_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "signer_position": {
+ "name": "signer_position",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "signer_status": {
+ "name": "signer_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "signed_at": {
+ "name": "signed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contract_signers_envelope_id_contract_envelopes_id_fk": {
+ "name": "contract_signers_envelope_id_contract_envelopes_id_fk",
+ "tableFrom": "contract_signers",
+ "tableTo": "contract_envelopes",
+ "columnsFrom": [
+ "envelope_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contract_signers_vendor_contact_id_vendor_contacts_id_fk": {
+ "name": "contract_signers_vendor_contact_id_vendor_contacts_id_fk",
+ "tableFrom": "contract_signers",
+ "tableTo": "vendor_contacts",
+ "columnsFrom": [
+ "vendor_contact_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.contracts": {
+ "name": "contracts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contracts_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_name": {
+ "name": "contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'KRW'"
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "partial_shipping_allowed": {
+ "name": "partial_shipping_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "partial_payment_allowed": {
+ "name": "partial_payment_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "contracts_project_id_projects_id_fk": {
+ "name": "contracts_project_id_projects_id_fk",
+ "tableFrom": "contracts",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "contracts_vendor_id_vendors_id_fk": {
+ "name": "contracts_vendor_id_vendors_id_fk",
+ "tableFrom": "contracts",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contracts_contract_no_unique": {
+ "name": "contracts_contract_no_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_no"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.poa": {
+ "name": "poa",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "poa_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_contract_no": {
+ "name": "original_contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_contract_name": {
+ "name": "original_contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_status": {
+ "name": "original_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "change_reason": {
+ "name": "change_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_status": {
+ "name": "approval_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "poa_original_contract_no_contracts_contract_no_fk": {
+ "name": "poa_original_contract_no_contracts_contract_no_fk",
+ "tableFrom": "poa",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "original_contract_no"
+ ],
+ "columnsTo": [
+ "contract_no"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "poa_project_id_projects_id_fk": {
+ "name": "poa_project_id_projects_id_fk",
+ "tableFrom": "poa",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "poa_vendor_id_vendors_id_fk": {
+ "name": "poa_vendor_id_vendors_id_fk",
+ "tableFrom": "poa",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.item_shipbuilding": {
+ "name": "item_shipbuilding",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "work_type": {
+ "name": "work_type",
+ "type": "work_type",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ship_types": {
+ "name": "ship_types",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'A-MAX'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_shipbuilding_item_id_items_id_fk": {
+ "name": "item_shipbuilding_item_id_items_id_fk",
+ "tableFrom": "item_shipbuilding",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.items": {
+ "name": "items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "items_item_code_unique": {
+ "name": "items_item_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "item_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pq_criterias": {
+ "name": "pq_criterias",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "check_point": {
+ "name": "check_point",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "group_name": {
+ "name": "group_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pq_criterias_extension": {
+ "name": "pq_criterias_extension",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pq_criteria_id": {
+ "name": "pq_criteria_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_info": {
+ "name": "contract_info",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "additional_requirement": {
+ "name": "additional_requirement",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": {
+ "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk",
+ "tableFrom": "pq_criterias_extension",
+ "tableTo": "pq_criterias",
+ "columnsFrom": [
+ "pq_criteria_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "pq_criterias_extension_project_id_projects_id_fk": {
+ "name": "pq_criterias_extension_project_id_projects_id_fk",
+ "tableFrom": "pq_criterias_extension",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_criteria_attachments": {
+ "name": "vendor_criteria_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_criteria_answer_id": {
+ "name": "vendor_criteria_answer_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": {
+ "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk",
+ "tableFrom": "vendor_criteria_attachments",
+ "tableTo": "vendor_pq_criteria_answers",
+ "columnsFrom": [
+ "vendor_criteria_answer_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_pq_criteria_answers": {
+ "name": "vendor_pq_criteria_answers",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "criteria_id": {
+ "name": "criteria_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "answer": {
+ "name": "answer",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": {
+ "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": {
+ "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "pq_criterias",
+ "columnsFrom": [
+ "criteria_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_pq_criteria_answers_project_id_projects_id_fk": {
+ "name": "vendor_pq_criteria_answers_project_id_projects_id_fk",
+ "tableFrom": "vendor_pq_criteria_answers",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_pq_review_logs": {
+ "name": "vendor_pq_review_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_pq_criteria_answer_id": {
+ "name": "vendor_pq_criteria_answer_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviewer_comment": {
+ "name": "reviewer_comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "reviewer_name": {
+ "name": "reviewer_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": {
+ "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk",
+ "tableFrom": "vendor_pq_review_logs",
+ "tableTo": "vendor_pq_criteria_answers",
+ "columnsFrom": [
+ "vendor_pq_criteria_answer_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_project_pqs": {
+ "name": "vendor_project_pqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'REQUESTED'"
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejected_at": {
+ "name": "rejected_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "reject_reason": {
+ "name": "reject_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_project_pqs_vendor_id_vendors_id_fk": {
+ "name": "vendor_project_pqs_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_project_pqs",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "vendor_project_pqs_project_id_projects_id_fk": {
+ "name": "vendor_project_pqs_project_id_projects_id_fk",
+ "tableFrom": "vendor_project_pqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.bidding_projects": {
+ "name": "bidding_projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "pspid": {
+ "name": "pspid",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "proj_nm": {
+ "name": "proj_nm",
+ "type": "varchar(90)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sector": {
+ "name": "sector",
+ "type": "char(1)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proj_msrm": {
+ "name": "proj_msrm",
+ "type": "numeric(3, 0)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kunnr": {
+ "name": "kunnr",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kunnr_nm": {
+ "name": "kunnr_nm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cls_1": {
+ "name": "cls_1",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cls1_nm": {
+ "name": "cls1_nm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ptype": {
+ "name": "ptype",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "ptype_nm": {
+ "name": "ptype_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_cd": {
+ "name": "pmodel_cd",
+ "type": "char(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_nm": {
+ "name": "pmodel_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_sz": {
+ "name": "pmodel_sz",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pmodel_uom": {
+ "name": "pmodel_uom",
+ "type": "char(5)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "txt04": {
+ "name": "txt04",
+ "type": "char(4)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "txt30": {
+ "name": "txt30",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estm_pm": {
+ "name": "estm_pm",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "bidding_projects_pspid_unique": {
+ "name": "bidding_projects_pspid_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "pspid"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.project_series": {
+ "name": "project_series",
+ "schema": "",
+ "columns": {
+ "pspid": {
+ "name": "pspid",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sers_no": {
+ "name": "sers_no",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "sc_dt": {
+ "name": "sc_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "kl_dt": {
+ "name": "kl_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lc_dt": {
+ "name": "lc_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dl_dt": {
+ "name": "dl_dt",
+ "type": "char(8)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dock_no": {
+ "name": "dock_no",
+ "type": "char(3)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "dock_nm": {
+ "name": "dock_nm",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "proj_no": {
+ "name": "proj_no",
+ "type": "char(24)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "post1": {
+ "name": "post1",
+ "type": "varchar(40)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {
+ "project_sersNo_unique": {
+ "name": "project_sersNo_unique",
+ "columns": [
+ {
+ "expression": "pspid",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "sers_no",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "project_series_pspid_bidding_projects_pspid_fk": {
+ "name": "project_series_pspid_bidding_projects_pspid_fk",
+ "tableFrom": "project_series",
+ "tableTo": "bidding_projects",
+ "columnsFrom": [
+ "pspid"
+ ],
+ "columnsTo": [
+ "pspid"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.projects": {
+ "name": "projects",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ship'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.cbe_evaluations": {
+ "name": "cbe_evaluations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluated_by": {
+ "name": "evaluated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "evaluated_at": {
+ "name": "evaluated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "result": {
+ "name": "result",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_cost": {
+ "name": "total_cost",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms": {
+ "name": "incoterms",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_schedule": {
+ "name": "delivery_schedule",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "cbe_evaluations_rfq_id_rfqs_id_fk": {
+ "name": "cbe_evaluations_rfq_id_rfqs_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cbe_evaluations_vendor_id_vendors_id_fk": {
+ "name": "cbe_evaluations_vendor_id_vendors_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "cbe_evaluations_evaluated_by_users_id_fk": {
+ "name": "cbe_evaluations_evaluated_by_users_id_fk",
+ "tableFrom": "cbe_evaluations",
+ "tableTo": "users",
+ "columnsFrom": [
+ "evaluated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_attachments": {
+ "name": "rfq_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluation_id": {
+ "name": "evaluation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cbe_id": {
+ "name": "cbe_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_attachments_rfq_id_rfqs_id_fk": {
+ "name": "rfq_attachments_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_vendor_id_vendors_id_fk": {
+ "name": "rfq_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_evaluation_id_rfq_evaluations_id_fk": {
+ "name": "rfq_attachments_evaluation_id_rfq_evaluations_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfq_evaluations",
+ "columnsFrom": [
+ "evaluation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_cbe_id_cbe_evaluations_id_fk": {
+ "name": "rfq_attachments_cbe_id_cbe_evaluations_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "cbe_evaluations",
+ "columnsFrom": [
+ "cbe_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_attachments_comment_id_rfq_comments_id_fk": {
+ "name": "rfq_attachments_comment_id_rfq_comments_id_fk",
+ "tableFrom": "rfq_attachments",
+ "tableTo": "rfq_comments",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_comments": {
+ "name": "rfq_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment_text": {
+ "name": "comment_text",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "commented_by": {
+ "name": "commented_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "evaluation_id": {
+ "name": "evaluation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cbe_id": {
+ "name": "cbe_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_comments_rfq_id_rfqs_id_fk": {
+ "name": "rfq_comments_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_vendor_id_vendors_id_fk": {
+ "name": "rfq_comments_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_commented_by_users_id_fk": {
+ "name": "rfq_comments_commented_by_users_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "commented_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_evaluation_id_rfq_evaluations_id_fk": {
+ "name": "rfq_comments_evaluation_id_rfq_evaluations_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "rfq_evaluations",
+ "columnsFrom": [
+ "evaluation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_comments_cbe_id_vendor_responses_id_fk": {
+ "name": "rfq_comments_cbe_id_vendor_responses_id_fk",
+ "tableFrom": "rfq_comments",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "cbe_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_evaluations": {
+ "name": "rfq_evaluations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "eval_type": {
+ "name": "eval_type",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "result": {
+ "name": "result",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_evaluations_rfq_id_rfqs_id_fk": {
+ "name": "rfq_evaluations_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_evaluations",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "rfq_evaluations_vendor_id_vendors_id_fk": {
+ "name": "rfq_evaluations_vendor_id_vendors_id_fk",
+ "tableFrom": "rfq_evaluations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfq_items": {
+ "name": "rfq_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfq_items_rfq_id_rfqs_id_fk": {
+ "name": "rfq_items_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfq_items",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "rfq_items_item_code_items_item_code_fk": {
+ "name": "rfq_items_item_code_items_item_code_fk",
+ "tableFrom": "rfq_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_code"
+ ],
+ "columnsTo": [
+ "item_code"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.rfqs": {
+ "name": "rfqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "bid_project_id": {
+ "name": "bid_project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'DRAFT'"
+ },
+ "rfq_type": {
+ "name": "rfq_type",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PURCHASE'"
+ },
+ "parent_rfq_id": {
+ "name": "parent_rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "rfqs_project_id_projects_id_fk": {
+ "name": "rfqs_project_id_projects_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_bid_project_id_bidding_projects_id_fk": {
+ "name": "rfqs_bid_project_id_bidding_projects_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "bidding_projects",
+ "columnsFrom": [
+ "bid_project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_created_by_users_id_fk": {
+ "name": "rfqs_created_by_users_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "rfqs_parent_rfq_id_rfqs_id_fk": {
+ "name": "rfqs_parent_rfq_id_rfqs_id_fk",
+ "tableFrom": "rfqs",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "parent_rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "rfqs_rfq_code_unique": {
+ "name": "rfqs_rfq_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "rfq_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_commercial_responses": {
+ "name": "vendor_commercial_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric(18, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms": {
+ "name": "incoterms",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_period": {
+ "name": "delivery_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "warranty_period": {
+ "name": "warranty_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "validity_period": {
+ "name": "validity_period",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "price_breakdown": {
+ "name": "price_breakdown",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commercial_notes": {
+ "name": "commercial_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_commercial_responses_response_id_vendor_responses_id_fk": {
+ "name": "vendor_commercial_responses_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_commercial_responses",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_response_attachments": {
+ "name": "vendor_response_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "technical_response_id": {
+ "name": "technical_response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "commercial_response_id": {
+ "name": "commercial_response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_response_attachments_response_id_vendor_responses_id_fk": {
+ "name": "vendor_response_attachments_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk": {
+ "name": "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_technical_responses",
+ "columnsFrom": [
+ "technical_response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk": {
+ "name": "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk",
+ "tableFrom": "vendor_response_attachments",
+ "tableTo": "vendor_commercial_responses",
+ "columnsFrom": [
+ "commercial_response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_responses": {
+ "name": "vendor_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'REVIEWING'"
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responded_by": {
+ "name": "responded_by",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "responded_at": {
+ "name": "responded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "vendor_response_unique": {
+ "name": "vendor_response_unique",
+ "columns": [
+ {
+ "expression": "rfq_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "vendor_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "vendor_responses_rfq_id_rfqs_id_fk": {
+ "name": "vendor_responses_rfq_id_rfqs_id_fk",
+ "tableFrom": "vendor_responses",
+ "tableTo": "rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_responses_vendor_id_vendors_id_fk": {
+ "name": "vendor_responses_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_responses",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_technical_responses": {
+ "name": "vendor_technical_responses",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "response_id": {
+ "name": "response_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "response_status": {
+ "name": "response_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "summary": {
+ "name": "summary",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "notes": {
+ "name": "notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_technical_responses_response_id_vendor_responses_id_fk": {
+ "name": "vendor_technical_responses_response_id_vendor_responses_id_fk",
+ "tableFrom": "vendor_technical_responses",
+ "tableTo": "vendor_responses",
+ "columnsFrom": [
+ "response_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.otps": {
+ "name": "otps",
+ "schema": "",
+ "columns": {
+ "email": {
+ "name": "email",
+ "type": "varchar(256)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(6)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "otpToken": {
+ "name": "otpToken",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "otp_expires": {
+ "name": "otp_expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.permissions": {
+ "name": "permissions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "permissions_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "permission_key": {
+ "name": "permission_key",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.role_permissions": {
+ "name": "role_permissions",
+ "schema": "",
+ "columns": {
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission_id": {
+ "name": "permission_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "role_permissions_role_id_roles_id_fk": {
+ "name": "role_permissions_role_id_roles_id_fk",
+ "tableFrom": "role_permissions",
+ "tableTo": "roles",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "role_permissions_permission_id_permissions_id_fk": {
+ "name": "role_permissions_permission_id_permissions_id_fk",
+ "tableFrom": "role_permissions",
+ "tableTo": "permissions",
+ "columnsFrom": [
+ "permission_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.roles": {
+ "name": "roles",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "roles_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "domain": {
+ "name": "domain",
+ "type": "user_domain",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "''"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "roles_company_id_vendors_id_fk": {
+ "name": "roles_company_id_vendors_id_fk",
+ "tableFrom": "roles",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.user_roles": {
+ "name": "user_roles",
+ "schema": "",
+ "columns": {
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "role_id": {
+ "name": "role_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "user_roles_user_id_users_id_fk": {
+ "name": "user_roles_user_id_users_id_fk",
+ "tableFrom": "user_roles",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "user_roles_role_id_roles_id_fk": {
+ "name": "user_roles_role_id_roles_id_fk",
+ "tableFrom": "user_roles",
+ "tableTo": "roles",
+ "columnsFrom": [
+ "role_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.users": {
+ "name": "users",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "users_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "company_id": {
+ "name": "company_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "domain": {
+ "name": "domain",
+ "type": "user_domain",
+ "typeSchema": "public",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'partners'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "image_url": {
+ "name": "image_url",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "language": {
+ "name": "language",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'en'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "users_company_id_vendors_id_fk": {
+ "name": "users_company_id_vendors_id_fk",
+ "tableFrom": "users",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "company_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "users_email_unique": {
+ "name": "users_email_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "email"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.form_entries": {
+ "name": "form_entries",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "data": {
+ "name": "data",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "form_entries_contract_item_id_contract_items_id_fk": {
+ "name": "form_entries_contract_item_id_contract_items_id_fk",
+ "tableFrom": "form_entries",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.form_metas": {
+ "name": "form_metas",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "columns": {
+ "name": "columns",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "form_metas_project_id_projects_id_fk": {
+ "name": "form_metas_project_id_projects_id_fk",
+ "tableFrom": "form_metas",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "form_code_project_unique": {
+ "name": "form_code_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "form_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.forms": {
+ "name": "forms",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "forms_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "eng": {
+ "name": "eng",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "im": {
+ "name": "im",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "contract_item_form_code_unique": {
+ "name": "contract_item_form_code_unique",
+ "columns": [
+ {
+ "expression": "contract_item_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "form_code",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "forms_contract_item_id_contract_items_id_fk": {
+ "name": "forms_contract_item_id_contract_items_id_fk",
+ "tableFrom": "forms",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_classes": {
+ "name": "tag_classes",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "tag_classes_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_classes_project_id_projects_id_fk": {
+ "name": "tag_classes_project_id_projects_id_fk",
+ "tableFrom": "tag_classes",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": {
+ "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk",
+ "tableFrom": "tag_classes",
+ "tableTo": "tag_types",
+ "columnsFrom": [
+ "tag_type_code",
+ "project_id"
+ ],
+ "columnsTo": [
+ "code",
+ "project_id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_code_in_project": {
+ "name": "uniq_code_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_subfield_options": {
+ "name": "tag_subfield_options",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "label": {
+ "name": "label",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_subfield_options_project_id_projects_id_fk": {
+ "name": "tag_subfield_options_project_id_projects_id_fk",
+ "tableFrom": "tag_subfield_options",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_attribute_project_code": {
+ "name": "uniq_attribute_project_code",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "attributes_id",
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_subfields": {
+ "name": "tag_subfields",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_description": {
+ "name": "attributes_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expression": {
+ "name": "expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delimiter": {
+ "name": "delimiter",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_subfields_project_id_projects_id_fk": {
+ "name": "tag_subfields_project_id_projects_id_fk",
+ "tableFrom": "tag_subfields",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_tag_type_attribute": {
+ "name": "uniq_tag_type_attribute",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "tag_type_code",
+ "attributes_id"
+ ]
+ },
+ "uniq_attribute_id_project": {
+ "name": "uniq_attribute_id_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "attributes_id",
+ "project_id"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_type_class_form_mappings": {
+ "name": "tag_type_class_form_mappings",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type_label": {
+ "name": "tag_type_label",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "class_label": {
+ "name": "class_label",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_code": {
+ "name": "form_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_name": {
+ "name": "form_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "ep": {
+ "name": "ep",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "uniq_mapping_in_project": {
+ "name": "uniq_mapping_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "tag_type_label",
+ "class_label",
+ "form_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tag_types": {
+ "name": "tag_types",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tag_types_project_id_projects_id_fk": {
+ "name": "tag_types_project_id_projects_id_fk",
+ "tableFrom": "tag_types",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "tag_types_code_project_id_pk": {
+ "name": "tag_types_code_project_id_pk",
+ "columns": [
+ "code",
+ "project_id"
+ ]
+ }
+ },
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tags": {
+ "name": "tags",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "tags_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_id": {
+ "name": "form_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tag_no": {
+ "name": "tag_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tag_type": {
+ "name": "tag_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "class": {
+ "name": "class",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "tags_contract_item_id_contract_items_id_fk": {
+ "name": "tags_contract_item_id_contract_items_id_fk",
+ "tableFrom": "tags",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "tags_form_id_forms_id_fk": {
+ "name": "tags_form_id_forms_id_fk",
+ "tableFrom": "tags",
+ "tableTo": "forms",
+ "columnsFrom": [
+ "form_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "contract_item_tag_no_unique": {
+ "name": "contract_item_tag_no_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "contract_item_id",
+ "tag_no"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_data_report_temps": {
+ "name": "vendor_data_report_temps",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "contract_item_id": {
+ "name": "contract_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "form_id": {
+ "name": "form_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_data_report_temps_contract_item_id_contract_items_id_fk": {
+ "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk",
+ "tableFrom": "vendor_data_report_temps",
+ "tableTo": "contract_items",
+ "columnsFrom": [
+ "contract_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_data_report_temps_form_id_forms_id_fk": {
+ "name": "vendor_data_report_temps_form_id_forms_id_fk",
+ "tableFrom": "vendor_data_report_temps",
+ "tableTo": "forms",
+ "columnsFrom": [
+ "form_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.document_attachments": {
+ "name": "document_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "document_attachments_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "revision_id": {
+ "name": "revision_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "document_attachments_revision_id_revisions_id_fk": {
+ "name": "document_attachments_revision_id_revisions_id_fk",
+ "tableFrom": "document_attachments",
+ "tableTo": "revisions",
+ "columnsFrom": [
+ "revision_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.documents": {
+ "name": "documents",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "documents_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "document_type": {
+ "name": "document_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_contract_doc_status": {
+ "name": "unique_contract_doc_status",
+ "columns": [
+ {
+ "expression": "contract_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "doc_number",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "status",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "documents_contract_id_contracts_id_fk": {
+ "name": "documents_contract_id_contracts_id_fk",
+ "tableFrom": "documents",
+ "tableTo": "contracts",
+ "columnsFrom": [
+ "contract_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.issue_stages": {
+ "name": "issue_stages",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "issue_stages_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_name": {
+ "name": "stage_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "plan_date": {
+ "name": "plan_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "actual_date": {
+ "name": "actual_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_document_stage": {
+ "name": "unique_document_stage",
+ "columns": [
+ {
+ "expression": "document_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "stage_name",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {
+ "issue_stages_document_id_documents_id_fk": {
+ "name": "issue_stages_document_id_documents_id_fk",
+ "tableFrom": "issue_stages",
+ "tableTo": "documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.revisions": {
+ "name": "revisions",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "revisions_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "issue_stage_id": {
+ "name": "issue_stage_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "revision": {
+ "name": "revision",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uploader_type": {
+ "name": "uploader_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'vendor'"
+ },
+ "uploader_id": {
+ "name": "uploader_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploader_name": {
+ "name": "uploader_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_date": {
+ "name": "approved_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "unique_stage_rev": {
+ "name": "unique_stage_rev",
+ "columns": [
+ {
+ "expression": "issue_stage_id",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ },
+ {
+ "expression": "revision",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": true,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_attachments": {
+ "name": "vendor_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'GENERAL'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_attachments_vendor_id_vendors_id_fk": {
+ "name": "vendor_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_candidates": {
+ "name": "vendor_candidates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_name": {
+ "name": "company_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'COLLECTED'"
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_candidates_vendor_id_vendors_id_fk": {
+ "name": "vendor_candidates_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_candidates",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_contacts": {
+ "name": "vendor_contacts",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_name": {
+ "name": "contact_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_position": {
+ "name": "contact_position",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_primary": {
+ "name": "is_primary",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_contacts_vendor_id_vendors_id_fk": {
+ "name": "vendor_contacts_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_contacts",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_investigation_attachments": {
+ "name": "vendor_investigation_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "investigation_id": {
+ "name": "investigation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'REPORT'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": {
+ "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk",
+ "tableFrom": "vendor_investigation_attachments",
+ "tableTo": "vendor_investigations",
+ "columnsFrom": [
+ "investigation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_investigations": {
+ "name": "vendor_investigations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "investigation_status": {
+ "name": "investigation_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PLANNED'"
+ },
+ "scheduled_start_at": {
+ "name": "scheduled_start_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_end_at": {
+ "name": "scheduled_end_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "investigation_notes": {
+ "name": "investigation_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_investigations_vendor_id_vendors_id_fk": {
+ "name": "vendor_investigations_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_investigations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_possible_items": {
+ "name": "vendor_possible_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_possible_items_vendor_id_vendors_id_fk": {
+ "name": "vendor_possible_items_vendor_id_vendors_id_fk",
+ "tableFrom": "vendor_possible_items",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "vendor_possible_items_item_code_items_item_code_fk": {
+ "name": "vendor_possible_items_item_code_items_item_code_fk",
+ "tableFrom": "vendor_possible_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_code"
+ ],
+ "columnsTo": [
+ "item_code"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_types": {
+ "name": "vendor_types",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "vendor_types_code_unique": {
+ "name": "vendor_types_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendors": {
+ "name": "vendors",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "vendor_type_id": {
+ "name": "vendor_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "business_size": {
+ "name": "business_size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendors_vendor_type_id_vendor_types_id_fk": {
+ "name": "vendors_vendor_type_id_vendor_types_id_fk",
+ "tableFrom": "vendors",
+ "tableTo": "vendor_types",
+ "columnsFrom": [
+ "vendor_type_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.tasks": {
+ "name": "tasks",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(30)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'todo'"
+ },
+ "label": {
+ "name": "label",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'bug'"
+ },
+ "priority": {
+ "name": "priority",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'low'"
+ },
+ "archived": {
+ "name": "archived",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "current_timestamp"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "tasks_code_unique": {
+ "name": "tasks_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendor_candidate_logs": {
+ "name": "vendor_candidate_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_candidate_id": {
+ "name": "vendor_candidate_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "old_status": {
+ "name": "old_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_status": {
+ "name": "new_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk": {
+ "name": "vendor_candidate_logs_vendor_candidate_id_vendor_candidates_id_fk",
+ "tableFrom": "vendor_candidate_logs",
+ "tableTo": "vendor_candidates",
+ "columnsFrom": [
+ "vendor_candidate_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendor_candidate_logs_user_id_users_id_fk": {
+ "name": "vendor_candidate_logs_user_id_users_id_fk",
+ "tableFrom": "vendor_candidate_logs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.vendors_logs": {
+ "name": "vendors_logs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "action": {
+ "name": "action",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "old_status": {
+ "name": "old_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "new_status": {
+ "name": "new_status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "comment": {
+ "name": "comment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "vendors_logs_vendor_id_vendors_id_fk": {
+ "name": "vendors_logs_vendor_id_vendors_id_fk",
+ "tableFrom": "vendors_logs",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "vendors_logs_user_id_users_id_fk": {
+ "name": "vendors_logs_user_id_users_id_fk",
+ "tableFrom": "vendors_logs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.basic_contract": {
+ "name": "basic_contract",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "basic_contract_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "template_id": {
+ "name": "template_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "requested_by": {
+ "name": "requested_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING'"
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "basic_contract_template_id_basic_contract_templates_id_fk": {
+ "name": "basic_contract_template_id_basic_contract_templates_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "basic_contract_templates",
+ "columnsFrom": [
+ "template_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "basic_contract_vendor_id_vendors_id_fk": {
+ "name": "basic_contract_vendor_id_vendors_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ },
+ "basic_contract_requested_by_users_id_fk": {
+ "name": "basic_contract_requested_by_users_id_fk",
+ "tableFrom": "basic_contract",
+ "tableTo": "users",
+ "columnsFrom": [
+ "requested_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "no action",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.basic_contract_templates": {
+ "name": "basic_contract_templates",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "basic_contract_templates_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "template_name": {
+ "name": "template_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(1024)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "validity_period": {
+ "name": "validity_period",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.incoterms": {
+ "name": "incoterms",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(20)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "incoterms_created_by_users_id_fk": {
+ "name": "incoterms_created_by_users_id_fk",
+ "tableFrom": "incoterms",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.payment_terms": {
+ "name": "payment_terms",
+ "schema": "",
+ "columns": {
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": true
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "payment_terms_created_by_users_id_fk": {
+ "name": "payment_terms_created_by_users_id_fk",
+ "tableFrom": "payment_terms",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.pr_items": {
+ "name": "pr_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_item": {
+ "name": "rfq_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_item": {
+ "name": "pr_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_no": {
+ "name": "pr_no",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_category": {
+ "name": "material_category",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acc": {
+ "name": "acc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "size": {
+ "name": "size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gross_weight": {
+ "name": "gross_weight",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "gw_uom": {
+ "name": "gw_uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_no": {
+ "name": "spec_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_url": {
+ "name": "spec_url",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracking_no": {
+ "name": "tracking_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "major_yn": {
+ "name": "major_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "project_def": {
+ "name": "project_def",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_sc": {
+ "name": "project_sc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_kl": {
+ "name": "project_kl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_lc": {
+ "name": "project_lc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_dl": {
+ "name": "project_dl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "pr_items_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "pr_items",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "pr_items_item_id_items_id_fk": {
+ "name": "pr_items_item_id_items_id_fk",
+ "tableFrom": "pr_items",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_attachments": {
+ "name": "procurement_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "attachment_type": {
+ "name": "attachment_type",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "procurement_rfq_details_id": {
+ "name": "procurement_rfq_details_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "original_file_name": {
+ "name": "original_file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "procurement_attachments_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk": {
+ "name": "procurement_attachments_procurement_rfq_details_id_procurement_rfq_details_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "procurement_rfq_details",
+ "columnsFrom": [
+ "procurement_rfq_details_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_attachments_created_by_users_id_fk": {
+ "name": "procurement_attachments_created_by_users_id_fk",
+ "tableFrom": "procurement_attachments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {
+ "attachment_type_check": {
+ "name": "attachment_type_check",
+ "value": "\"procurement_attachments\".\"procurement_rfqs_id\" IS NOT NULL OR \"procurement_attachments\".\"procurement_rfq_details_id\" IS NOT NULL"
+ }
+ },
+ "isRLSEnabled": false
+ },
+ "public.procurement_quotation_items": {
+ "name": "procurement_quotation_items",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "quotation_id": {
+ "name": "quotation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "pr_item_id": {
+ "name": "pr_item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "unit_price": {
+ "name": "unit_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "vendor_material_code": {
+ "name": "vendor_material_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_material_description": {
+ "name": "vendor_material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lead_time_in_days": {
+ "name": "lead_time_in_days",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_rate": {
+ "name": "tax_rate",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_amount": {
+ "name": "tax_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount_rate": {
+ "name": "discount_rate",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount_amount": {
+ "name": "discount_amount",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "is_alternative": {
+ "name": "is_alternative",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "is_recommended": {
+ "name": "is_recommended",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk": {
+ "name": "procurement_quotation_items_quotation_id_procurement_vendor_quotations_id_fk",
+ "tableFrom": "procurement_quotation_items",
+ "tableTo": "procurement_vendor_quotations",
+ "columnsFrom": [
+ "quotation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_quotation_items_pr_item_id_pr_items_id_fk": {
+ "name": "procurement_quotation_items_pr_item_id_pr_items_id_fk",
+ "tableFrom": "procurement_quotation_items",
+ "tableTo": "pr_items",
+ "columnsFrom": [
+ "pr_item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_attachments": {
+ "name": "procurement_rfq_attachments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "comment_id": {
+ "name": "comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quotation_id": {
+ "name": "quotation_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_name": {
+ "name": "file_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_size": {
+ "name": "file_size",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "file_type": {
+ "name": "file_type",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "file_path": {
+ "name": "file_path",
+ "type": "varchar(500)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_vendor_upload": {
+ "name": "is_vendor_upload",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "uploaded_by": {
+ "name": "uploaded_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "uploaded_at": {
+ "name": "uploaded_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_attachments_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk": {
+ "name": "procurement_rfq_attachments_comment_id_procurement_rfq_comments_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_rfq_comments",
+ "columnsFrom": [
+ "comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk": {
+ "name": "procurement_rfq_attachments_quotation_id_procurement_vendor_quotations_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "procurement_vendor_quotations",
+ "columnsFrom": [
+ "quotation_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_uploaded_by_users_id_fk": {
+ "name": "procurement_rfq_attachments_uploaded_by_users_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "uploaded_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_attachments_vendor_id_vendors_id_fk": {
+ "name": "procurement_rfq_attachments_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_attachments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_comments": {
+ "name": "procurement_rfq_comments",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_vendor_comment": {
+ "name": "is_vendor_comment",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "is_read": {
+ "name": "is_read",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "parent_comment_id": {
+ "name": "parent_comment_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_comments_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_vendor_id_vendors_id_fk": {
+ "name": "procurement_rfq_comments_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_user_id_users_id_fk": {
+ "name": "procurement_rfq_comments_user_id_users_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk": {
+ "name": "procurement_rfq_comments_parent_comment_id_procurement_rfq_comments_id_fk",
+ "tableFrom": "procurement_rfq_comments",
+ "tableTo": "procurement_rfq_comments",
+ "columnsFrom": [
+ "parent_comment_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfq_details": {
+ "name": "procurement_rfq_details",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "vendors_id": {
+ "name": "vendors_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "payment_terms_code": {
+ "name": "payment_terms_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_code": {
+ "name": "incoterms_code",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_detail": {
+ "name": "incoterms_detail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "tax_code": {
+ "name": "tax_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'VV'"
+ },
+ "place_of_shipping": {
+ "name": "place_of_shipping",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "place_of_destination": {
+ "name": "place_of_destination",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cancel_reason": {
+ "name": "cancel_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "material_price_related_yn": {
+ "name": "material_price_related_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk": {
+ "name": "procurement_rfq_details_procurement_rfqs_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "procurement_rfqs_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_vendors_id_vendors_id_fk": {
+ "name": "procurement_rfq_details_vendors_id_vendors_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendors_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_payment_terms_code_payment_terms_code_fk": {
+ "name": "procurement_rfq_details_payment_terms_code_payment_terms_code_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "payment_terms",
+ "columnsFrom": [
+ "payment_terms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_incoterms_code_incoterms_code_fk": {
+ "name": "procurement_rfq_details_incoterms_code_incoterms_code_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "incoterms",
+ "columnsFrom": [
+ "incoterms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfq_details_updated_by_users_id_fk": {
+ "name": "procurement_rfq_details_updated_by_users_id_fk",
+ "tableFrom": "procurement_rfq_details",
+ "tableTo": "users",
+ "columnsFrom": [
+ "updated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_rfqs": {
+ "name": "procurement_rfqs",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "series": {
+ "name": "series",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "due_date": {
+ "name": "due_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "rfq_send_date": {
+ "name": "rfq_send_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'RFQ Created'"
+ },
+ "rfq_sealed_yn": {
+ "name": "rfq_sealed_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "pic_code": {
+ "name": "pic_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sent_by": {
+ "name": "sent_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_rfqs_project_id_projects_id_fk": {
+ "name": "procurement_rfqs_project_id_projects_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "projects",
+ "columnsFrom": [
+ "project_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_item_id_items_id_fk": {
+ "name": "procurement_rfqs_item_id_items_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "items",
+ "columnsFrom": [
+ "item_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_sent_by_users_id_fk": {
+ "name": "procurement_rfqs_sent_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "sent_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_created_by_users_id_fk": {
+ "name": "procurement_rfqs_created_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "created_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_rfqs_updated_by_users_id_fk": {
+ "name": "procurement_rfqs_updated_by_users_id_fk",
+ "tableFrom": "procurement_rfqs",
+ "tableTo": "users",
+ "columnsFrom": [
+ "updated_by"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {
+ "procurement_rfqs_rfq_code_unique": {
+ "name": "procurement_rfqs_rfq_code_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "rfq_code"
+ ]
+ }
+ },
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.procurement_vendor_quotations": {
+ "name": "procurement_vendor_quotations",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "rfq_id": {
+ "name": "rfq_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "quotation_code": {
+ "name": "quotation_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quotation_version": {
+ "name": "quotation_version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "total_items_count": {
+ "name": "total_items_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 0
+ },
+ "sub_total": {
+ "name": "sub_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "tax_total": {
+ "name": "tax_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "discount_total": {
+ "name": "discount_total",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "total_price": {
+ "name": "total_price",
+ "type": "numeric",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'0'"
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'USD'"
+ },
+ "valid_until": {
+ "name": "valid_until",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "estimated_delivery_date": {
+ "name": "estimated_delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "payment_terms_code": {
+ "name": "payment_terms_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_code": {
+ "name": "incoterms_code",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "incoterms_detail": {
+ "name": "incoterms_detail",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'Draft'"
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rejection_reason": {
+ "name": "rejection_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "accepted_at": {
+ "name": "accepted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "updated_by": {
+ "name": "updated_by",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk": {
+ "name": "procurement_vendor_quotations_rfq_id_procurement_rfqs_id_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "procurement_rfqs",
+ "columnsFrom": [
+ "rfq_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_vendor_id_vendors_id_fk": {
+ "name": "procurement_vendor_quotations_vendor_id_vendors_id_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "vendors",
+ "columnsFrom": [
+ "vendor_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk": {
+ "name": "procurement_vendor_quotations_payment_terms_code_payment_terms_code_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "payment_terms",
+ "columnsFrom": [
+ "payment_terms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ },
+ "procurement_vendor_quotations_incoterms_code_incoterms_code_fk": {
+ "name": "procurement_vendor_quotations_incoterms_code_incoterms_code_fk",
+ "tableFrom": "procurement_vendor_quotations",
+ "tableTo": "incoterms",
+ "columnsFrom": [
+ "incoterms_code"
+ ],
+ "columnsTo": [
+ "code"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.preset_shares": {
+ "name": "preset_shares",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "preset_id": {
+ "name": "preset_id",
+ "type": "uuid",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "shared_with_user_id": {
+ "name": "shared_with_user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'read'"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "preset_shares_preset_id_table_presets_id_fk": {
+ "name": "preset_shares_preset_id_table_presets_id_fk",
+ "tableFrom": "preset_shares",
+ "tableTo": "table_presets",
+ "columnsFrom": [
+ "preset_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ },
+ "public.table_presets": {
+ "name": "table_presets",
+ "schema": "",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "uuid",
+ "primaryKey": true,
+ "notNull": true,
+ "default": "gen_random_uuid()"
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "table_id": {
+ "name": "table_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "settings": {
+ "name": "settings",
+ "type": "json",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "is_default": {
+ "name": "is_default",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_active": {
+ "name": "is_active",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "is_shared": {
+ "name": "is_shared",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "default": false
+ },
+ "created_by": {
+ "name": "created_by",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "policies": {},
+ "checkConstraints": {},
+ "isRLSEnabled": false
+ }
+ },
+ "enums": {
+ "public.work_type": {
+ "name": "work_type",
+ "schema": "public",
+ "values": [
+ "기장",
+ "전장",
+ "선실",
+ "배관",
+ "철의"
+ ]
+ },
+ "public.user_domain": {
+ "name": "user_domain",
+ "schema": "public",
+ "values": [
+ "evcp",
+ "partners"
+ ]
+ }
+ },
+ "schemas": {},
+ "sequences": {},
+ "roles": {},
+ "policies": {},
+ "views": {
+ "public.contracts_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "contracts_detail_view_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contract_name": {
+ "name": "contract_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ACTIVE'"
+ },
+ "start_date": {
+ "name": "start_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "end_date": {
+ "name": "end_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "payment_terms": {
+ "name": "payment_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'KRW'"
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "partial_shipping_allowed": {
+ "name": "partial_shipping_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "partial_payment_allowed": {
+ "name": "partial_payment_allowed",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "remarks": {
+ "name": "remarks",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "version": {
+ "name": "version",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"contracts\".\"id\", \"contracts\".\"contract_no\", \"contracts\".\"contract_name\", \"contracts\".\"status\", \"contracts\".\"start_date\", \"contracts\".\"end_date\", \"contracts\".\"project_id\", \"projects\".\"code\", \"projects\".\"name\", \"contracts\".\"vendor_id\", \"vendors\".\"vendor_name\", \"contracts\".\"payment_terms\", \"contracts\".\"delivery_terms\", \"contracts\".\"delivery_date\", \"contracts\".\"delivery_location\", \"contracts\".\"currency\", \"contracts\".\"total_amount\", \"contracts\".\"discount\", \"contracts\".\"tax\", \"contracts\".\"shipping_fee\", \"contracts\".\"net_total\", \"contracts\".\"partial_shipping_allowed\", \"contracts\".\"partial_payment_allowed\", \"contracts\".\"remarks\", \"contracts\".\"version\", \"contracts\".\"created_at\", \"contracts\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"contracts\".\"id\"\n ) as \"has_signature\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "contracts_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.poa_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "identity": {
+ "type": "always",
+ "name": "poa_detail_view_id_seq",
+ "schema": "public",
+ "increment": "1",
+ "startWith": "1",
+ "minValue": "1",
+ "maxValue": "2147483647",
+ "cache": "1",
+ "cycle": false
+ }
+ },
+ "contract_no": {
+ "name": "contract_no",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "change_reason": {
+ "name": "change_reason",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approval_status": {
+ "name": "approval_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'PENDING'"
+ },
+ "delivery_terms": {
+ "name": "delivery_terms",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_location": {
+ "name": "delivery_location",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "currency": {
+ "name": "currency",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "total_amount": {
+ "name": "total_amount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "discount": {
+ "name": "discount",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax": {
+ "name": "tax",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "shipping_fee": {
+ "name": "shipping_fee",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "net_total": {
+ "name": "net_total",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"",
+ "name": "poa_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.project_approved_vendors": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "type": {
+ "name": "type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'ship'"
+ },
+ "submitted_at": {
+ "name": "submitted_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "approved_at": {
+ "name": "approved_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"status\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"projects\".\"code\", \"projects\".\"name\", \"projects\".\"type\", \"vendor_project_pqs\".\"submitted_at\", \"vendor_project_pqs\".\"approved_at\" from \"vendors\" inner join \"vendor_project_pqs\" on \"vendor_project_pqs\".\"vendor_id\" = \"vendors\".\"id\" inner join \"projects\" on \"vendor_project_pqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\" where \"vendor_project_pqs\".\"status\" = 'APPROVED'",
+ "name": "project_approved_vendors",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.cbe_view": {
+ "columns": {},
+ "definition": "select \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"rfq_id\" as \"rfq_id\", \"cbe_evaluations\".\"vendor_id\" as \"vendor_id\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"result\" as \"result\", \"cbe_evaluations\".\"notes\" as \"notes\", \"cbe_evaluations\".\"evaluated_by\" as \"evaluated_by\", \"cbe_evaluations\".\"evaluated_at\" as \"evaluated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"name\" as \"evaluator_name\", \"users\".\"email\" as \"evaluator_email\" from \"cbe_evaluations\" inner join \"rfqs\" on \"cbe_evaluations\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"cbe_evaluations\".\"evaluated_by\" = \"users\".\"id\"",
+ "name": "cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.rfqs_view": {
+ "columns": {},
+ "definition": "select \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfqs\".\"parent_rfq_id\" as \"parent_rfq_id\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"users\".\"email\" as \"user_email\", \"users\".\"name\" as \"user_name\", (\n SELECT COUNT(*) \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"item_count\", (\n SELECT COUNT(*) \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"attachment_count\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"users\" on \"rfqs\".\"created_by\" = \"users\".\"id\"",
+ "name": "rfqs_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_cbe_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", \"cbe_evaluations\".\"notes\" as \"cbe_note\", \"cbe_evaluations\".\"updated_at\" as \"cbe_updated\", \"cbe_evaluations\".\"total_cost\" as \"total_cost\", \"cbe_evaluations\".\"currency\" as \"currency\", \"cbe_evaluations\".\"payment_terms\" as \"payment_terms\", \"cbe_evaluations\".\"incoterms\" as \"incoterms\", \"cbe_evaluations\".\"delivery_schedule\" as \"delivery_schedule\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")",
+ "name": "vendor_cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_response_cbe_view": {
+ "columns": {},
+ "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"notes\" as \"response_notes\", \"vendor_responses\".\"responded_by\" as \"responded_by\", \"vendor_responses\".\"responded_at\" as \"responded_at\", \"vendor_responses\".\"updated_at\" as \"response_updated_at\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"status\" as \"vendor_status\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"response_status\" as \"commercial_response_status\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"vendor_commercial_responses\".\"payment_terms\" as \"payment_terms\", \"vendor_commercial_responses\".\"incoterms\" as \"incoterms\", \"vendor_commercial_responses\".\"delivery_period\" as \"delivery_period\", \"vendor_commercial_responses\".\"warranty_period\" as \"warranty_period\", \"vendor_commercial_responses\".\"validity_period\" as \"validity_period\", \"vendor_commercial_responses\".\"price_breakdown\" as \"price_breakdown\", \"vendor_commercial_responses\".\"commercial_notes\" as \"commercial_notes\", \"vendor_commercial_responses\".\"created_at\" as \"commercial_created_at\", \"vendor_commercial_responses\".\"updated_at\" as \"commercial_updated_at\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"commercial_response_id\" = \"vendor_commercial_responses\".\"id\"\n ) as \"commercial_attachment_count\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n AND \"vendor_response_attachments\".\"attachment_type\" = 'TECHNICAL_SPEC'\n ) as \"technical_attachment_count\", (\n SELECT MAX(\"uploaded_at\") \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"latest_attachment_date\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\"",
+ "name": "vendor_response_cbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_responses_view": {
+ "columns": {},
+ "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"vendor_id\" as \"vendor_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"rfq_description\", \"rfqs\".\"due_date\" as \"rfq_due_date\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"created_at\" as \"rfq_created_at\", \"rfqs\".\"updated_at\" as \"rfq_updated_at\", \"rfqs\".\"created_by\" as \"rfq_created_by\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendor_responses\".\"response_status\" as \"response_status\", \"vendor_responses\".\"responded_at\" as \"responded_at\", CASE WHEN \"vendor_technical_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_technical_response\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", CASE WHEN \"vendor_commercial_responses\".\"id\" IS NOT NULL THEN TRUE ELSE FALSE END as \"has_commercial_response\", \"vendor_commercial_responses\".\"id\" as \"commercial_response_id\", \"vendor_commercial_responses\".\"total_price\" as \"total_price\", \"vendor_commercial_responses\".\"currency\" as \"currency\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"cbe_evaluations\".\"id\" as \"cbe_id\", \"cbe_evaluations\".\"result\" as \"cbe_result\", (\n SELECT COUNT(*) \n FROM \"vendor_response_attachments\" \n WHERE \"vendor_response_attachments\".\"response_id\" = \"vendor_responses\".\"id\"\n ) as \"attachment_count\" from \"vendor_responses\" inner join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" inner join \"vendors\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"vendor_commercial_responses\" on \"vendor_commercial_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"rfq_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE') left join \"cbe_evaluations\" on (\"cbe_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\" and \"cbe_evaluations\".\"vendor_id\" = \"vendor_responses\".\"vendor_id\")",
+ "name": "vendor_responses_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_rfq_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"",
+ "name": "vendor_rfq_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_tbe_view": {
+ "columns": {},
+ "definition": "select \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"address\" as \"address\", \"vendors\".\"country\" as \"country\", \"vendors\".\"email\" as \"email\", \"vendors\".\"website\" as \"website\", \"vendors\".\"status\" as \"vendor_status\", \"vendor_responses\".\"id\" as \"vendor_response_id\", \"vendor_responses\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"response_status\" as \"rfq_vendor_status\", \"vendor_responses\".\"updated_at\" as \"rfq_vendor_updated\", \"vendor_technical_responses\".\"id\" as \"technical_response_id\", \"vendor_technical_responses\".\"response_status\" as \"technical_response_status\", \"vendor_technical_responses\".\"summary\" as \"technical_summary\", \"vendor_technical_responses\".\"notes\" as \"technical_notes\", \"vendor_technical_responses\".\"updated_at\" as \"technical_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" as \"rfq_type\", \"rfqs\".\"status\" as \"rfq_status\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"rfq_evaluations\".\"id\" as \"tbe_id\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"vendor_responses\" on \"vendor_responses\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"vendor_responses\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"vendor_technical_responses\" on \"vendor_technical_responses\".\"response_id\" = \"vendor_responses\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"vendor_responses\".\"rfq_id\")",
+ "name": "vendor_tbe_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.role_view": {
+ "columns": {},
+ "definition": "select \"roles\".\"id\" as \"id\", \"roles\".\"name\" as \"name\", \"roles\".\"description\" as \"description\", \"roles\".\"domain\" as \"domain\", \"roles\".\"created_at\" as \"created_at\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", COUNT(\"users\".\"id\") as \"user_count\" from \"roles\" left join \"user_roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" left join \"users\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"vendors\" on \"roles\".\"company_id\" = \"vendors\".\"id\" group by \"roles\".\"id\", \"vendors\".\"id\"",
+ "name": "role_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.user_view": {
+ "columns": {},
+ "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"domain\" as \"user_domain\", \"users\".\"image_url\" as \"user_image\", \"vendors\".\"id\" as \"company_id\", \"vendors\".\"vendor_name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"vendors\" on \"users\".\"company_id\" = \"vendors\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" left join \"roles\" on \"user_roles\".\"role_id\" = \"roles\".\"id\" group by \"users\".\"id\", \"vendors\".\"id\"",
+ "name": "user_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.view_tag_subfields": {
+ "columns": {
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_description": {
+ "name": "attributes_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expression": {
+ "name": "expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delimiter": {
+ "name": "delimiter",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"tag_subfields\".\"id\" as \"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\" as \"project_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\"",
+ "name": "view_tag_subfields",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.document_stages_view": {
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_count": {
+ "name": "stage_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "stage_list": {
+ "name": "stage_list",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n\n (\n SELECT COUNT(*)\n FROM issue_stages\n WHERE document_id = d.id\n ) AS stage_count,\n\n COALESCE( \n (\n SELECT json_agg(i.stage_name)\n FROM issue_stages i\n WHERE i.document_id = d.id\n ), \n '[]'\n ) AS stage_list,\n\n d.created_at,\n d.updated_at\n FROM documents d\n",
+ "name": "document_stages_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_documents_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "doc_number": {
+ "name": "doc_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "title": {
+ "name": "title",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "issued_date": {
+ "name": "issued_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contract_id": {
+ "name": "contract_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "latest_stage_id": {
+ "name": "latest_stage_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_name": {
+ "name": "latest_stage_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_plan_date": {
+ "name": "latest_stage_plan_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_stage_actual_date": {
+ "name": "latest_stage_actual_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_id": {
+ "name": "latest_revision_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision": {
+ "name": "latest_revision",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_uploader_type": {
+ "name": "latest_revision_uploader_type",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "latest_revision_uploader_name": {
+ "name": "latest_revision_uploader_name",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "attachment_count": {
+ "name": "attachment_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n \n d.contract_id,\n \n (\n SELECT id FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_id,\n (\n SELECT stage_name FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_name,\n (\n SELECT plan_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_plan_date,\n (\n SELECT actual_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_actual_date,\n \n (\n SELECT r.id FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_id,\n (\n SELECT r.revision FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision,\n (\n SELECT r.uploader_type FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_type,\n (\n SELECT r.uploader_name FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_name,\n \n (\n SELECT COUNT(*) FROM document_attachments a\n JOIN revisions r ON a.revision_id = r.id\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ",
+ "name": "vendor_documents_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_candidates_with_vendor_info": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "company_name": {
+ "name": "company_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "contact_email": {
+ "name": "contact_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "contact_phone": {
+ "name": "contact_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "source": {
+ "name": "source",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'COLLECTED'"
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendor_candidates\".\"id\", \"vendor_candidates\".\"company_name\", \"vendor_candidates\".\"contact_email\", \"vendor_candidates\".\"contact_phone\", \"vendor_candidates\".\"tax_id\", \"vendor_candidates\".\"address\", \"vendor_candidates\".\"country\", \"vendor_candidates\".\"source\", \"vendor_candidates\".\"status\", \"vendor_candidates\".\"items\", \"vendor_candidates\".\"remark\", \"vendor_candidates\".\"created_at\", \"vendor_candidates\".\"updated_at\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"created_at\" as \"vendor_created_at\", (\n SELECT l2.\"created_at\"\n FROM \"vendor_candidate_logs\" l2\n WHERE l2.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l2.\"action\" = 'status_change'\n ORDER BY l2.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_at\", (\n SELECT u.\"name\"\n FROM \"users\" u\n JOIN \"vendor_candidate_logs\" l3\n ON l3.\"user_id\" = u.\"id\"\n WHERE l3.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l3.\"action\" = 'status_change'\n ORDER BY l3.\"created_at\" DESC\n LIMIT 1\n ) as \"last_status_change_by\", (\n SELECT l4.\"created_at\"\n FROM \"vendor_candidate_logs\" l4\n WHERE l4.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l4.\"action\" = 'invite_sent'\n ORDER BY l4.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_at\", (\n SELECT u2.\"name\"\n FROM \"users\" u2\n JOIN \"vendor_candidate_logs\" l5\n ON l5.\"user_id\" = u2.\"id\"\n WHERE l5.\"vendor_candidate_id\" = \"vendor_candidates\".\"id\"\n AND l5.\"action\" = 'invite_sent'\n ORDER BY l5.\"created_at\" DESC\n LIMIT 1\n ) as \"last_invitation_by\" from \"vendor_candidates\" left join \"vendors\" on \"vendor_candidates\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "vendor_candidates_with_vendor_info",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_detail_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"",
+ "name": "vendor_detail_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_investigations_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "investigation_status": {
+ "name": "investigation_status",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PLANNED'"
+ },
+ "scheduled_start_at": {
+ "name": "scheduled_start_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "scheduled_end_at": {
+ "name": "scheduled_end_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "completed_at": {
+ "name": "completed_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "investigation_notes": {
+ "name": "investigation_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ }
+ },
+ "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"",
+ "name": "vendor_investigations_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendor_items_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_id": {
+ "name": "vendor_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"",
+ "name": "vendor_items_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.vendors_with_types": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "vendor_name": {
+ "name": "vendor_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "vendor_code": {
+ "name": "vendor_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tax_id": {
+ "name": "tax_id",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "address": {
+ "name": "address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "country": {
+ "name": "country",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "phone": {
+ "name": "phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "email": {
+ "name": "email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "website": {
+ "name": "website",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "status": {
+ "name": "status",
+ "type": "varchar(30)",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "'PENDING_REVIEW'"
+ },
+ "vendor_type_id": {
+ "name": "vendor_type_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_name": {
+ "name": "representative_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_birth": {
+ "name": "representative_birth",
+ "type": "varchar(20)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_email": {
+ "name": "representative_email",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "representative_phone": {
+ "name": "representative_phone",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "corporate_registration_number": {
+ "name": "corporate_registration_number",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "items": {
+ "name": "items",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_agency": {
+ "name": "credit_agency",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "credit_rating": {
+ "name": "credit_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "cash_flow_rating": {
+ "name": "cash_flow_rating",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "name_ko": {
+ "name": "name_ko",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "name_en": {
+ "name": "name_en",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "code": {
+ "name": "code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"address\", \"vendors\".\"country\", \"vendors\".\"phone\", \"vendors\".\"email\", \"vendors\".\"website\", \"vendors\".\"status\", \"vendors\".\"vendor_type_id\", \"vendors\".\"representative_name\", \"vendors\".\"representative_birth\", \"vendors\".\"representative_email\", \"vendors\".\"representative_phone\", \"vendors\".\"corporate_registration_number\", \"vendors\".\"items\", \"vendors\".\"credit_agency\", \"vendors\".\"credit_rating\", \"vendors\".\"cash_flow_rating\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", \"vendor_types\".\"name_ko\", \"vendor_types\".\"name_en\", \"vendor_types\".\"code\", \n CASE\n WHEN \"vendors\".\"status\" = 'ACTIVE' THEN '정규업체'\n WHEN \"vendors\".\"status\" IN ('INACTIVE', 'BLACKLISTED', 'REJECTED') THEN ''\n ELSE '잠재업체'\n END\n as \"vendor_category\" from \"vendors\" left join \"vendor_types\" on \"vendors\".\"vendor_type_id\" = \"vendor_types\".\"id\"",
+ "name": "vendors_with_types",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.basic_contract_view": {
+ "columns": {},
+ "definition": "select \"basic_contract\".\"id\" as \"id\", \"basic_contract\".\"template_id\" as \"template_id\", \"basic_contract\".\"vendor_id\" as \"vendor_id\", \"basic_contract\".\"requested_by\" as \"requested_by\", \"basic_contract\".\"status\" as \"basic_contract_status\", \"basic_contract\".\"created_at\" as \"created_at\", \"basic_contract\".\"updated_at\" as \"updated_at\", \"basic_contract\".\"updated_at\" as \"completed_at\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"email\" as \"vendor_email\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"users\".\"name\" as \"user_name\", \"basic_contract_templates\".\"template_name\" as \"template_name\", \"basic_contract_templates\".\"validity_period\" as \"validityPeriod\", \"basic_contract_templates\".\"file_path\" as \"file_path\", \"basic_contract_templates\".\"file_name\" as \"file_name\", \"basic_contract\".\"file_path\" as \"signed_file_path\" from \"basic_contract\" left join \"vendors\" on \"basic_contract\".\"vendor_id\" = \"vendors\".\"id\" left join \"users\" on \"basic_contract\".\"requested_by\" = \"users\".\"id\" left join \"basic_contract_templates\" on \"basic_contract\".\"template_id\" = \"basic_contract_templates\".\"id\"",
+ "name": "basic_contract_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.pr_items_view": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "notNull": true
+ },
+ "procurement_rfqs_id": {
+ "name": "procurement_rfqs_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_item": {
+ "name": "rfq_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_item": {
+ "name": "pr_item",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "pr_no": {
+ "name": "pr_no",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_id": {
+ "name": "item_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_code": {
+ "name": "material_code",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_category": {
+ "name": "material_category",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "acc": {
+ "name": "acc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "material_description": {
+ "name": "material_description",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "size": {
+ "name": "size",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delivery_date": {
+ "name": "delivery_date",
+ "type": "date",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "quantity": {
+ "name": "quantity",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "uom": {
+ "name": "uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "gross_weight": {
+ "name": "gross_weight",
+ "type": "numeric(12, 2)",
+ "primaryKey": false,
+ "notNull": false,
+ "default": 1
+ },
+ "gw_uom": {
+ "name": "gw_uom",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_no": {
+ "name": "spec_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "spec_url": {
+ "name": "spec_url",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "tracking_no": {
+ "name": "tracking_no",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "major_yn": {
+ "name": "major_yn",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": false,
+ "default": false
+ },
+ "project_def": {
+ "name": "project_def",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_sc": {
+ "name": "project_sc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_kl": {
+ "name": "project_kl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_lc": {
+ "name": "project_lc",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "project_dl": {
+ "name": "project_dl",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "remark": {
+ "name": "remark",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "rfq_code": {
+ "name": "rfq_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_code": {
+ "name": "item_code",
+ "type": "varchar(100)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "item_name": {
+ "name": "item_name",
+ "type": "varchar(255)",
+ "primaryKey": false,
+ "notNull": true
+ }
+ },
+ "definition": "select \"pr_items\".\"id\", \"pr_items\".\"procurement_rfqs_id\", \"pr_items\".\"rfq_item\", \"pr_items\".\"pr_item\", \"pr_items\".\"pr_no\", \"pr_items\".\"item_id\", \"pr_items\".\"material_code\", \"pr_items\".\"material_category\", \"pr_items\".\"acc\", \"pr_items\".\"material_description\", \"pr_items\".\"size\", \"pr_items\".\"delivery_date\", \"pr_items\".\"quantity\", \"pr_items\".\"uom\", \"pr_items\".\"gross_weight\", \"pr_items\".\"gw_uom\", \"pr_items\".\"spec_no\", \"pr_items\".\"spec_url\", \"pr_items\".\"tracking_no\", \"pr_items\".\"major_yn\", \"pr_items\".\"project_def\", \"pr_items\".\"project_sc\", \"pr_items\".\"project_kl\", \"pr_items\".\"project_lc\", \"pr_items\".\"project_dl\", \"pr_items\".\"remark\", \"procurement_rfqs\".\"rfq_code\", \"items\".\"item_code\", \"items\".\"item_name\" from \"pr_items\" left join \"procurement_rfqs\" on \"pr_items\".\"procurement_rfqs_id\" = \"procurement_rfqs\".\"id\" left join \"items\" on \"pr_items\".\"item_id\" = \"items\".\"id\"",
+ "name": "pr_items_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.procurement_rfq_details_view": {
+ "columns": {},
+ "definition": "select \"rfq_details\".\"id\" as \"detail_id\", \"rfqs\".\"id\" as \"rfq_id\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"items\".\"item_code\" as \"item_code\", \"items\".\"item_name\" as \"item_name\", \"vendors\".\"vendor_name\" as \"vendor_name\", \"vendors\".\"vendor_code\" as \"vendor_code\", \"vendors\".\"id\" as \"vendor_id\", \"vendors\".\"country\" as \"vendor_country\", \"rfq_details\".\"currency\" as \"currency\", \"payment_terms\".\"code\" as \"payment_terms_code\", \"payment_terms\".\"description\" as \"payment_terms_description\", \"incoterms\".\"code\" as \"incoterms_code\", \"incoterms\".\"description\" as \"incoterms_description\", \"rfq_details\".\"incoterms_detail\" as \"incoterms_detail\", \"rfq_details\".\"delivery_date\" as \"delivery_date\", \"rfq_details\".\"tax_code\" as \"tax_code\", \"rfq_details\".\"place_of_shipping\" as \"place_of_shipping\", \"rfq_details\".\"place_of_destination\" as \"place_of_destination\", \"rfq_details\".\"material_price_related_yn\" as \"material_price_related_yn\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"rfq_details\".\"updated_at\" as \"updated_at\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\"\n ) as \"pr_items_count\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"rfqs\".\"id\" \n AND major_yn = true\n ) as \"major_items_count\", (\n SELECT COUNT(*) \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"comment_count\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_comment_date\", (\n SELECT created_at \n FROM procurement_rfq_comments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\" AND is_vendor_comment = true\n ORDER BY created_at DESC LIMIT 1\n ) as \"last_vendor_comment_date\", (\n SELECT COUNT(*) \n FROM procurement_rfq_attachments \n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) > 0\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"has_quotation\", (\n SELECT status\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_status\", (\n SELECT total_price\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY created_at DESC LIMIT 1\n ) as \"quotation_total_price\", (\n SELECT quotation_version\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"quotation_version\", (\n SELECT COUNT(DISTINCT quotation_version)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ) as \"quotation_version_count\", (\n SELECT created_at\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"rfqs\".\"id\" AND vendor_id = \"rfq_details\".\"vendors_id\"\n ORDER BY quotation_version DESC LIMIT 1\n ) as \"last_quotation_date\" from \"procurement_rfq_details\" \"rfq_details\" left join \"procurement_rfqs\" \"rfqs\" on \"rfq_details\".\"procurement_rfqs_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"items\" on \"rfqs\".\"item_id\" = \"items\".\"id\" left join \"vendors\" on \"rfq_details\".\"vendors_id\" = \"vendors\".\"id\" left join \"payment_terms\" on \"rfq_details\".\"payment_terms_code\" = \"payment_terms\".\"code\" left join \"incoterms\" on \"rfq_details\".\"incoterms_code\" = \"incoterms\".\"code\" left join \"users\" \"updated_by_user\" on \"rfq_details\".\"updated_by\" = \"updated_by_user\".\"id\"",
+ "name": "procurement_rfq_details_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ },
+ "public.procurement_rfqs_view": {
+ "columns": {},
+ "definition": "select \"procurement_rfqs\".\"id\" as \"id\", \"procurement_rfqs\".\"rfq_code\" as \"rfq_code\", \"procurement_rfqs\".\"series\" as \"series\", \"procurement_rfqs\".\"rfq_sealed_yn\" as \"rfq_sealed_yn\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\", \"items\".\"item_code\" as \"item_code\", \"items\".\"item_name\" as \"item_name\", \"procurement_rfqs\".\"status\" as \"status\", \"procurement_rfqs\".\"pic_code\" as \"pic_code\", \"procurement_rfqs\".\"rfq_send_date\" as \"rfq_send_date\", \"procurement_rfqs\".\"due_date\" as \"due_date\", (\n SELECT MIN(submitted_at)\n FROM procurement_vendor_quotations\n WHERE rfq_id = \"procurement_rfqs\".\"id\"\n AND submitted_at IS NOT NULL\n ) as \"earliest_quotation_submitted_at\", \"created_by_user\".\"name\" as \"created_by_user_name\", \"sent_by_user\".\"name\" as \"sent_by_user_name\", \"procurement_rfqs\".\"updated_at\" as \"updated_at\", \"updated_by_user\".\"name\" as \"updated_by_user_name\", \"procurement_rfqs\".\"remark\" as \"remark\", (\n SELECT material_code \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"major_item_material_code\", (\n SELECT pr_no \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n AND major_yn = true\n LIMIT 1\n ) as \"po_no\", (\n SELECT COUNT(*) \n FROM pr_items \n WHERE procurement_rfqs_id = \"procurement_rfqs\".\"id\"\n ) as \"pr_items_count\" from \"procurement_rfqs\" left join \"projects\" on \"procurement_rfqs\".\"project_id\" = \"projects\".\"id\" left join \"items\" on \"procurement_rfqs\".\"item_id\" = \"items\".\"id\" left join \"users\" \"created_by_user\" on \"procurement_rfqs\".\"created_by\" = \"created_by_user\".\"id\" left join \"users\" \"updated_by_user\" on \"procurement_rfqs\".\"updated_by\" = \"updated_by_user\".\"id\" left join \"users\" \"sent_by_user\" on \"procurement_rfqs\".\"sent_by\" = \"sent_by_user\".\"id\"",
+ "name": "procurement_rfqs_view",
+ "schema": "public",
+ "isExisting": false,
+ "materialized": false
+ }
+ },
+ "_meta": {
+ "columns": {},
+ "schemas": {},
+ "tables": {}
+ }
+} \ No newline at end of file
diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json
index 615acbee..fe89e33c 100644
--- a/db/migrations/meta/_journal.json
+++ b/db/migrations/meta/_journal.json
@@ -470,6 +470,20 @@
"when": 1747041659553,
"tag": "0066_public_may_parker",
"breakpoints": true
+ },
+ {
+ "idx": 67,
+ "version": "7",
+ "when": 1747128641386,
+ "tag": "0067_remarkable_doctor_doom",
+ "breakpoints": true
+ },
+ {
+ "idx": 68,
+ "version": "7",
+ "when": 1747186079082,
+ "tag": "0068_silly_black_knight",
+ "breakpoints": true
}
]
} \ No newline at end of file
diff --git a/db/schema/index.ts b/db/schema/index.ts
index 537cc16c..fdd73344 100644
--- a/db/schema/index.ts
+++ b/db/schema/index.ts
@@ -13,3 +13,4 @@ export * from './tasks';
export * from './logs';
export * from './basicContractDocumnet';
export * from './procurementRFQ';
+export * from './setting';
diff --git a/db/schema/setting.ts b/db/schema/setting.ts
new file mode 100644
index 00000000..61862bc8
--- /dev/null
+++ b/db/schema/setting.ts
@@ -0,0 +1,78 @@
+// db/schema/table-presets.ts
+import { pgTable, text, timestamp, boolean, integer, uuid } from "drizzle-orm/pg-core"
+import { json } from "drizzle-orm/pg-core"
+import { z } from "zod"
+
+// TableSettings 타입 정의
+export interface TableSettings<TData = any> {
+ // 페이지네이션
+ page: number
+ perPage: number
+
+ // 정렬
+ sort: Array<{
+ id: string
+ desc: boolean
+ }>
+
+ // 필터
+ filters: Array<{
+ id: string
+ value: any
+ operator?: string
+ type?: string
+ }>
+ joinOperator: "and" | "or"
+ basicFilters: Array<{
+ id: string
+ value: any
+ operator?: string
+ type?: string
+ }>
+ basicJoinOperator: "and" | "or"
+ search: string
+
+ // 날짜 범위 (선택적)
+ from?: string
+ to?: string
+
+ // 테이블 상태
+ columnVisibility: Record<string, boolean>
+ columnOrder: string[]
+ pinnedColumns: {
+ left: string[]
+ right: string[]
+ }
+
+ // 기타 확장 가능한 설정들
+ groupBy?: string[]
+ expandedRows?: string[]
+}
+
+export const tablePresets = pgTable("table_presets", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ userId: text("user_id").notNull(),
+ tableId: text("table_id").notNull(), // 'rfq-list', 'purchase-orders' 등
+ name: text("name").notNull(),
+ settings: json("settings").$type<TableSettings>().notNull(),
+ isDefault: boolean("is_default").default(false).notNull(),
+ isActive: boolean("is_active").default(false).notNull(),
+ isShared: boolean("is_shared").default(false).notNull(),
+ createdBy: text("created_by"),
+ createdAt: timestamp("created_at").defaultNow().notNull(),
+ updatedAt: timestamp("updated_at").defaultNow().notNull(),
+})
+
+// 공유 프리셋 테이블
+export const presetShares = pgTable("preset_shares", {
+ id: uuid("id").primaryKey().defaultRandom(),
+ presetId: uuid("preset_id").references(() => tablePresets.id, { onDelete: "cascade" }).notNull(),
+ sharedWithUserId: text("shared_with_user_id").notNull(),
+ permission: text("permission").default("read").notNull(), // 'read', 'write'
+ createdAt: timestamp("created_at").defaultNow().notNull(),
+})
+
+// TypeScript 타입 추출
+export type TablePreset = typeof tablePresets.$inferSelect
+export type NewTablePreset = typeof tablePresets.$inferInsert
+
diff --git a/db/schema/vendorDocu.ts b/db/schema/vendorDocu.ts
index ce498b94..1e166e6b 100644
--- a/db/schema/vendorDocu.ts
+++ b/db/schema/vendorDocu.ts
@@ -11,6 +11,9 @@ export const documents = pgTable(
// 주 키
id: integer("id").primaryKey().generatedAlwaysAsIdentity(),
+ // documentType: varchar("document_type", { length: 50 }).notNull(),
+
+
// 어느 계약(Contract) 소속인지
contractId: integer("contract_id")
.notNull()
diff --git a/db/seeds/po-rfq.ts b/db/seeds/po-rfq.ts
new file mode 100644
index 00000000..62bb39bd
--- /dev/null
+++ b/db/seeds/po-rfq.ts
@@ -0,0 +1,352 @@
+import { faker } from "@faker-js/faker";
+import db from "@/db/db"
+
+import {
+ procurementRfqs,
+ paymentTerms,
+ incoterms,
+ procurementRfqDetails,
+ prItems
+} from "@/db/schema";
+import { eq } from "drizzle-orm";
+
+// 랜덤 데이터 생성 시 일관성을 위해 시드 설정
+faker.seed(123);
+
+// 생성할 데이터 수량 설정
+const NUM_PAYMENT_TERMS = 5;
+const NUM_INCOTERMS = 7;
+const NUM_RFQS = 50;
+const NUM_RFQ_DETAILS_PER_RFQ = 1; // 각 RFQ마다 생성할 detail 수
+const NUM_PR_ITEMS_PER_RFQ = 3; // 각 RFQ마다 생성할 PR item 수
+
+/**
+ * 기존 데이터를 가져오는 함수들
+ */
+async function getRandomUser() {
+ const users = await db.query.users.findMany({ limit: 50 });
+ return faker.helpers.arrayElement(users);
+}
+
+async function getRandomProject() {
+ const projects = await db.query.projects.findMany({ limit: 50 });
+ return faker.helpers.arrayElement(projects);
+}
+
+async function getRandomItem() {
+ const items = await db.query.items.findMany({ limit: 50 });
+ return faker.helpers.arrayElement(items);
+}
+
+async function getRandomVendor() {
+ const vendors = await db.query.vendors.findMany({ limit: 50 });
+ return faker.helpers.arrayElement(vendors);
+}
+
+/**
+ * 시드 데이터 생성 함수
+ */
+
+// 지불 조건 시드 데이터 생성
+async function seedPaymentTerms() {
+ console.log("🌱 시드 데이터 생성 중: 지불 조건");
+
+ // 기존 데이터 확인
+ const existingTerms = await db.query.paymentTerms.findMany();
+ if (existingTerms.length > 0) {
+ console.log(" ✓ 지불 조건 데이터가 이미 존재합니다.");
+ return existingTerms;
+ }
+
+ const terms = [
+ { code: "NET30", description: "Net 30 days" },
+ { code: "NET60", description: "Net 60 days" },
+ { code: "COD", description: "Cash on Delivery" },
+ { code: "ADV", description: "Advance Payment" },
+ { code: "L/C", description: "Letter of Credit" }
+ ];
+
+ const randomUser = await getRandomUser();
+
+ const paymentTermsData = terms.map(term => ({
+ code: term.code,
+ description: term.description,
+ isActive: true,
+ createdBy: randomUser.id,
+ createdAt: new Date()
+ }));
+
+ await db.insert(paymentTerms).values(paymentTermsData);
+ console.log(` ✓ ${terms.length}개의 지불 조건이 생성되었습니다.`);
+
+ return await db.query.paymentTerms.findMany();
+}
+
+// 인코텀즈 시드 데이터 생성
+async function seedIncoterms() {
+ console.log("🌱 시드 데이터 생성 중: 인코텀즈");
+
+ // 기존 데이터 확인
+ const existingIncoterms = await db.query.incoterms.findMany();
+ if (existingIncoterms.length > 0) {
+ console.log(" ✓ 인코텀즈 데이터가 이미 존재합니다.");
+ return existingIncoterms;
+ }
+
+ const terms = [
+ { code: "EXW", description: "Ex Works" },
+ { code: "FCA", description: "Free Carrier" },
+ { code: "FAS", description: "Free Alongside Ship" },
+ { code: "FOB", description: "Free On Board" },
+ { code: "CFR", description: "Cost and Freight" },
+ { code: "CIF", description: "Cost, Insurance and Freight" },
+ { code: "DDP", description: "Delivered Duty Paid" }
+ ];
+
+ const randomUser = await getRandomUser();
+
+ const incotermsData = terms.map(term => ({
+ code: term.code,
+ description: term.description,
+ isActive: true,
+ createdBy: randomUser.id,
+ createdAt: new Date()
+ }));
+
+ await db.insert(incoterms).values(incotermsData);
+ console.log(` ✓ ${terms.length}개의 인코텀즈가 생성되었습니다.`);
+
+ return await db.query.incoterms.findMany();
+}
+
+// RFQ 시드 데이터 생성
+async function seedRfqs() {
+ console.log("🌱 시드 데이터 생성 중: RFQ");
+
+ // 기존 데이터 확인
+ const existingRfqs = await db.query.procurementRfqs.findMany();
+ if (existingRfqs.length > 0) {
+ console.log(` ✓ RFQ 데이터가 이미 ${existingRfqs.length}개 존재합니다.`);
+ return existingRfqs;
+ }
+
+ const statusOptions = [
+ "RFQ Created",
+ "RFQ Vendor Assignned",
+ "RFQ Sent",
+ "Quotation Analysis",
+ "PO Transfer",
+ "PO Create"
+ ];
+
+ const rfqsData = [];
+
+ for (let i = 1; i <= NUM_RFQS; i++) {
+ const randomUser = await getRandomUser();
+ const randomProject = await getRandomProject();
+ const randomItem = await getRandomItem();
+
+ // RFQ 전송일은 과거 1~90일 사이
+ const rfqSendDate = faker.date.past({ days: 90 });
+
+ // 마감일은 전송일로부터 7~30일 이후
+ const dueDate = new Date(rfqSendDate);
+ dueDate.setDate(dueDate.getDate() + faker.number.int({ min: 7, max: 30 }));
+
+ const series = faker.helpers.arrayElement(["A", "B", "C", "D", "E"]);
+ const rfqCode = `RFQ-${new Date().getFullYear()}-${String(i).padStart(3, '0')}`;
+
+ rfqsData.push({
+ rfqCode,
+ projectId: randomProject.id,
+ series,
+ itemId: randomItem.id,
+ dueDate,
+ rfqSendDate,
+ status: faker.helpers.arrayElement(statusOptions),
+ rfqSealedYn: faker.datatype.boolean(0.3), // 30% 확률로 true
+ picCode: faker.person.lastName() + faker.string.numeric(2), // 발주담당 코드
+ remark: faker.helpers.maybe(() => faker.lorem.sentence(), { probability: 0.6 }),
+ createdBy: randomUser.id,
+ updatedBy: randomUser.id,
+ createdAt: faker.date.recent({ days: 100 }),
+ updatedAt: new Date()
+ });
+ }
+
+ // 청크로 나누어 대용량 데이터 삽입
+ const chunkSize = 10;
+ for (let i = 0; i < rfqsData.length; i += chunkSize) {
+ const chunk = rfqsData.slice(i, i + chunkSize);
+ await db.insert(procurementRfqs).values(chunk);
+ }
+
+ console.log(` ✓ ${rfqsData.length}개의 RFQ가 생성되었습니다.`);
+
+ return await db.query.procurementRfqs.findMany();
+}
+
+// RFQ 상세 정보 시드 데이터 생성
+async function seedRfqDetails(rfqs, paymentTermsList, incotermsList) {
+ console.log("🌱 시드 데이터 생성 중: RFQ 상세 정보");
+
+ // 기존 데이터 확인
+ const existingDetails = await db.query.procurementRfqDetails.findMany();
+ if (existingDetails.length > 0) {
+ console.log(` ✓ RFQ 상세 정보가 이미 ${existingDetails.length}개 존재합니다.`);
+ return existingDetails;
+ }
+
+ const rfqDetailsData = [];
+
+ for (const rfq of rfqs) {
+ for (let i = 0; i < NUM_RFQ_DETAILS_PER_RFQ; i++) {
+ const randomVendor = await getRandomVendor();
+ const randomUser = await getRandomUser();
+
+ const paymentTerm = faker.helpers.arrayElement(paymentTermsList);
+ const incoterm = faker.helpers.arrayElement(incotermsList);
+
+ // 배송일은 RFQ 마감일로부터 14~60일 이후
+ const deliveryDate = new Date(rfq.dueDate);
+ deliveryDate.setDate(deliveryDate.getDate() + faker.number.int({ min: 14, max: 60 }));
+
+ const currencies = ["USD", "EUR", "JPY", "KRW", "CNY"];
+
+ rfqDetailsData.push({
+ procurementRfqsId: rfq.id,
+ vendorsId: randomVendor.id,
+ currency: faker.helpers.arrayElement(currencies),
+ paymentTermsCode: paymentTerm.code,
+ incotermsCode: incoterm.code,
+ incotermsDetail: faker.helpers.maybe(() => faker.lorem.sentence(), { probability: 0.7 }),
+ deliveryDate,
+ taxCode: faker.helpers.arrayElement(["VV", "V1", "V2", "V0"]),
+ placeOfShipping: faker.location.city() + ", " + faker.location.country(),
+ placeOfDestination: faker.location.city() + ", " + faker.location.country(),
+ remark: faker.helpers.maybe(() => faker.lorem.paragraph(), { probability: 0.5 }),
+ cancelReason: faker.helpers.maybe(() => faker.lorem.sentence(), { probability: 0.1 }),
+ updatedBy: randomUser.id,
+ updatedAt: new Date(),
+ materialPriceRelatedYn: faker.datatype.boolean(0.4) // 40% 확률로 true
+ });
+ }
+ }
+
+ // 청크로 나누어 대용량 데이터 삽입
+ const chunkSize = 20;
+ for (let i = 0; i < rfqDetailsData.length; i += chunkSize) {
+ const chunk = rfqDetailsData.slice(i, i + chunkSize);
+ await db.insert(procurementRfqDetails).values(chunk);
+ }
+
+ console.log(` ✓ ${rfqDetailsData.length}개의 RFQ 상세 정보가 생성되었습니다.`);
+
+ return await db.query.procurementRfqDetails.findMany();
+}
+
+// PR 아이템 시드 데이터 생성
+async function seedPrItems(rfqs) {
+ console.log("🌱 시드 데이터 생성 중: PR 아이템");
+
+ // 기존 데이터 확인
+ const existingItems = await db.query.prItems.findMany();
+ if (existingItems.length > 0) {
+ console.log(` ✓ PR 아이템이 이미 ${existingItems.length}개 존재합니다.`);
+ return existingItems;
+ }
+
+ const prItemsData = [];
+
+ for (const rfq of rfqs) {
+ // 각 RFQ마다 여러 개의 PR 아이템 생성
+ for (let i = 0; i < NUM_PR_ITEMS_PER_RFQ; i++) {
+ const randomItem = await getRandomItem();
+
+ // 하나의 RFQ에 하나의 major item만 존재하도록 설정
+ const majorYn = i === 0;
+
+ // 배송일은 RFQ 전송일로부터 30~120일 이후
+ const deliveryDate = new Date(rfq.rfqSendDate);
+ deliveryDate.setDate(deliveryDate.getDate() + faker.number.int({ min: 30, max: 120 }));
+
+ const materialCode = faker.string.alphanumeric(8).toUpperCase();
+ const rfqItem = `${String(i + 1).padStart(2, '0')}`;
+ const prItem = `${String(i + 1).padStart(2, '0')}`;
+ const prNo = `PR-${new Date().getFullYear()}-${faker.string.numeric(4)}`;
+
+ prItemsData.push({
+ procurementRfqsId: rfq.id,
+ rfqItem,
+ prItem,
+ prNo,
+ itemId: randomItem.id,
+ materialCode,
+ materialCategory: faker.helpers.arrayElement(["RAW", "SEMI", "FIN", "SERV", "TOOL"]),
+ acc: faker.string.alphanumeric(6).toUpperCase(),
+ materialDescription: faker.commerce.productName(),
+ size: faker.helpers.maybe(() => `${faker.number.int({ min: 10, max: 200 })}x${faker.number.int({ min: 10, max: 200 })}`, { probability: 0.7 }),
+ deliveryDate,
+ quantity: faker.number.float({ min: 1, max: 1000, precision: 0.01 }),
+ uom: faker.helpers.arrayElement(["EA", "KG", "M", "L", "SET"]),
+ grossWeight: faker.number.float({ min: 0.1, max: 500, precision: 0.01 }),
+ gwUom: faker.helpers.arrayElement(["KG", "TON"]),
+ specNo: faker.helpers.maybe(() => `SPEC-${faker.string.alphanumeric(6).toUpperCase()}`, { probability: 0.6 }),
+ specUrl: faker.helpers.maybe(() => faker.internet.url(), { probability: 0.4 }),
+ trackingNo: faker.helpers.maybe(() => `TRK-${faker.string.alphanumeric(8).toUpperCase()}`, { probability: 0.5 }),
+ majorYn,
+ projectDef: faker.helpers.maybe(() => faker.string.alphanumeric(5).toUpperCase(), { probability: 0.8 }),
+ projectSc: faker.helpers.maybe(() => faker.string.alphanumeric(5).toUpperCase(), { probability: 0.7 }),
+ projectKl: faker.helpers.maybe(() => faker.string.alphanumeric(5).toUpperCase(), { probability: 0.7 }),
+ projectLc: faker.helpers.maybe(() => faker.string.alphanumeric(5).toUpperCase(), { probability: 0.7 }),
+ projectDl: faker.helpers.maybe(() => faker.string.alphanumeric(5).toUpperCase(), { probability: 0.7 }),
+ remark: faker.helpers.maybe(() => faker.lorem.sentence(), { probability: 0.4 })
+ });
+ }
+ }
+
+ // 청크로 나누어 대용량 데이터 삽입
+ const chunkSize = 30;
+ for (let i = 0; i < prItemsData.length; i += chunkSize) {
+ const chunk = prItemsData.slice(i, i + chunkSize);
+ await db.insert(prItems).values(chunk);
+ }
+
+ console.log(` ✓ ${prItemsData.length}개의 PR 아이템이 생성되었습니다.`);
+
+ return await db.query.prItems.findMany();
+}
+
+/**
+ * 시드 실행 함수
+ */
+export async function seedProcurement() {
+ console.log("🔍 procurement 데이터 시딩 시작...");
+
+ try {
+ // 순서대로 데이터 시딩
+ const paymentTermsList = await seedPaymentTerms();
+ const incotermsList = await seedIncoterms();
+ const rfqsList = await seedRfqs();
+ await seedRfqDetails(rfqsList, paymentTermsList, incotermsList);
+ await seedPrItems(rfqsList);
+
+ console.log("✅ procurement 데이터 시딩 완료!");
+ } catch (error) {
+ console.error("❌ 데이터 시딩 중 오류 발생:", error);
+ throw error;
+ }
+}
+
+// 스크립트가 직접 실행될 때만 시드 함수 호출
+if (require.main === module) {
+ seedProcurement()
+ .then(() => {
+ console.log("시드 스크립트 실행 완료. 프로세스를 종료합니다.");
+ process.exit(0);
+ })
+ .catch((error) => {
+ console.error("시드 스크립트 실행 중 오류:", error);
+ process.exit(1);
+ });
+} \ No newline at end of file