From b8e8328b1ffffb80bf4ebb776a4a24e5680fc5bc Mon Sep 17 00:00:00 2001 From: dujinkim Date: Fri, 28 Mar 2025 00:42:08 +0000 Subject: 테이블 칼럼 리사이즈 및 핀 충돌 해결 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrations/0094_brave_sue_storm.sql | 55 + db/migrations/0094_fresh_blur.sql | 783 ++++ db/migrations/0095_abnormal_virginia_dare.sql | 55 + db/migrations/0095_odd_slayback.sql | 55 + db/migrations/0096_far_lord_tyger.sql | 2 - db/migrations/0097_worried_cobalt_man.sql | 10 - db/migrations/0098_cooing_reptil.sql | 5 - db/migrations/0099_parallel_ink.sql | 2 - db/migrations/0100_abandoned_moonstone.sql | 4 - db/migrations/0101_past_killraven.sql | 5 - db/migrations/0102_melodic_blob.sql | 1 - db/migrations/0103_huge_wallflower.sql | 37 - db/migrations/meta/0000_snapshot.json | 360 -- db/migrations/meta/0001_snapshot.json | 499 --- db/migrations/meta/0002_snapshot.json | 506 --- db/migrations/meta/0003_snapshot.json | 513 --- db/migrations/meta/0004_snapshot.json | 533 --- db/migrations/meta/0005_snapshot.json | 592 --- db/migrations/meta/0006_snapshot.json | 541 --- db/migrations/meta/0007_snapshot.json | 772 ---- db/migrations/meta/0008_snapshot.json | 772 ---- db/migrations/meta/0009_snapshot.json | 778 ---- db/migrations/meta/0010_snapshot.json | 1442 ------- db/migrations/meta/0011_snapshot.json | 1456 -------- db/migrations/meta/0012_snapshot.json | 1456 -------- db/migrations/meta/0013_snapshot.json | 1462 -------- db/migrations/meta/0014_snapshot.json | 1527 -------- db/migrations/meta/0015_snapshot.json | 1535 -------- db/migrations/meta/0016_snapshot.json | 1554 -------- db/migrations/meta/0017_snapshot.json | 1561 -------- db/migrations/meta/0018_snapshot.json | 1577 -------- db/migrations/meta/0019_snapshot.json | 1585 -------- db/migrations/meta/0020_snapshot.json | 1585 -------- db/migrations/meta/0021_snapshot.json | 1591 -------- db/migrations/meta/0022_snapshot.json | 1642 -------- db/migrations/meta/0023_snapshot.json | 2046 ---------- db/migrations/meta/0024_snapshot.json | 2062 ---------- db/migrations/meta/0025_snapshot.json | 2055 ---------- db/migrations/meta/0026_snapshot.json | 2074 ----------- db/migrations/meta/0027_snapshot.json | 2080 ----------- db/migrations/meta/0028_snapshot.json | 2100 ----------- db/migrations/meta/0029_snapshot.json | 2119 ----------- db/migrations/meta/0030_snapshot.json | 2215 ----------- db/migrations/meta/0031_snapshot.json | 2221 ----------- db/migrations/meta/0032_snapshot.json | 2227 ----------- db/migrations/meta/0033_snapshot.json | 2247 ----------- db/migrations/meta/0034_snapshot.json | 2394 ------------ db/migrations/meta/0035_snapshot.json | 2388 ------------ db/migrations/meta/0036_snapshot.json | 2444 ------------ db/migrations/meta/0037_snapshot.json | 2501 ------------- db/migrations/meta/0038_snapshot.json | 2501 ------------- db/migrations/meta/0039_snapshot.json | 2529 ------------- db/migrations/meta/0040_snapshot.json | 2557 ------------- db/migrations/meta/0041_snapshot.json | 2566 ------------- db/migrations/meta/0042_snapshot.json | 2640 ------------- db/migrations/meta/0043_snapshot.json | 2620 ------------- db/migrations/meta/0044_snapshot.json | 2640 ------------- db/migrations/meta/0045_snapshot.json | 2651 ------------- db/migrations/meta/0046_snapshot.json | 2639 ------------- db/migrations/meta/0047_snapshot.json | 2892 -------------- db/migrations/meta/0048_snapshot.json | 2971 --------------- db/migrations/meta/0049_snapshot.json | 2979 --------------- db/migrations/meta/0050_snapshot.json | 3055 --------------- db/migrations/meta/0051_snapshot.json | 3086 --------------- db/migrations/meta/0052_snapshot.json | 3100 --------------- db/migrations/meta/0053_snapshot.json | 3107 ---------------- db/migrations/meta/0054_snapshot.json | 3193 ---------------- db/migrations/meta/0055_snapshot.json | 3145 ---------------- db/migrations/meta/0056_snapshot.json | 3214 ---------------- db/migrations/meta/0057_snapshot.json | 3214 ---------------- db/migrations/meta/0058_snapshot.json | 3236 ---------------- db/migrations/meta/0059_snapshot.json | 3264 ---------------- db/migrations/meta/0060_snapshot.json | 3461 ----------------- db/migrations/meta/0061_snapshot.json | 3475 ----------------- db/migrations/meta/0062_snapshot.json | 3544 ------------------ db/migrations/meta/0063_snapshot.json | 3538 ------------------ db/migrations/meta/0064_snapshot.json | 3551 ------------------ db/migrations/meta/0065_snapshot.json | 3609 ------------------ db/migrations/meta/0066_snapshot.json | 3609 ------------------ db/migrations/meta/0067_snapshot.json | 3656 ------------------ db/migrations/meta/0068_snapshot.json | 3656 ------------------ db/migrations/meta/0069_snapshot.json | 3656 ------------------ db/migrations/meta/0070_snapshot.json | 3656 ------------------ db/migrations/meta/0071_snapshot.json | 3656 ------------------ db/migrations/meta/0072_snapshot.json | 3643 ------------------ db/migrations/meta/0073_snapshot.json | 3676 ------------------ db/migrations/meta/0074_snapshot.json | 3676 ------------------ db/migrations/meta/0075_snapshot.json | 3978 -------------------- db/migrations/meta/0076_snapshot.json | 4167 --------------------- db/migrations/meta/0077_snapshot.json | 4175 --------------------- db/migrations/meta/0078_snapshot.json | 4175 --------------------- db/migrations/meta/0079_snapshot.json | 4175 --------------------- db/migrations/meta/0080_snapshot.json | 4175 --------------------- db/migrations/meta/0081_snapshot.json | 4175 --------------------- db/migrations/meta/0082_snapshot.json | 4453 ---------------------- db/migrations/meta/0083_snapshot.json | 4453 ---------------------- db/migrations/meta/0084_snapshot.json | 4453 ---------------------- db/migrations/meta/0085_snapshot.json | 4453 ---------------------- db/migrations/meta/0086_snapshot.json | 4557 ----------------------- db/migrations/meta/0087_snapshot.json | 4971 ------------------------- db/migrations/meta/0088_snapshot.json | 4743 ----------------------- db/migrations/meta/0089_snapshot.json | 4743 ----------------------- db/migrations/meta/0090_snapshot.json | 4627 ----------------------- db/migrations/meta/0091_snapshot.json | 4627 ----------------------- db/migrations/meta/0092_snapshot.json | 4627 ----------------------- db/migrations/meta/0093_snapshot.json | 4635 ----------------------- db/migrations/meta/0094_snapshot.json | 122 +- db/migrations/meta/0095_snapshot.json | 109 +- db/migrations/meta/0096_snapshot.json | 4673 ----------------------- db/migrations/meta/0097_snapshot.json | 4743 ----------------------- db/migrations/meta/0098_snapshot.json | 4743 ----------------------- db/migrations/meta/0099_snapshot.json | 4755 ----------------------- db/migrations/meta/0100_snapshot.json | 4757 ----------------------- db/migrations/meta/0101_snapshot.json | 4757 ----------------------- db/migrations/meta/0102_snapshot.json | 4757 ----------------------- db/migrations/meta/0103_snapshot.json | 4757 ----------------------- db/migrations/meta/_journal.json | 16 +- 117 files changed, 1188 insertions(+), 299250 deletions(-) create mode 100644 db/migrations/0094_brave_sue_storm.sql create mode 100644 db/migrations/0094_fresh_blur.sql create mode 100644 db/migrations/0095_abnormal_virginia_dare.sql create mode 100644 db/migrations/0095_odd_slayback.sql delete mode 100644 db/migrations/0096_far_lord_tyger.sql delete mode 100644 db/migrations/0097_worried_cobalt_man.sql delete mode 100644 db/migrations/0098_cooing_reptil.sql delete mode 100644 db/migrations/0099_parallel_ink.sql delete mode 100644 db/migrations/0100_abandoned_moonstone.sql delete mode 100644 db/migrations/0101_past_killraven.sql delete mode 100644 db/migrations/0102_melodic_blob.sql delete mode 100644 db/migrations/0103_huge_wallflower.sql delete mode 100644 db/migrations/meta/0000_snapshot.json delete mode 100644 db/migrations/meta/0001_snapshot.json delete mode 100644 db/migrations/meta/0002_snapshot.json delete mode 100644 db/migrations/meta/0003_snapshot.json delete mode 100644 db/migrations/meta/0004_snapshot.json delete mode 100644 db/migrations/meta/0005_snapshot.json delete mode 100644 db/migrations/meta/0006_snapshot.json delete mode 100644 db/migrations/meta/0007_snapshot.json delete mode 100644 db/migrations/meta/0008_snapshot.json delete mode 100644 db/migrations/meta/0009_snapshot.json delete mode 100644 db/migrations/meta/0010_snapshot.json delete mode 100644 db/migrations/meta/0011_snapshot.json delete mode 100644 db/migrations/meta/0012_snapshot.json delete mode 100644 db/migrations/meta/0013_snapshot.json delete mode 100644 db/migrations/meta/0014_snapshot.json delete mode 100644 db/migrations/meta/0015_snapshot.json delete mode 100644 db/migrations/meta/0016_snapshot.json delete mode 100644 db/migrations/meta/0017_snapshot.json delete mode 100644 db/migrations/meta/0018_snapshot.json delete mode 100644 db/migrations/meta/0019_snapshot.json delete mode 100644 db/migrations/meta/0020_snapshot.json delete mode 100644 db/migrations/meta/0021_snapshot.json delete mode 100644 db/migrations/meta/0022_snapshot.json delete mode 100644 db/migrations/meta/0023_snapshot.json delete mode 100644 db/migrations/meta/0024_snapshot.json delete mode 100644 db/migrations/meta/0025_snapshot.json delete mode 100644 db/migrations/meta/0026_snapshot.json delete mode 100644 db/migrations/meta/0027_snapshot.json delete mode 100644 db/migrations/meta/0028_snapshot.json delete mode 100644 db/migrations/meta/0029_snapshot.json delete mode 100644 db/migrations/meta/0030_snapshot.json delete mode 100644 db/migrations/meta/0031_snapshot.json delete mode 100644 db/migrations/meta/0032_snapshot.json delete mode 100644 db/migrations/meta/0033_snapshot.json delete mode 100644 db/migrations/meta/0034_snapshot.json delete mode 100644 db/migrations/meta/0035_snapshot.json delete mode 100644 db/migrations/meta/0036_snapshot.json delete mode 100644 db/migrations/meta/0037_snapshot.json delete mode 100644 db/migrations/meta/0038_snapshot.json delete mode 100644 db/migrations/meta/0039_snapshot.json delete mode 100644 db/migrations/meta/0040_snapshot.json delete mode 100644 db/migrations/meta/0041_snapshot.json delete mode 100644 db/migrations/meta/0042_snapshot.json delete mode 100644 db/migrations/meta/0043_snapshot.json delete mode 100644 db/migrations/meta/0044_snapshot.json delete mode 100644 db/migrations/meta/0045_snapshot.json delete mode 100644 db/migrations/meta/0046_snapshot.json delete mode 100644 db/migrations/meta/0047_snapshot.json delete mode 100644 db/migrations/meta/0048_snapshot.json delete mode 100644 db/migrations/meta/0049_snapshot.json delete mode 100644 db/migrations/meta/0050_snapshot.json delete mode 100644 db/migrations/meta/0051_snapshot.json delete mode 100644 db/migrations/meta/0052_snapshot.json delete mode 100644 db/migrations/meta/0053_snapshot.json delete mode 100644 db/migrations/meta/0054_snapshot.json delete mode 100644 db/migrations/meta/0055_snapshot.json delete mode 100644 db/migrations/meta/0056_snapshot.json delete mode 100644 db/migrations/meta/0057_snapshot.json delete mode 100644 db/migrations/meta/0058_snapshot.json delete mode 100644 db/migrations/meta/0059_snapshot.json delete mode 100644 db/migrations/meta/0060_snapshot.json delete mode 100644 db/migrations/meta/0061_snapshot.json delete mode 100644 db/migrations/meta/0062_snapshot.json delete mode 100644 db/migrations/meta/0063_snapshot.json delete mode 100644 db/migrations/meta/0064_snapshot.json delete mode 100644 db/migrations/meta/0065_snapshot.json delete mode 100644 db/migrations/meta/0066_snapshot.json delete mode 100644 db/migrations/meta/0067_snapshot.json delete mode 100644 db/migrations/meta/0068_snapshot.json delete mode 100644 db/migrations/meta/0069_snapshot.json delete mode 100644 db/migrations/meta/0070_snapshot.json delete mode 100644 db/migrations/meta/0071_snapshot.json delete mode 100644 db/migrations/meta/0072_snapshot.json delete mode 100644 db/migrations/meta/0073_snapshot.json delete mode 100644 db/migrations/meta/0074_snapshot.json delete mode 100644 db/migrations/meta/0075_snapshot.json delete mode 100644 db/migrations/meta/0076_snapshot.json delete mode 100644 db/migrations/meta/0077_snapshot.json delete mode 100644 db/migrations/meta/0078_snapshot.json delete mode 100644 db/migrations/meta/0079_snapshot.json delete mode 100644 db/migrations/meta/0080_snapshot.json delete mode 100644 db/migrations/meta/0081_snapshot.json delete mode 100644 db/migrations/meta/0082_snapshot.json delete mode 100644 db/migrations/meta/0083_snapshot.json delete mode 100644 db/migrations/meta/0084_snapshot.json delete mode 100644 db/migrations/meta/0085_snapshot.json delete mode 100644 db/migrations/meta/0086_snapshot.json delete mode 100644 db/migrations/meta/0087_snapshot.json delete mode 100644 db/migrations/meta/0088_snapshot.json delete mode 100644 db/migrations/meta/0089_snapshot.json delete mode 100644 db/migrations/meta/0090_snapshot.json delete mode 100644 db/migrations/meta/0091_snapshot.json delete mode 100644 db/migrations/meta/0092_snapshot.json delete mode 100644 db/migrations/meta/0093_snapshot.json delete mode 100644 db/migrations/meta/0096_snapshot.json delete mode 100644 db/migrations/meta/0097_snapshot.json delete mode 100644 db/migrations/meta/0098_snapshot.json delete mode 100644 db/migrations/meta/0099_snapshot.json delete mode 100644 db/migrations/meta/0100_snapshot.json delete mode 100644 db/migrations/meta/0101_snapshot.json delete mode 100644 db/migrations/meta/0102_snapshot.json delete mode 100644 db/migrations/meta/0103_snapshot.json (limited to 'db/migrations') diff --git a/db/migrations/0094_brave_sue_storm.sql b/db/migrations/0094_brave_sue_storm.sql new file mode 100644 index 00000000..bdea91f0 --- /dev/null +++ b/db/migrations/0094_brave_sue_storm.sql @@ -0,0 +1,55 @@ +DROP VIEW "public"."contracts_detail_view";--> statement-breakpoint +CREATE VIEW "public"."contracts_detail_view" AS (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 ( + SELECT 1 + FROM "contract_envelopes" + WHERE "contract_envelopes"."contract_id" = "contracts"."id" + ) as "has_signature", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ci.id, + 'itemId', ci.item_id, + 'description', ci.description, + 'quantity', ci.quantity, + 'unitPrice', ci.unit_price, + 'taxRate', ci.tax_rate, + 'taxAmount', ci.tax_amount, + 'totalLineAmount', ci.total_line_amount, + 'remark', ci.remark, + 'createdAt', ci.created_at, + 'updatedAt', ci.updated_at + ) + ) + FROM "contract_items" AS ci + WHERE ci.contract_id = "contracts"."id" + ), '[]') as "items", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ce.id, + 'envelopeId', ce.envelope_id, + 'documentId', ce.document_id, + 'envelopeStatus', ce.envelope_status, + 'fileName', ce.file_name, + 'filePath', ce.file_path, + 'createdAt', ce.created_at, + 'updatedAt', ce.updated_at, + 'signers', ( + SELECT json_agg( + json_build_object( + 'id', cs.id, + 'vendorContactId', cs.vendor_contact_id, + 'signerType', cs.signer_type, + 'signerEmail', cs.signer_email, + 'signerName', cs.signer_name, + 'signerPosition', cs.signer_position, + 'signerStatus', cs.signer_status, + 'signedAt', cs.signed_at + ) + ) + FROM "contract_signers" AS cs + WHERE cs.envelope_id = ce.id + ) + ) + ) + FROM "contract_envelopes" AS ce + WHERE ce.contract_id = "contracts"."id" + ), '[]') as "envelopes" from "contracts" left join "projects" on "contracts"."project_id" = "projects"."id" left join "vendors" on "contracts"."vendor_id" = "vendors"."id"); \ No newline at end of file diff --git a/db/migrations/0094_fresh_blur.sql b/db/migrations/0094_fresh_blur.sql new file mode 100644 index 00000000..007336d2 --- /dev/null +++ b/db/migrations/0094_fresh_blur.sql @@ -0,0 +1,783 @@ +CREATE TYPE "public"."user_domain" AS ENUM('evcp', 'partners');--> statement-breakpoint +CREATE TABLE "companies" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "companies_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" varchar(255) NOT NULL, + "taxID" integer NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "contract_envelopes" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contract_envelopes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_id" integer NOT NULL, + "envelope_id" varchar(200) NOT NULL, + "document_id" varchar(200), + "envelope_status" varchar(50), + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "contract_items" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contract_items_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_id" integer NOT NULL, + "item_id" integer NOT NULL, + "description" text, + "quantity" integer DEFAULT 1 NOT NULL, + "unit_price" numeric(10, 2), + "tax_rate" numeric(5, 2), + "tax_amount" numeric(10, 2), + "total_line_amount" numeric(12, 2), + "remark" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "contract_items_contract_id_item_id_unique" UNIQUE("contract_id","item_id") +); +--> statement-breakpoint +CREATE TABLE "contract_signers" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contract_signers_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "envelope_id" integer NOT NULL, + "vendor_contact_id" integer, + "signer_type" varchar(20) DEFAULT 'VENDOR' NOT NULL, + "signer_email" varchar(255) NOT NULL, + "signer_name" varchar(100) NOT NULL, + "signer_position" varchar(100), + "signer_status" varchar(50) DEFAULT 'PENDING', + "signed_at" timestamp, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "contracts" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contracts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "project_id" integer NOT NULL, + "vendor_id" integer NOT NULL, + "contract_no" varchar(100) NOT NULL, + "contract_name" varchar(255) NOT NULL, + "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL, + "start_date" date, + "end_date" date, + "payment_terms" text, + "delivery_terms" text, + "delivery_date" date, + "delivery_location" varchar(255), + "currency" varchar(10) DEFAULT 'KRW', + "total_amount" numeric(12, 2), + "discount" numeric(12, 2), + "tax" numeric(12, 2), + "shipping_fee" numeric(12, 2), + "net_total" numeric(12, 2), + "partial_shipping_allowed" boolean DEFAULT false, + "partial_payment_allowed" boolean DEFAULT false, + "remarks" text, + "version" integer DEFAULT 1, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "contracts_contract_no_unique" UNIQUE("contract_no") +); +--> statement-breakpoint +CREATE TABLE "items" ( + "id" serial PRIMARY KEY NOT NULL, + "item_code" varchar(100), + "item_name" varchar(255) NOT NULL, + "description" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "items_item_code_unique" UNIQUE("item_code") +); +--> statement-breakpoint +CREATE TABLE "pq_criterias" ( + "id" serial PRIMARY KEY NOT NULL, + "code" varchar(50) NOT NULL, + "check_point" varchar(255) NOT NULL, + "description" text, + "remarks" text, + "group_name" varchar(255), + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_criteria_attachments" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_criteria_answer_id" integer NOT NULL, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "file_type" varchar(50), + "file_size" integer, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_pq_criteria_answers" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_id" integer NOT NULL, + "criteria_id" integer NOT NULL, + "answer" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_pq_review_logs" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_pq_criteria_answer_id" integer NOT NULL, + "reviewer_comment" text NOT NULL, + "reviewer_name" text, + "created_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "projects" ( + "id" serial PRIMARY KEY NOT NULL, + "code" varchar(50) NOT NULL, + "name" text NOT NULL, + "type" varchar(20) DEFAULT 'ship' NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "cbe_evaluations" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "vendor_id" integer NOT NULL, + "evaluated_by" integer, + "evaluated_at" timestamp DEFAULT now() NOT NULL, + "result" varchar(50), + "total_cost" numeric(18, 2), + "currency" varchar(10) DEFAULT 'USD', + "payment_terms" varchar(255), + "incoterms" varchar(50), + "delivery_schedule" text, + "notes" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "rfq_attachments" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer, + "vendor_id" integer, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "evaluation_id" integer, + "cbe_id" integer, + "created_at" timestamp DEFAULT now() NOT NULL, + "comment_id" integer +); +--> statement-breakpoint +CREATE TABLE "rfq_comments" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer, + "vendor_id" integer, + "comment_text" text NOT NULL, + "commented_by" integer NOT NULL, + "evaluation_id" integer, + "cbe_id" integer, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "rfq_evaluations" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "vendor_id" integer NOT NULL, + "eval_type" varchar(30), + "result" varchar(255), + "notes" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "rfq_items" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "item_code" varchar(100) NOT NULL, + "description" text, + "quantity" numeric(12, 2) DEFAULT 1, + "uom" varchar(50), + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "rfqs" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_code" varchar(50), + "project_id" integer, + "description" varchar(255), + "due_date" date NOT NULL, + "status" varchar(30) DEFAULT 'DRAFT' NOT NULL, + "rfq_type" varchar(30) DEFAULT 'PURCHASE', + "parent_rfq_id" integer, + "created_by" integer NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "rfqs_rfq_code_unique" UNIQUE("rfq_code") +); +--> statement-breakpoint +CREATE TABLE "vendor_commercial_responses" ( + "id" serial PRIMARY KEY NOT NULL, + "response_id" integer NOT NULL, + "total_price" numeric(18, 2), + "currency" varchar(10) DEFAULT 'USD', + "payment_terms" varchar(255), + "incoterms" varchar(50), + "delivery_period" varchar(100), + "warranty_period" varchar(100), + "validity_period" varchar(100), + "price_breakdown" text, + "commercial_notes" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_response_attachments" ( + "id" serial PRIMARY KEY NOT NULL, + "response_id" integer, + "technical_response_id" integer, + "commercial_response_id" integer, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "file_type" varchar(50), + "attachment_type" varchar(50), + "description" varchar(255), + "uploaded_at" timestamp DEFAULT now() NOT NULL, + "uploaded_by" varchar(255) +); +--> statement-breakpoint +CREATE TABLE "vendor_responses" ( + "id" serial PRIMARY KEY NOT NULL, + "rfq_id" integer NOT NULL, + "vendor_id" integer NOT NULL, + "response_status" varchar(30) DEFAULT 'REVIEWING' NOT NULL, + "notes" text, + "responded_by" varchar(255), + "responded_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_technical_responses" ( + "id" serial PRIMARY KEY NOT NULL, + "response_id" integer NOT NULL, + "summary" text, + "notes" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tasks" ( + "id" varchar(30) PRIMARY KEY NOT NULL, + "code" varchar(128) DEFAULT concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000')) NOT NULL, + "title" varchar(128), + "status" varchar(30) DEFAULT 'todo' NOT NULL, + "label" varchar(30) DEFAULT 'bug' NOT NULL, + "priority" varchar(30) DEFAULT 'low' NOT NULL, + "archived" boolean DEFAULT false NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT current_timestamp, + CONSTRAINT "tasks_code_unique" UNIQUE("code") +); +--> statement-breakpoint +CREATE TABLE "otps" ( + "email" varchar(256) PRIMARY KEY NOT NULL, + "code" varchar(6) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "otpToken" varchar(512) NOT NULL, + "otp_expires" timestamp NOT NULL +); +--> statement-breakpoint +CREATE TABLE "permissions" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "permissions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "permission_key" text NOT NULL, + "description" text, + "created_at" timestamp DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE "role_permissions" ( + "role_id" integer NOT NULL, + "permission_id" integer NOT NULL +); +--> statement-breakpoint +CREATE TABLE "roles" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "roles_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" text NOT NULL, + "domain" "user_domain" NOT NULL, + "company_id" integer, + "description" text DEFAULT '' NOT NULL, + "created_at" timestamp DEFAULT now() +); +--> statement-breakpoint +CREATE TABLE "user_roles" ( + "user_id" integer NOT NULL, + "role_id" integer NOT NULL +); +--> statement-breakpoint +CREATE TABLE "users" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "users_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "name" varchar(255) NOT NULL, + "email" varchar(255) NOT NULL, + "company_id" integer, + "domain" "user_domain" DEFAULT 'partners' NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "image_url" varchar(1024), + CONSTRAINT "users_email_unique" UNIQUE("email") +); +--> statement-breakpoint +CREATE TABLE "form_entries" ( + "id" serial PRIMARY KEY NOT NULL, + "form_code" varchar(50) NOT NULL, + "data" jsonb NOT NULL, + "contract_item_id" integer NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "form_metas" ( + "id" serial PRIMARY KEY NOT NULL, + "form_code" varchar(50) NOT NULL, + "form_name" varchar(255) NOT NULL, + "columns" jsonb NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "forms" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "forms_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_item_id" integer NOT NULL, + "form_code" varchar(100) NOT NULL, + "form_name" varchar(255) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "form_templates" ( + "id" serial PRIMARY KEY NOT NULL, + "form_id" integer, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tag_classes" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "tag_classes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "code" varchar(100) NOT NULL, + "label" text NOT NULL, + "tag_type_code" varchar(50) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tag_subfield_options" ( + "id" serial PRIMARY KEY NOT NULL, + "attributes_id" varchar(50) NOT NULL, + "code" varchar(50) NOT NULL, + "label" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tag_subfields" ( + "id" serial PRIMARY KEY NOT NULL, + "tag_type_code" varchar(50) NOT NULL, + "attributes_id" varchar(50) NOT NULL, + "attributes_description" text NOT NULL, + "expression" text, + "delimiter" varchar(10), + "sort_order" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL, + CONSTRAINT "uniq_tag_type_attribute" UNIQUE("tag_type_code","attributes_id") +); +--> statement-breakpoint +CREATE TABLE "tag_type_class_form_mappings" ( + "id" serial PRIMARY KEY NOT NULL, + "tag_type_label" varchar(255) NOT NULL, + "class_label" varchar(255) NOT NULL, + "form_code" varchar(50) NOT NULL, + "form_name" varchar(255) NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tag_types" ( + "code" varchar(50) PRIMARY KEY NOT NULL, + "description" text NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "tags" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "tags_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_item_id" integer NOT NULL, + "form_id" integer, + "tag_no" varchar(100) NOT NULL, + "tag_type" varchar(50) NOT NULL, + "class" varchar(100) NOT NULL, + "description" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_data_report_temps" ( + "id" serial PRIMARY KEY NOT NULL, + "contract_item_id" integer NOT NULL, + "form_id" integer NOT NULL, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "created_at" timestamp with time zone DEFAULT now() NOT NULL, + "updated_at" timestamp with time zone DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "view_tag_subfields" ( + "id" integer PRIMARY KEY NOT NULL, + "tag_type_code" varchar(50) NOT NULL, + "tag_type_description" text, + "attributes_id" varchar(50) NOT NULL, + "attributes_description" text NOT NULL, + "expression" text, + "delimiter" varchar(10), + "sort_order" integer DEFAULT 0 NOT NULL, + "created_at" timestamp with time zone, + "updated_at" timestamp with time zone +); +--> statement-breakpoint +CREATE TABLE "document_attachments" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "document_attachments_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "revision_id" integer NOT NULL, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "file_type" varchar(50), + "file_size" integer, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "documents" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "documents_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_id" integer NOT NULL, + "doc_number" varchar(100) NOT NULL, + "title" varchar(255) NOT NULL, + "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL, + "issued_date" date, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "issue_stages" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "issue_stages_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "document_id" integer NOT NULL, + "stage_name" varchar(100) NOT NULL, + "plan_date" date, + "actual_date" date, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "revisions" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "revisions_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "issue_stage_id" integer NOT NULL, + "revision" varchar(50) NOT NULL, + "uploader_type" varchar(20) DEFAULT 'vendor' NOT NULL, + "uploader_id" integer, + "uploader_name" varchar(100), + "comment" varchar(500), + "status" varchar(50), + "approved_date" date, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_attachments" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_id" integer, + "file_name" varchar(255) NOT NULL, + "file_path" varchar(1024) NOT NULL, + "attachment_type" varchar(50) DEFAULT 'GENERAL', + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_contacts" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_id" integer NOT NULL, + "contact_name" varchar(255) NOT NULL, + "contact_position" varchar(100), + "contact_email" varchar(255) NOT NULL, + "contact_phone" varchar(50), + "is_primary" boolean DEFAULT false NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendor_possible_items" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_id" integer NOT NULL, + "item_code" varchar(100) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "vendors" ( + "id" serial PRIMARY KEY NOT NULL, + "vendor_name" varchar(255) NOT NULL, + "vendor_code" varchar(100), + "tax_id" varchar(100) NOT NULL, + "address" text, + "country" varchar(100), + "phone" varchar(50), + "email" varchar(255), + "website" varchar(255), + "status" varchar(30) DEFAULT 'PENDING_REVIEW' NOT NULL, + "representative_name" varchar(255), + "representative_birth" varchar(20), + "representative_email" varchar(255), + "representative_phone" varchar(50), + "corporate_registration_number" varchar(100), + "credit_agency" varchar(50), + "credit_rating" varchar(50), + "cash_flow_rating" varchar(50), + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "contract_envelopes" ADD CONSTRAINT "contract_envelopes_contract_id_contracts_id_fk" FOREIGN KEY ("contract_id") REFERENCES "public"."contracts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contract_items" ADD CONSTRAINT "contract_items_contract_id_contracts_id_fk" FOREIGN KEY ("contract_id") REFERENCES "public"."contracts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contract_signers" ADD CONSTRAINT "contract_signers_envelope_id_contract_envelopes_id_fk" FOREIGN KEY ("envelope_id") REFERENCES "public"."contract_envelopes"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contract_signers" ADD CONSTRAINT "contract_signers_vendor_contact_id_vendor_contacts_id_fk" FOREIGN KEY ("vendor_contact_id") REFERENCES "public"."vendor_contacts"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_criteria_attachments" ADD CONSTRAINT "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk" FOREIGN KEY ("vendor_criteria_answer_id") REFERENCES "public"."vendor_pq_criteria_answers"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_pq_criteria_answers" ADD CONSTRAINT "vendor_pq_criteria_answers_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_pq_criteria_answers" ADD CONSTRAINT "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk" FOREIGN KEY ("criteria_id") REFERENCES "public"."pq_criterias"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_pq_review_logs" ADD CONSTRAINT "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk" FOREIGN KEY ("vendor_pq_criteria_answer_id") REFERENCES "public"."vendor_pq_criteria_answers"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "cbe_evaluations" ADD CONSTRAINT "cbe_evaluations_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "cbe_evaluations" ADD CONSTRAINT "cbe_evaluations_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "cbe_evaluations" ADD CONSTRAINT "cbe_evaluations_evaluated_by_users_id_fk" FOREIGN KEY ("evaluated_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_evaluation_id_rfq_evaluations_id_fk" FOREIGN KEY ("evaluation_id") REFERENCES "public"."rfq_evaluations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_cbe_id_cbe_evaluations_id_fk" FOREIGN KEY ("cbe_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_comment_id_rfq_comments_id_fk" FOREIGN KEY ("comment_id") REFERENCES "public"."rfq_comments"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_commented_by_users_id_fk" FOREIGN KEY ("commented_by") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_evaluation_id_rfq_evaluations_id_fk" FOREIGN KEY ("evaluation_id") REFERENCES "public"."rfq_evaluations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_cbe_id_cbe_evaluations_id_fk" FOREIGN KEY ("cbe_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_evaluations" ADD CONSTRAINT "rfq_evaluations_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_evaluations" ADD CONSTRAINT "rfq_evaluations_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_items" ADD CONSTRAINT "rfq_items_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfq_items" ADD CONSTRAINT "rfq_items_item_code_items_item_code_fk" FOREIGN KEY ("item_code") REFERENCES "public"."items"("item_code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfqs" ADD CONSTRAINT "rfqs_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfqs" ADD CONSTRAINT "rfqs_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "rfqs" ADD CONSTRAINT "rfqs_parent_rfq_id_rfqs_id_fk" FOREIGN KEY ("parent_rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_commercial_responses" ADD CONSTRAINT "vendor_commercial_responses_response_id_vendor_responses_id_fk" FOREIGN KEY ("response_id") REFERENCES "public"."vendor_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_attachments" ADD CONSTRAINT "vendor_response_attachments_response_id_vendor_responses_id_fk" FOREIGN KEY ("response_id") REFERENCES "public"."vendor_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_attachments" ADD CONSTRAINT "vendor_response_attachments_technical_response_id_vendor_technical_responses_id_fk" FOREIGN KEY ("technical_response_id") REFERENCES "public"."vendor_technical_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_response_attachments" ADD CONSTRAINT "vendor_response_attachments_commercial_response_id_vendor_commercial_responses_id_fk" FOREIGN KEY ("commercial_response_id") REFERENCES "public"."vendor_commercial_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_responses" ADD CONSTRAINT "vendor_responses_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_responses" ADD CONSTRAINT "vendor_responses_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_technical_responses" ADD CONSTRAINT "vendor_technical_responses_response_id_vendor_responses_id_fk" FOREIGN KEY ("response_id") REFERENCES "public"."vendor_responses"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_role_id_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."roles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "role_permissions" ADD CONSTRAINT "role_permissions_permission_id_permissions_id_fk" FOREIGN KEY ("permission_id") REFERENCES "public"."permissions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "roles" ADD CONSTRAINT "roles_company_id_vendors_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_role_id_roles_id_fk" FOREIGN KEY ("role_id") REFERENCES "public"."roles"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "users" ADD CONSTRAINT "users_company_id_vendors_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."vendors"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "form_entries" ADD CONSTRAINT "form_entries_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "forms" ADD CONSTRAINT "forms_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "form_templates" ADD CONSTRAINT "form_templates_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tag_classes" ADD CONSTRAINT "tag_classes_tag_type_code_tag_types_code_fk" FOREIGN KEY ("tag_type_code") REFERENCES "public"."tag_types"("code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tag_subfield_options" ADD CONSTRAINT "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk" FOREIGN KEY ("attributes_id") REFERENCES "public"."tag_subfields"("attributes_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tag_subfields" ADD CONSTRAINT "tag_subfields_tag_type_code_tag_types_code_fk" FOREIGN KEY ("tag_type_code") REFERENCES "public"."tag_types"("code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tags" ADD CONSTRAINT "tags_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tags" ADD CONSTRAINT "tags_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "document_attachments" ADD CONSTRAINT "document_attachments_revision_id_revisions_id_fk" FOREIGN KEY ("revision_id") REFERENCES "public"."revisions"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "documents" ADD CONSTRAINT "documents_contract_id_contracts_id_fk" FOREIGN KEY ("contract_id") REFERENCES "public"."contracts"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "issue_stages" ADD CONSTRAINT "issue_stages_document_id_documents_id_fk" FOREIGN KEY ("document_id") REFERENCES "public"."documents"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_attachments" ADD CONSTRAINT "vendor_attachments_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_contacts" ADD CONSTRAINT "vendor_contacts_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_possible_items" ADD CONSTRAINT "vendor_possible_items_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "vendor_possible_items" ADD CONSTRAINT "vendor_possible_items_item_code_items_item_code_fk" FOREIGN KEY ("item_code") REFERENCES "public"."items"("item_code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +CREATE UNIQUE INDEX "contract_items_contract_item_idx" ON "contract_items" USING btree ("contract_id","item_id");--> statement-breakpoint +CREATE UNIQUE INDEX "vendor_response_unique" ON "vendor_responses" USING btree ("rfq_id","vendor_id");--> statement-breakpoint +CREATE UNIQUE INDEX "contract_item_form_code_unique" ON "forms" USING btree ("contract_item_id","form_code");--> statement-breakpoint +CREATE UNIQUE INDEX "unique_contract_doc_status" ON "documents" USING btree ("contract_id","doc_number","status");--> statement-breakpoint +CREATE UNIQUE INDEX "unique_document_stage" ON "issue_stages" USING btree ("document_id","stage_name");--> statement-breakpoint +CREATE UNIQUE INDEX "unique_stage_rev" ON "revisions" USING btree ("issue_stage_id","revision");--> statement-breakpoint +CREATE VIEW "public"."contracts_detail_view" AS (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 ( + SELECT 1 + FROM "contract_envelopes" + WHERE "contract_envelopes"."contract_id" = "contracts"."id" + ) as "has_signature", EXISTS ( + SELECT 1 + FROM "contract_items" + WHERE "contract_items"."contract_id" = "contracts"."id" + ) as "has_signature", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ci.id, + 'itemId', ci.item_id, + 'description', ci.description, + 'quantity', ci.quantity, + 'unitPrice', ci.unit_price, + 'taxRate', ci.tax_rate, + 'taxAmount', ci.tax_amount, + 'totalLineAmount', ci.total_line_amount, + 'remark', ci.remark, + 'createdAt', ci.created_at, + 'updatedAt', ci.updated_at + ) + ) + FROM "contract_items" AS ci + WHERE ci.contract_id = "contracts"."id" + ), '[]') as "items", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ce.id, + 'envelopeId', ce.envelope_id, + 'documentId', ce.document_id, + 'envelopeStatus', ce.envelope_status, + 'fileName', ce.file_name, + 'filePath', ce.file_path, + 'createdAt', ce.created_at, + 'updatedAt', ce.updated_at, + 'signers', ( + SELECT json_agg( + json_build_object( + 'id', cs.id, + 'vendorContactId', cs.vendor_contact_id, + 'signerType', cs.signer_type, + 'signerEmail', cs.signer_email, + 'signerName', cs.signer_name, + 'signerPosition', cs.signer_position, + 'signerStatus', cs.signer_status, + 'signedAt', cs.signed_at + ) + ) + FROM "contract_signers" AS cs + WHERE cs.envelope_id = ce.id + ) + ) + ) + FROM "contract_envelopes" AS ce + WHERE ce.contract_id = "contracts"."id" + ), '[]') as "envelopes" from "contracts" left join "projects" on "contracts"."project_id" = "projects"."id" left join "vendors" on "contracts"."vendor_id" = "vendors"."id");--> statement-breakpoint +CREATE VIEW "public"."cbe_view" AS (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");--> statement-breakpoint +CREATE VIEW "public"."rfqs_view" AS (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", ( + SELECT COUNT(*) + FROM "rfq_items" + WHERE "rfq_items"."rfq_id" = "rfqs"."id" + ) as "item_count", ( + SELECT COUNT(*) + FROM "rfq_attachments" + WHERE "rfq_attachments"."rfq_id" = "rfqs"."id" + ) as "attachment_count" from "rfqs" left join "projects" on "rfqs"."project_id" = "projects"."id" left join "users" on "rfqs"."created_by" = "users"."id");--> statement-breakpoint +CREATE VIEW "public"."vendor_cbe_view" AS (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"));--> statement-breakpoint +CREATE VIEW "public"."vendor_responses_view" AS (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", ( + SELECT COUNT(*) + FROM "vendor_response_attachments" + WHERE "vendor_response_attachments"."response_id" = "vendor_responses"."id" + ) 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"));--> statement-breakpoint +CREATE VIEW "public"."vendor_rfq_view" AS (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");--> statement-breakpoint +CREATE VIEW "public"."vendor_tbe_view" AS (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", "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 "rfq_evaluations" on ("rfq_evaluations"."vendor_id" = "vendors"."id" and "rfq_evaluations"."eval_type" = 'TBE' and "rfq_evaluations"."rfq_id" = "vendor_responses"."rfq_id"));--> statement-breakpoint +CREATE VIEW "public"."role_view" AS (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");--> statement-breakpoint +CREATE VIEW "public"."user_view" AS (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", + array_agg("roles"."name") + 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");--> statement-breakpoint +CREATE VIEW "public"."document_stages_view" AS ( + SELECT + d.id AS document_id, + d.doc_number, + d.title, + d.status, + d.issued_date, + d.contract_id, + + ( + SELECT COUNT(*) + FROM issue_stages + WHERE document_id = d.id + ) AS stage_count, + + COALESCE( + ( + SELECT json_agg(i.stage_name) + FROM issue_stages i + WHERE i.document_id = d.id + ), + '[]' + ) AS stage_list, + + d.created_at, + d.updated_at + FROM documents d +);--> statement-breakpoint +CREATE VIEW "public"."vendor_documents_view" AS ( + SELECT + d.id, + d.doc_number, + d.title, + d.status, + d.issued_date, + + d.contract_id, + + ( + SELECT id FROM issue_stages + WHERE document_id = d.id + ORDER BY created_at DESC LIMIT 1 + ) AS latest_stage_id, + ( + SELECT stage_name FROM issue_stages + WHERE document_id = d.id + ORDER BY created_at DESC LIMIT 1 + ) AS latest_stage_name, + ( + SELECT plan_date FROM issue_stages + WHERE document_id = d.id + ORDER BY created_at DESC LIMIT 1 + ) AS latest_stage_plan_date, + ( + SELECT actual_date FROM issue_stages + WHERE document_id = d.id + ORDER BY created_at DESC LIMIT 1 + ) AS latest_stage_actual_date, + + ( + SELECT r.id FROM revisions r + JOIN issue_stages i ON r.issue_stage_id = i.id + WHERE i.document_id = d.id + ORDER BY r.created_at DESC LIMIT 1 + ) AS latest_revision_id, + ( + SELECT r.revision FROM revisions r + JOIN issue_stages i ON r.issue_stage_id = i.id + WHERE i.document_id = d.id + ORDER BY r.created_at DESC LIMIT 1 + ) AS latest_revision, + ( + SELECT r.uploader_type FROM revisions r + JOIN issue_stages i ON r.issue_stage_id = i.id + WHERE i.document_id = d.id + ORDER BY r.created_at DESC LIMIT 1 + ) AS latest_revision_uploader_type, + ( + SELECT r.uploader_name FROM revisions r + JOIN issue_stages i ON r.issue_stage_id = i.id + WHERE i.document_id = d.id + ORDER BY r.created_at DESC LIMIT 1 + ) AS latest_revision_uploader_name, + + ( + SELECT COUNT(*) FROM document_attachments a + JOIN revisions r ON a.revision_id = r.id + JOIN issue_stages i ON r.issue_stage_id = i.id + WHERE i.document_id = d.id + ) AS attachment_count, + + d.created_at, + d.updated_at + FROM documents d + JOIN contracts c ON d.contract_id = c.id + );--> statement-breakpoint +CREATE VIEW "public"."vendor_items_view" AS (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"); \ No newline at end of file diff --git a/db/migrations/0095_abnormal_virginia_dare.sql b/db/migrations/0095_abnormal_virginia_dare.sql new file mode 100644 index 00000000..bdea91f0 --- /dev/null +++ b/db/migrations/0095_abnormal_virginia_dare.sql @@ -0,0 +1,55 @@ +DROP VIEW "public"."contracts_detail_view";--> statement-breakpoint +CREATE VIEW "public"."contracts_detail_view" AS (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 ( + SELECT 1 + FROM "contract_envelopes" + WHERE "contract_envelopes"."contract_id" = "contracts"."id" + ) as "has_signature", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ci.id, + 'itemId', ci.item_id, + 'description', ci.description, + 'quantity', ci.quantity, + 'unitPrice', ci.unit_price, + 'taxRate', ci.tax_rate, + 'taxAmount', ci.tax_amount, + 'totalLineAmount', ci.total_line_amount, + 'remark', ci.remark, + 'createdAt', ci.created_at, + 'updatedAt', ci.updated_at + ) + ) + FROM "contract_items" AS ci + WHERE ci.contract_id = "contracts"."id" + ), '[]') as "items", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ce.id, + 'envelopeId', ce.envelope_id, + 'documentId', ce.document_id, + 'envelopeStatus', ce.envelope_status, + 'fileName', ce.file_name, + 'filePath', ce.file_path, + 'createdAt', ce.created_at, + 'updatedAt', ce.updated_at, + 'signers', ( + SELECT json_agg( + json_build_object( + 'id', cs.id, + 'vendorContactId', cs.vendor_contact_id, + 'signerType', cs.signer_type, + 'signerEmail', cs.signer_email, + 'signerName', cs.signer_name, + 'signerPosition', cs.signer_position, + 'signerStatus', cs.signer_status, + 'signedAt', cs.signed_at + ) + ) + FROM "contract_signers" AS cs + WHERE cs.envelope_id = ce.id + ) + ) + ) + FROM "contract_envelopes" AS ce + WHERE ce.contract_id = "contracts"."id" + ), '[]') as "envelopes" from "contracts" left join "projects" on "contracts"."project_id" = "projects"."id" left join "vendors" on "contracts"."vendor_id" = "vendors"."id"); \ No newline at end of file diff --git a/db/migrations/0095_odd_slayback.sql b/db/migrations/0095_odd_slayback.sql new file mode 100644 index 00000000..bdea91f0 --- /dev/null +++ b/db/migrations/0095_odd_slayback.sql @@ -0,0 +1,55 @@ +DROP VIEW "public"."contracts_detail_view";--> statement-breakpoint +CREATE VIEW "public"."contracts_detail_view" AS (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 ( + SELECT 1 + FROM "contract_envelopes" + WHERE "contract_envelopes"."contract_id" = "contracts"."id" + ) as "has_signature", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ci.id, + 'itemId', ci.item_id, + 'description', ci.description, + 'quantity', ci.quantity, + 'unitPrice', ci.unit_price, + 'taxRate', ci.tax_rate, + 'taxAmount', ci.tax_amount, + 'totalLineAmount', ci.total_line_amount, + 'remark', ci.remark, + 'createdAt', ci.created_at, + 'updatedAt', ci.updated_at + ) + ) + FROM "contract_items" AS ci + WHERE ci.contract_id = "contracts"."id" + ), '[]') as "items", COALESCE(( + SELECT json_agg( + json_build_object( + 'id', ce.id, + 'envelopeId', ce.envelope_id, + 'documentId', ce.document_id, + 'envelopeStatus', ce.envelope_status, + 'fileName', ce.file_name, + 'filePath', ce.file_path, + 'createdAt', ce.created_at, + 'updatedAt', ce.updated_at, + 'signers', ( + SELECT json_agg( + json_build_object( + 'id', cs.id, + 'vendorContactId', cs.vendor_contact_id, + 'signerType', cs.signer_type, + 'signerEmail', cs.signer_email, + 'signerName', cs.signer_name, + 'signerPosition', cs.signer_position, + 'signerStatus', cs.signer_status, + 'signedAt', cs.signed_at + ) + ) + FROM "contract_signers" AS cs + WHERE cs.envelope_id = ce.id + ) + ) + ) + FROM "contract_envelopes" AS ce + WHERE ce.contract_id = "contracts"."id" + ), '[]') as "envelopes" from "contracts" left join "projects" on "contracts"."project_id" = "projects"."id" left join "vendors" on "contracts"."vendor_id" = "vendors"."id"); \ No newline at end of file diff --git a/db/migrations/0096_far_lord_tyger.sql b/db/migrations/0096_far_lord_tyger.sql deleted file mode 100644 index 36f842b5..00000000 --- a/db/migrations/0096_far_lord_tyger.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "rfq_attachments" ADD COLUMN "cbe_id" integer;--> statement-breakpoint -ALTER TABLE "rfq_attachments" ADD CONSTRAINT "rfq_attachments_cbe_id_cbe_evaluations_id_fk" FOREIGN KEY ("cbe_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE no action ON UPDATE no action; \ No newline at end of file diff --git a/db/migrations/0097_worried_cobalt_man.sql b/db/migrations/0097_worried_cobalt_man.sql deleted file mode 100644 index e8a472d1..00000000 --- a/db/migrations/0097_worried_cobalt_man.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE "vendor_data_report_temps" ( - "id" integer PRIMARY KEY NOT NULL, - "contract_item_id" integer NOT NULL, - "form_code" integer NOT NULL, - "file_name" varchar(255) NOT NULL, - "file_path" varchar(1024) NOT NULL -); ---> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_form_code_forms_form_code_fk" FOREIGN KEY ("form_code") REFERENCES "public"."forms"("form_code") ON DELETE cascade ON UPDATE no action; \ No newline at end of file diff --git a/db/migrations/0098_cooing_reptil.sql b/db/migrations/0098_cooing_reptil.sql deleted file mode 100644 index 74022356..00000000 --- a/db/migrations/0098_cooing_reptil.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "vendor_data_report_temps" DROP CONSTRAINT "vendor_data_report_temps_form_code_forms_form_code_fk"; ---> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD COLUMN "formId" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_formId_forms_id_fk" FOREIGN KEY ("formId") REFERENCES "public"."forms"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" DROP COLUMN "form_code"; \ No newline at end of file diff --git a/db/migrations/0099_parallel_ink.sql b/db/migrations/0099_parallel_ink.sql deleted file mode 100644 index 959cf147..00000000 --- a/db/migrations/0099_parallel_ink.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "vendor_data_report_temps" ADD COLUMN "created_at" timestamp with time zone;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD COLUMN "updated_at" timestamp with time zone; \ No newline at end of file diff --git a/db/migrations/0100_abandoned_moonstone.sql b/db/migrations/0100_abandoned_moonstone.sql deleted file mode 100644 index 6ae94728..00000000 --- a/db/migrations/0100_abandoned_moonstone.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "vendor_data_report_temps" ALTER COLUMN "created_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ALTER COLUMN "created_at" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ALTER COLUMN "updated_at" SET DEFAULT now();--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ALTER COLUMN "updated_at" SET NOT NULL; \ No newline at end of file diff --git a/db/migrations/0101_past_killraven.sql b/db/migrations/0101_past_killraven.sql deleted file mode 100644 index afb8370c..00000000 --- a/db/migrations/0101_past_killraven.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "vendor_data_report_temps" DROP CONSTRAINT "vendor_data_report_temps_formId_forms_id_fk"; ---> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD COLUMN "form_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" ADD CONSTRAINT "vendor_data_report_temps_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "vendor_data_report_temps" DROP COLUMN "formId"; \ No newline at end of file diff --git a/db/migrations/0102_melodic_blob.sql b/db/migrations/0102_melodic_blob.sql deleted file mode 100644 index e0dbfd7b..00000000 --- a/db/migrations/0102_melodic_blob.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "vendor_data_report_temps" ALTER COLUMN "id" SET DATA TYPE serial; \ No newline at end of file diff --git a/db/migrations/0103_huge_wallflower.sql b/db/migrations/0103_huge_wallflower.sql deleted file mode 100644 index b108d28f..00000000 --- a/db/migrations/0103_huge_wallflower.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP VIEW "public"."contracts_detail_view";--> statement-breakpoint -CREATE VIEW "public"."contracts_detail_view" AS (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 ( - SELECT 1 - FROM "contract_envelopes" - WHERE "contract_envelopes"."contract_id" = "contracts"."id" - ) as "has_signature", COALESCE(( - SELECT json_agg( - json_build_object( - 'id', ce.id, - 'envelopeId', ce.envelope_id, - 'documentId', ce.document_id, - 'envelopeStatus', ce.envelope_status, - 'fileName', ce.file_name, - 'filePath', ce.file_path, - 'createdAt', ce.created_at, - 'updatedAt', ce.updated_at, - 'signers', ( - SELECT json_agg( - json_build_object( - 'id', cs.id, - 'vendorContactId', cs.vendor_contact_id, - 'signerType', cs.signer_type, - 'signerEmail', cs.signer_email, - 'signerName', cs.signer_name, - 'signerPosition', cs.signer_position, - 'signerStatus', cs.signer_status, - 'signedAt', cs.signed_at - ) - ) - FROM "contract_signers" AS cs - WHERE cs.envelope_id = ce.id - ) - ) - ) - FROM "contract_envelopes" AS ce - WHERE ce.contract_id = "contracts"."id" - ), '[]') as "envelopes" from "contracts" left join "projects" on "contracts"."project_id" = "projects"."id" left join "vendors" on "contracts"."vendor_id" = "vendors"."id"); \ No newline at end of file diff --git a/db/migrations/meta/0000_snapshot.json b/db/migrations/meta/0000_snapshot.json deleted file mode 100644 index d8cf3fa7..00000000 --- a/db/migrations/meta/0000_snapshot.json +++ /dev/null @@ -1,360 +0,0 @@ -{ - "id": "a938bbb2-b064-4689-8011-35f19f0cad0d", - "prevId": "00000000-0000-0000-0000-000000000000", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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.user_roles": { - "name": "user_roles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "user_roles_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "role": { - "name": "role", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'normal'" - } - }, - "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": "no action", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "public.user_view": { - "columns": {}, - "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"image_url\" as \"user_image\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"user_roles\".\"role\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"id\" left join \"user_roles\" on \"users\".\"id\" = \"user_roles\".\"user_id\" group by \"users\".\"id\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0001_snapshot.json b/db/migrations/meta/0001_snapshot.json deleted file mode 100644 index e4674195..00000000 --- a/db/migrations/meta/0001_snapshot.json +++ /dev/null @@ -1,499 +0,0 @@ -{ - "id": "fb2ad699-a8d7-4ce4-8c53-37296c014aab", - "prevId": "a938bbb2-b064-4689-8011-35f19f0cad0d", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "public.user_view": { - "columns": {}, - "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"image_url\" as \"user_image\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0002_snapshot.json b/db/migrations/meta/0002_snapshot.json deleted file mode 100644 index 2a6c3629..00000000 --- a/db/migrations/meta/0002_snapshot.json +++ /dev/null @@ -1,506 +0,0 @@ -{ - "id": "1d900e15-c01b-4048-88bb-59a40c19d4b3", - "prevId": "fb2ad699-a8d7-4ce4-8c53-37296c014aab", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "public.user_view": { - "columns": {}, - "definition": "select \"users\".\"id\" as \"user_id\", \"users\".\"name\" as \"user_name\", \"users\".\"email\" as \"user_email\", \"users\".\"image_url\" as \"user_image\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0003_snapshot.json b/db/migrations/meta/0003_snapshot.json deleted file mode 100644 index f3d6f185..00000000 --- a/db/migrations/meta/0003_snapshot.json +++ /dev/null @@ -1,513 +0,0 @@ -{ - "id": "eca1c653-0a43-4d76-b22b-2d3ab42736f7", - "prevId": "1d900e15-c01b-4048-88bb-59a40c19d4b3", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - }, - "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": {}, - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0004_snapshot.json b/db/migrations/meta/0004_snapshot.json deleted file mode 100644 index c9499dd2..00000000 --- a/db/migrations/meta/0004_snapshot.json +++ /dev/null @@ -1,533 +0,0 @@ -{ - "id": "9e71a1c9-2e02-434b-a824-fb4dfddf9e3b", - "prevId": "eca1c653-0a43-4d76-b22b-2d3ab42736f7", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0005_snapshot.json b/db/migrations/meta/0005_snapshot.json deleted file mode 100644 index 3a868bbb..00000000 --- a/db/migrations/meta/0005_snapshot.json +++ /dev/null @@ -1,592 +0,0 @@ -{ - "id": "2a6afc15-42b9-4c2f-985b-824fbbe4594a", - "prevId": "9e71a1c9-2e02-434b-a824-fb4dfddf9e3b", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "public.role_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "role_view_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 - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true, - "default": "''" - }, - "domain": { - "name": "domain", - "type": "user_domain", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false, - "default": "now()" - }, - "company_id": { - "name": "company_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"roles\".\"id\", \"roles\".\"name\", \"roles\".\"description\", \"roles\".\"domain\", \"roles\".\"created_at\", \"roles\".\"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0006_snapshot.json b/db/migrations/meta/0006_snapshot.json deleted file mode 100644 index 62e97776..00000000 --- a/db/migrations/meta/0006_snapshot.json +++ /dev/null @@ -1,541 +0,0 @@ -{ - "id": "ae245d59-b684-46e9-9c8f-2d3282dfd91c", - "prevId": "2a6afc15-42b9-4c2f-985b-824fbbe4594a", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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 - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0007_snapshot.json b/db/migrations/meta/0007_snapshot.json deleted file mode 100644 index ab4a627d..00000000 --- a/db/migrations/meta/0007_snapshot.json +++ /dev/null @@ -1,772 +0,0 @@ -{ - "id": "b3f0e9ef-446a-494c-a0cc-3bf25bc207f5", - "prevId": "ae245d59-b684-46e9-9c8f-2d3282dfd91c", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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(50)", - "primaryKey": false, - "notNull": true, - "default": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0008_snapshot.json b/db/migrations/meta/0008_snapshot.json deleted file mode 100644 index fe645d31..00000000 --- a/db/migrations/meta/0008_snapshot.json +++ /dev/null @@ -1,772 +0,0 @@ -{ - "id": "73f0009f-756e-42c6-8a0e-243c9693a9e5", - "prevId": "b3f0e9ef-446a-494c-a0cc-3bf25bc207f5", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0009_snapshot.json b/db/migrations/meta/0009_snapshot.json deleted file mode 100644 index a223a4a6..00000000 --- a/db/migrations/meta/0009_snapshot.json +++ /dev/null @@ -1,778 +0,0 @@ -{ - "id": "9464b477-d88a-486b-8b78-f5ad5e8a350c", - "prevId": "73f0009f-756e-42c6-8a0e-243c9693a9e5", - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0010_snapshot.json b/db/migrations/meta/0010_snapshot.json deleted file mode 100644 index 21407e59..00000000 --- a/db/migrations/meta/0010_snapshot.json +++ /dev/null @@ -1,1442 +0,0 @@ -{ - "id": "d9c19090-73ab-46d4-a6e9-2d357461ee50", - "prevId": "9464b477-d88a-486b-8b78-f5ad5e8a350c", - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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 - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "due_date": { - "name": "due_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'DRAFT'" - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0011_snapshot.json b/db/migrations/meta/0011_snapshot.json deleted file mode 100644 index fd4bb4e9..00000000 --- a/db/migrations/meta/0011_snapshot.json +++ /dev/null @@ -1,1456 +0,0 @@ -{ - "id": "818a5680-0900-44fb-bac2-f13a26a8c896", - "prevId": "d9c19090-73ab-46d4-a6e9-2d357461ee50", - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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 - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "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": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0012_snapshot.json b/db/migrations/meta/0012_snapshot.json deleted file mode 100644 index 65a8c3cd..00000000 --- a/db/migrations/meta/0012_snapshot.json +++ /dev/null @@ -1,1456 +0,0 @@ -{ - "id": "4df387e4-9d03-4037-a229-c7940ed6b711", - "prevId": "818a5680-0900-44fb-bac2-f13a26a8c896", - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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 - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0013_snapshot.json b/db/migrations/meta/0013_snapshot.json deleted file mode 100644 index 346d3341..00000000 --- a/db/migrations/meta/0013_snapshot.json +++ /dev/null @@ -1,1462 +0,0 @@ -{ - "id": "f56a4d44-3a07-46d4-a050-24154a160876", - "prevId": "4df387e4-9d03-4037-a229-c7940ed6b711", - "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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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 - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "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()" - } - }, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0014_snapshot.json b/db/migrations/meta/0014_snapshot.json deleted file mode 100644 index fbbc2658..00000000 --- a/db/migrations/meta/0014_snapshot.json +++ /dev/null @@ -1,1527 +0,0 @@ -{ - "id": "a1e31440-2b37-4e2a-9e53-414c607cfed3", - "prevId": "f56a4d44-3a07-46d4-a050-24154a160876", - "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.items": { - "name": "items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": true, - "notNull": true - }, - "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": {}, - "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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0015_snapshot.json b/db/migrations/meta/0015_snapshot.json deleted file mode 100644 index 2385cafd..00000000 --- a/db/migrations/meta/0015_snapshot.json +++ /dev/null @@ -1,1535 +0,0 @@ -{ - "id": "2693ed7e-6c74-474c-96ee-6bff01435789", - "prevId": "a1e31440-2b37-4e2a-9e53-414c607cfed3", - "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.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.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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "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" - } - }, - "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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "indexes": {}, - "foreignKeys": { - "users_company_id_companies_id_fk": { - "name": "users_company_id_companies_id_fk", - "tableFrom": "users", - "tableTo": "companies", - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0016_snapshot.json b/db/migrations/meta/0016_snapshot.json deleted file mode 100644 index 13daee3e..00000000 --- a/db/migrations/meta/0016_snapshot.json +++ /dev/null @@ -1,1554 +0,0 @@ -{ - "id": "9505098f-2ceb-46c7-b9e1-024b2f0f95c2", - "prevId": "2693ed7e-6c74-474c-96ee-6bff01435789", - "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.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.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 - }, - "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_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 - }, - "created_at": { - "name": "created_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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0017_snapshot.json b/db/migrations/meta/0017_snapshot.json deleted file mode 100644 index bb37e483..00000000 --- a/db/migrations/meta/0017_snapshot.json +++ /dev/null @@ -1,1561 +0,0 @@ -{ - "id": "0d6a3da7-f017-44d9-a9cb-180baf0a6c3f", - "prevId": "9505098f-2ceb-46c7-b9e1-024b2f0f95c2", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0018_snapshot.json b/db/migrations/meta/0018_snapshot.json deleted file mode 100644 index 9ee22a32..00000000 --- a/db/migrations/meta/0018_snapshot.json +++ /dev/null @@ -1,1577 +0,0 @@ -{ - "id": "7fdebe39-9c22-42ec-8a86-ca8bce2b8fb5", - "prevId": "0d6a3da7-f017-44d9-a9cb-180baf0a6c3f", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0019_snapshot.json b/db/migrations/meta/0019_snapshot.json deleted file mode 100644 index 856a146f..00000000 --- a/db/migrations/meta/0019_snapshot.json +++ /dev/null @@ -1,1585 +0,0 @@ -{ - "id": "91f7753a-e79b-4d9e-80be-fbf523a00dac", - "prevId": "7fdebe39-9c22-42ec-8a86-ca8bce2b8fb5", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"rfq_evaluations\".\"result\" as \"tbe_result\", \"rfq_evaluations\".\"notes\" as \"tbe_note\", \"rfq_evaluations\".\"updated_at\" as \"tbe_updated\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0020_snapshot.json b/db/migrations/meta/0020_snapshot.json deleted file mode 100644 index 527b49e6..00000000 --- a/db/migrations/meta/0020_snapshot.json +++ /dev/null @@ -1,1585 +0,0 @@ -{ - "id": "08400eea-a59a-461a-9e16-3578dfb447a2", - "prevId": "91f7753a-e79b-4d9e-80be-fbf523a00dac", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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 - }, - "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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0021_snapshot.json b/db/migrations/meta/0021_snapshot.json deleted file mode 100644 index 4159107a..00000000 --- a/db/migrations/meta/0021_snapshot.json +++ /dev/null @@ -1,1591 +0,0 @@ -{ - "id": "27519f51-d70c-45ed-8eb5-e227a521b477", - "prevId": "08400eea-a59a-461a-9e16-3578dfb447a2", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0022_snapshot.json b/db/migrations/meta/0022_snapshot.json deleted file mode 100644 index ef1af3a6..00000000 --- a/db/migrations/meta/0022_snapshot.json +++ /dev/null @@ -1,1642 +0,0 @@ -{ - "id": "775d4b20-22a3-4972-9a87-a5dc71f45d75", - "prevId": "27519f51-d70c-45ed-8eb5-e227a521b477", - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0023_snapshot.json b/db/migrations/meta/0023_snapshot.json deleted file mode 100644 index 687ac7da..00000000 --- a/db/migrations/meta/0023_snapshot.json +++ /dev/null @@ -1,2046 +0,0 @@ -{ - "id": "29b171f4-2f97-41ca-8084-6067243a0706", - "prevId": "775d4b20-22a3-4972-9a87-a5dc71f45d75", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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_item_id_unique": { - "name": "contract_items_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "item_id" - ] - } - }, - "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 - } - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "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 - }, - "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_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.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 - } - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0024_snapshot.json b/db/migrations/meta/0024_snapshot.json deleted file mode 100644 index 07664ac0..00000000 --- a/db/migrations/meta/0024_snapshot.json +++ /dev/null @@ -1,2062 +0,0 @@ -{ - "id": "64998b6a-6d72-4267-83fd-dfe80fdec906", - "prevId": "29b171f4-2f97-41ca-8084-6067243a0706", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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_item_id_unique": { - "name": "contract_items_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "item_id" - ] - }, - "contract_items_contract_id_item_id_unique": { - "name": "contract_items_contract_id_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - } - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "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 - }, - "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_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.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 - } - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0025_snapshot.json b/db/migrations/meta/0025_snapshot.json deleted file mode 100644 index fd7c397d..00000000 --- a/db/migrations/meta/0025_snapshot.json +++ /dev/null @@ -1,2055 +0,0 @@ -{ - "id": "92511db1-55e1-43d7-b4a0-b20ef4544fd7", - "prevId": "64998b6a-6d72-4267-83fd-dfe80fdec906", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - } - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "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 - }, - "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_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.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 - } - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0026_snapshot.json b/db/migrations/meta/0026_snapshot.json deleted file mode 100644 index fa18083e..00000000 --- a/db/migrations/meta/0026_snapshot.json +++ /dev/null @@ -1,2074 +0,0 @@ -{ - "id": "a33b6d50-5e1a-4077-828d-e0bacb8ae7d9", - "prevId": "92511db1-55e1-43d7-b4a0-b20ef4544fd7", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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 - }, - "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.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 - } - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0027_snapshot.json b/db/migrations/meta/0027_snapshot.json deleted file mode 100644 index 808f7a95..00000000 --- a/db/migrations/meta/0027_snapshot.json +++ /dev/null @@ -1,2080 +0,0 @@ -{ - "id": "5396307b-0762-41f0-b2ca-4bb426d73e4f", - "prevId": "a33b6d50-5e1a-4077-828d-e0bacb8ae7d9", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - } - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0028_snapshot.json b/db/migrations/meta/0028_snapshot.json deleted file mode 100644 index 75b10eaf..00000000 --- a/db/migrations/meta/0028_snapshot.json +++ /dev/null @@ -1,2100 +0,0 @@ -{ - "id": "3ce9d5d4-04e3-46cd-8434-385ee993c578", - "prevId": "5396307b-0762-41f0-b2ca-4bb426d73e4f", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "tag_type": { - "name": "tag_type", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "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" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0029_snapshot.json b/db/migrations/meta/0029_snapshot.json deleted file mode 100644 index 33dc586c..00000000 --- a/db/migrations/meta/0029_snapshot.json +++ /dev/null @@ -1,2119 +0,0 @@ -{ - "id": "f45a52fe-be48-4041-b66f-359e7b8d2c94", - "prevId": "3ce9d5d4-04e3-46cd-8434-385ee993c578", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "tag_type": { - "name": "tag_type", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0030_snapshot.json b/db/migrations/meta/0030_snapshot.json deleted file mode 100644 index b2e06c75..00000000 --- a/db/migrations/meta/0030_snapshot.json +++ /dev/null @@ -1,2215 +0,0 @@ -{ - "id": "a6af176b-3fbf-4de4-9c52-a5e94cfcae36", - "prevId": "f45a52fe-be48-4041-b66f-359e7b8d2c94", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.form_metas": { - "name": "form_metas", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - }, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0031_snapshot.json b/db/migrations/meta/0031_snapshot.json deleted file mode 100644 index 42bab5db..00000000 --- a/db/migrations/meta/0031_snapshot.json +++ /dev/null @@ -1,2221 +0,0 @@ -{ - "id": "c5a632c9-520d-4511-b16c-ebc45dcd4d8c", - "prevId": "a6af176b-3fbf-4de4-9c52-a5e94cfcae36", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.form_metas": { - "name": "form_metas", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0032_snapshot.json b/db/migrations/meta/0032_snapshot.json deleted file mode 100644 index 82384a8c..00000000 --- a/db/migrations/meta/0032_snapshot.json +++ /dev/null @@ -1,2227 +0,0 @@ -{ - "id": "3a192515-c19e-4f01-b030-ac5f17a582c7", - "prevId": "c5a632c9-520d-4511-b16c-ebc45dcd4d8c", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.form_metas": { - "name": "form_metas", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0033_snapshot.json b/db/migrations/meta/0033_snapshot.json deleted file mode 100644 index 6960f2bd..00000000 --- a/db/migrations/meta/0033_snapshot.json +++ /dev/null @@ -1,2247 +0,0 @@ -{ - "id": "ee865511-ced9-4fd3-a0ad-79ec288e350c", - "prevId": "3a192515-c19e-4f01-b030-ac5f17a582c7", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0034_snapshot.json b/db/migrations/meta/0034_snapshot.json deleted file mode 100644 index a76c2512..00000000 --- a/db/migrations/meta/0034_snapshot.json +++ /dev/null @@ -1,2394 +0,0 @@ -{ - "id": "73a898f5-aaf6-406f-91d1-27a883ec1885", - "prevId": "ee865511-ced9-4fd3-a0ad-79ec288e350c", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "attributes_id": { - "name": "attributes_id", - "type": "integer", - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attributes_id": { - "name": "attributes_id", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "numbering_label": { - "name": "numbering_label", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "subfield_type": { - "name": "subfield_type", - "type": "varchar(50)", - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0035_snapshot.json b/db/migrations/meta/0035_snapshot.json deleted file mode 100644 index e79f8ad7..00000000 --- a/db/migrations/meta/0035_snapshot.json +++ /dev/null @@ -1,2388 +0,0 @@ -{ - "id": "8e78b185-8f74-4fe6-95ca-130114861f8a", - "prevId": "73a898f5-aaf6-406f-91d1-27a883ec1885", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "attributes_id": { - "name": "attributes_id", - "type": "integer", - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0036_snapshot.json b/db/migrations/meta/0036_snapshot.json deleted file mode 100644 index dda9efd2..00000000 --- a/db/migrations/meta/0036_snapshot.json +++ /dev/null @@ -1,2444 +0,0 @@ -{ - "id": "83a011c9-d1af-46b8-a6e8-4f37c0928235", - "prevId": "8e78b185-8f74-4fe6-95ca-130114861f8a", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "code": { - "name": "code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0037_snapshot.json b/db/migrations/meta/0037_snapshot.json deleted file mode 100644 index ae3cf0f8..00000000 --- a/db/migrations/meta/0037_snapshot.json +++ /dev/null @@ -1,2501 +0,0 @@ -{ - "id": "dd3a7e98-d3a3-4055-bff7-e882db98096b", - "prevId": "83a011c9-d1af-46b8-a6e8-4f37c0928235", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "code": { - "name": "code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "type": "varchar(100)", - "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 - }, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0038_snapshot.json b/db/migrations/meta/0038_snapshot.json deleted file mode 100644 index ca0b73ba..00000000 --- a/db/migrations/meta/0038_snapshot.json +++ /dev/null @@ -1,2501 +0,0 @@ -{ - "id": "a0794786-fa6f-43fe-beb6-706c0dfa0bec", - "prevId": "dd3a7e98-d3a3-4055-bff7-e882db98096b", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "code": { - "name": "code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - }, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0039_snapshot.json b/db/migrations/meta/0039_snapshot.json deleted file mode 100644 index 6f86f326..00000000 --- a/db/migrations/meta/0039_snapshot.json +++ /dev/null @@ -1,2529 +0,0 @@ -{ - "id": "670fe037-7043-4882-a767-e17c87962263", - "prevId": "a0794786-fa6f-43fe-beb6-706c0dfa0bec", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_subfields_tag_type_code_fk": { - "name": "tag_classes_tag_type_code_tag_subfields_tag_type_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_subfields", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "tag_type_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "tag_subfields_tag_type_code_unique": { - "name": "tag_subfields_tag_type_code_unique", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code" - ] - } - }, - "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 - }, - "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 - }, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0040_snapshot.json b/db/migrations/meta/0040_snapshot.json deleted file mode 100644 index 5c34f72e..00000000 --- a/db/migrations/meta/0040_snapshot.json +++ /dev/null @@ -1,2557 +0,0 @@ -{ - "id": "18275ba7-7efa-48db-914e-9d392cbbfe65", - "prevId": "670fe037-7043-4882-a767-e17c87962263", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0041_snapshot.json b/db/migrations/meta/0041_snapshot.json deleted file mode 100644 index 7c4712dd..00000000 --- a/db/migrations/meta/0041_snapshot.json +++ /dev/null @@ -1,2566 +0,0 @@ -{ - "id": "7f8a7917-c19e-44f3-a699-f96041ae2eeb", - "prevId": "18275ba7-7efa-48db-914e-9d392cbbfe65", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0042_snapshot.json b/db/migrations/meta/0042_snapshot.json deleted file mode 100644 index 98dd90d2..00000000 --- a/db/migrations/meta/0042_snapshot.json +++ /dev/null @@ -1,2640 +0,0 @@ -{ - "id": "7ecf6c17-a748-4fa2-af42-afd33bd7f4d9", - "prevId": "7f8a7917-c19e-44f3-a699-f96041ae2eeb", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0043_snapshot.json b/db/migrations/meta/0043_snapshot.json deleted file mode 100644 index 6dd878ca..00000000 --- a/db/migrations/meta/0043_snapshot.json +++ /dev/null @@ -1,2620 +0,0 @@ -{ - "id": "6f128b82-2d03-4e62-80bc-88ace6a83056", - "prevId": "7ecf6c17-a748-4fa2-af42-afd33bd7f4d9", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0044_snapshot.json b/db/migrations/meta/0044_snapshot.json deleted file mode 100644 index 0b9a68d6..00000000 --- a/db/migrations/meta/0044_snapshot.json +++ /dev/null @@ -1,2640 +0,0 @@ -{ - "id": "846948d9-6236-4b83-ab60-d1115bf41e64", - "prevId": "6f128b82-2d03-4e62-80bc-88ace6a83056", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0045_snapshot.json b/db/migrations/meta/0045_snapshot.json deleted file mode 100644 index 6ec40eab..00000000 --- a/db/migrations/meta/0045_snapshot.json +++ /dev/null @@ -1,2651 +0,0 @@ -{ - "id": "96054664-ecaa-4de1-aecf-a13de65ea6fa", - "prevId": "846948d9-6236-4b83-ab60-d1115bf41e64", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0046_snapshot.json b/db/migrations/meta/0046_snapshot.json deleted file mode 100644 index 8637b57e..00000000 --- a/db/migrations/meta/0046_snapshot.json +++ /dev/null @@ -1,2639 +0,0 @@ -{ - "id": "3d5b05e8-20af-4d4c-9220-1adffd9cdb0c", - "prevId": "96054664-ecaa-4de1-aecf-a13de65ea6fa", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0047_snapshot.json b/db/migrations/meta/0047_snapshot.json deleted file mode 100644 index f15c1f9b..00000000 --- a/db/migrations/meta/0047_snapshot.json +++ /dev/null @@ -1,2892 +0,0 @@ -{ - "id": "232cdaaf-4060-4e27-8be7-1791f0b621b3", - "prevId": "3d5b05e8-20af-4d4c-9220-1adffd9cdb0c", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - }, - "file_path": { - "name": "file_path", - "type": "varchar(255)", - "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": {}, - "foreignKeys": { - "revisions_issue_stage_id_issue_stages_id_fk": { - "name": "revisions_issue_stage_id_issue_stages_id_fk", - "tableFrom": "revisions", - "tableTo": "issue_stages", - "columnsFrom": [ - "issue_stage_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0048_snapshot.json b/db/migrations/meta/0048_snapshot.json deleted file mode 100644 index 9226bf23..00000000 --- a/db/migrations/meta/0048_snapshot.json +++ /dev/null @@ -1,2971 +0,0 @@ -{ - "id": "01e8cab5-3674-4ffa-9159-44e8b6bd81c6", - "prevId": "232cdaaf-4060-4e27-8be7-1791f0b621b3", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "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": {}, - "foreignKeys": { - "revisions_issue_stage_id_issue_stages_id_fk": { - "name": "revisions_issue_stage_id_issue_stages_id_fk", - "tableFrom": "revisions", - "tableTo": "issue_stages", - "columnsFrom": [ - "issue_stage_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0049_snapshot.json b/db/migrations/meta/0049_snapshot.json deleted file mode 100644 index 4f117b23..00000000 --- a/db/migrations/meta/0049_snapshot.json +++ /dev/null @@ -1,2979 +0,0 @@ -{ - "id": "b8f22f3e-67bf-4c26-9d23-be297c23bdf5", - "prevId": "01e8cab5-3674-4ffa-9159-44e8b6bd81c6", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "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_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0050_snapshot.json b/db/migrations/meta/0050_snapshot.json deleted file mode 100644 index ef4704e3..00000000 --- a/db/migrations/meta/0050_snapshot.json +++ /dev/null @@ -1,3055 +0,0 @@ -{ - "id": "876437f9-3dcb-4e86-adbe-7d53cd44a2b3", - "prevId": "b8f22f3e-67bf-4c26-9d23-be297c23bdf5", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - }, - "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_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0051_snapshot.json b/db/migrations/meta/0051_snapshot.json deleted file mode 100644 index 098334c1..00000000 --- a/db/migrations/meta/0051_snapshot.json +++ /dev/null @@ -1,3086 +0,0 @@ -{ - "id": "862281e8-069a-4232-b549-d64c0c59a104", - "prevId": "876437f9-3dcb-4e86-adbe-7d53cd44a2b3", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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": { - "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": { - "forms_form_code_unique": { - "name": "forms_form_code_unique", - "nullsNotDistinct": false, - "columns": [ - "form_code" - ] - } - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0052_snapshot.json b/db/migrations/meta/0052_snapshot.json deleted file mode 100644 index afc2f434..00000000 --- a/db/migrations/meta/0052_snapshot.json +++ /dev/null @@ -1,3100 +0,0 @@ -{ - "id": "9d24d572-0517-4d05-82f3-d135456c0969", - "prevId": "862281e8-069a-4232-b549-d64c0c59a104", - "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.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.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 - }, - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0053_snapshot.json b/db/migrations/meta/0053_snapshot.json deleted file mode 100644 index d1a5294e..00000000 --- a/db/migrations/meta/0053_snapshot.json +++ /dev/null @@ -1,3107 +0,0 @@ -{ - "id": "8db9dbf7-c0f8-4b81-a142-5099ea2c64fd", - "prevId": "9d24d572-0517-4d05-82f3-d135456c0969", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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_documents": { - "name": "vendor_documents", - "schema": "", - "columns": { - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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 - }, - "contract_id": { - "name": "contract_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0054_snapshot.json b/db/migrations/meta/0054_snapshot.json deleted file mode 100644 index ca3e3c8c..00000000 --- a/db/migrations/meta/0054_snapshot.json +++ /dev/null @@ -1,3193 +0,0 @@ -{ - "id": "b640a48c-4669-42f8-b4f0-9ffdd5c415f9", - "prevId": "8db9dbf7-c0f8-4b81-a142-5099ea2c64fd", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_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 - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "contract_name": { - "name": "contract_name", - "type": "varchar(255)", - "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 - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_code": { - "name": "project_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_name": { - "name": "project_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "project_type": { - "name": "project_type", - "type": "varchar(50)", - "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 c.contract_no,\n c.name AS contract_name,\n \n c.vendor_id,\n v.name AS vendor_name,\n \n c.project_id,\n p.code AS project_code,\n p.name AS project_name,\n p.type AS project_type,\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 JOIN vendors v ON c.vendor_id = v.id\n JOIN projects p ON c.project_id = p.id\n ", - "name": "vendor_documents_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0055_snapshot.json b/db/migrations/meta/0055_snapshot.json deleted file mode 100644 index a9437031..00000000 --- a/db/migrations/meta/0055_snapshot.json +++ /dev/null @@ -1,3145 +0,0 @@ -{ - "id": "54a09e13-3378-45ff-af86-f8458066bed2", - "prevId": "b640a48c-4669-42f8-b4f0-9ffdd5c415f9", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0056_snapshot.json b/db/migrations/meta/0056_snapshot.json deleted file mode 100644 index dba8062d..00000000 --- a/db/migrations/meta/0056_snapshot.json +++ /dev/null @@ -1,3214 +0,0 @@ -{ - "id": "80eabd79-3bb8-4e49-9c61-e81278b1fe9c", - "prevId": "54a09e13-3378-45ff-af86-f8458066bed2", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 (\n SELECT json_agg(\n json_build_object(\n 'id', i.id,\n 'stageName', i.stage_name,\n 'planDate', i.plan_date,\n 'actualDate', i.actual_date,\n 'createdAt', i.created_at,\n 'updatedAt', i.updated_at\n )\n )\n FROM issue_stages i\n WHERE i.document_id = d.id\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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0057_snapshot.json b/db/migrations/meta/0057_snapshot.json deleted file mode 100644 index bd0de319..00000000 --- a/db/migrations/meta/0057_snapshot.json +++ /dev/null @@ -1,3214 +0,0 @@ -{ - "id": "ea83db13-d245-42bf-b8f2-c21993e61988", - "prevId": "80eabd79-3bb8-4e49-9c61-e81278b1fe9c", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0058_snapshot.json b/db/migrations/meta/0058_snapshot.json deleted file mode 100644 index 1509a952..00000000 --- a/db/migrations/meta/0058_snapshot.json +++ /dev/null @@ -1,3236 +0,0 @@ -{ - "id": "b9295956-4ddf-4228-a114-23bb7e3b7fda", - "prevId": "ea83db13-d245-42bf-b8f2-c21993e61988", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0059_snapshot.json b/db/migrations/meta/0059_snapshot.json deleted file mode 100644 index c86909e6..00000000 --- a/db/migrations/meta/0059_snapshot.json +++ /dev/null @@ -1,3264 +0,0 @@ -{ - "id": "958afd9b-1135-4de3-83f3-961f8930a7ac", - "prevId": "b9295956-4ddf-4228-a114-23bb7e3b7fda", - "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.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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0060_snapshot.json b/db/migrations/meta/0060_snapshot.json deleted file mode 100644 index 5798e8b7..00000000 --- a/db/migrations/meta/0060_snapshot.json +++ /dev/null @@ -1,3461 +0,0 @@ -{ - "id": "f4427f25-072c-46ce-ac99-0fd0f2800c4d", - "prevId": "958afd9b-1135-4de3-83f3-961f8930a7ac", - "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.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 - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - }, - "answer": { - "name": "answer", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachment_paths": { - "name": "attachment_paths", - "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_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": "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0061_snapshot.json b/db/migrations/meta/0061_snapshot.json deleted file mode 100644 index 9041f29e..00000000 --- a/db/migrations/meta/0061_snapshot.json +++ /dev/null @@ -1,3475 +0,0 @@ -{ - "id": "069e5427-3e16-4ec3-b15c-8466e708b98a", - "prevId": "f4427f25-072c-46ce-ac99-0fd0f2800c4d", - "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.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.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 - }, - "answer": { - "name": "answer", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachment_paths": { - "name": "attachment_paths", - "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_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": "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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 - } - }, - "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_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_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 - }, - "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": { - "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.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": "'ACTIVE'" - }, - "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.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0062_snapshot.json b/db/migrations/meta/0062_snapshot.json deleted file mode 100644 index a3dc9915..00000000 --- a/db/migrations/meta/0062_snapshot.json +++ /dev/null @@ -1,3544 +0,0 @@ -{ - "id": "b83f2fb4-d0b0-4763-968a-6318ae81f99e", - "prevId": "069e5427-3e16-4ec3-b15c-8466e708b98a", - "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.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.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 - }, - "answer": { - "name": "answer", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "attachment_paths": { - "name": "attachment_paths", - "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_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": "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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 - }, - "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": { - "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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0063_snapshot.json b/db/migrations/meta/0063_snapshot.json deleted file mode 100644 index 7cba6bbd..00000000 --- a/db/migrations/meta/0063_snapshot.json +++ /dev/null @@ -1,3538 +0,0 @@ -{ - "id": "3b247cd8-d5a4-4b64-99b7-6bfbff55c5c3", - "prevId": "b83f2fb4-d0b0-4763-968a-6318ae81f99e", - "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.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.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 - }, - "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_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": "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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 - }, - "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": { - "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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0064_snapshot.json b/db/migrations/meta/0064_snapshot.json deleted file mode 100644 index 75add979..00000000 --- a/db/migrations/meta/0064_snapshot.json +++ /dev/null @@ -1,3551 +0,0 @@ -{ - "id": "f1fa2203-5216-4ca7-8cf7-1a193e868399", - "prevId": "3b247cd8-d5a4-4b64-99b7-6bfbff55c5c3", - "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.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.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 - }, - "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": "no action" - }, - "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": "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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 - }, - "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": { - "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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0065_snapshot.json b/db/migrations/meta/0065_snapshot.json deleted file mode 100644 index b03e2839..00000000 --- a/db/migrations/meta/0065_snapshot.json +++ /dev/null @@ -1,3609 +0,0 @@ -{ - "id": "33d48a4f-263c-4d8a-910c-3be8bb774e36", - "prevId": "f1fa2203-5216-4ca7-8cf7-1a193e868399", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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_id": { - "name": "vendor_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_id_vendors_id_fk": { - "name": "vendor_pq_review_logs_vendor_id_vendors_id_fk", - "tableFrom": "vendor_pq_review_logs", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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 - }, - "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": { - "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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0066_snapshot.json b/db/migrations/meta/0066_snapshot.json deleted file mode 100644 index a056c266..00000000 --- a/db/migrations/meta/0066_snapshot.json +++ /dev/null @@ -1,3609 +0,0 @@ -{ - "id": "85c8a6e2-ac3f-4ce5-bba9-70ef5549714b", - "prevId": "33d48a4f-263c-4d8a-910c-3be8bb774e36", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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 - }, - "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": { - "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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0067_snapshot.json b/db/migrations/meta/0067_snapshot.json deleted file mode 100644 index a42e5a3c..00000000 --- a/db/migrations/meta/0067_snapshot.json +++ /dev/null @@ -1,3656 +0,0 @@ -{ - "id": "6e828296-7e59-40e2-9063-f37554b3e680", - "prevId": "85c8a6e2-ac3f-4ce5-bba9-70ef5549714b", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_items_view": { - "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()" - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"vendor_possible_items\".\"item_code\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\", \"items\".\"id\", \"items\".\"item_name\", \"items\".\"description\", \"items\".\"created_at\", \"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 - } - }, - "_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 deleted file mode 100644 index f2238205..00000000 --- a/db/migrations/meta/0068_snapshot.json +++ /dev/null @@ -1,3656 +0,0 @@ -{ - "id": "55ca586f-28b5-474b-a49d-dc0a9d406414", - "prevId": "6e828296-7e59-40e2-9063-f37554b3e680", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_items_view": { - "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()" - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"vendor_possible_items\".\"item_code\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\", \"items\".\"item_name\", \"items\".\"description\", \"items\".\"created_at\", \"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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0069_snapshot.json b/db/migrations/meta/0069_snapshot.json deleted file mode 100644 index 213f66ba..00000000 --- a/db/migrations/meta/0069_snapshot.json +++ /dev/null @@ -1,3656 +0,0 @@ -{ - "id": "deb23418-5bd1-4c28-8719-75d48031d3a4", - "prevId": "55ca586f-28b5-474b-a49d-dc0a9d406414", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_items_view": { - "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()" - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"vendor_possible_items\".\"item_code\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\", \"items\".\"id\", \"items\".\"item_name\", \"items\".\"description\", \"items\".\"created_at\", \"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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0070_snapshot.json b/db/migrations/meta/0070_snapshot.json deleted file mode 100644 index bd8553bf..00000000 --- a/db/migrations/meta/0070_snapshot.json +++ /dev/null @@ -1,3656 +0,0 @@ -{ - "id": "821893cc-d8c2-43a9-9b4c-e9578e1d342b", - "prevId": "deb23418-5bd1-4c28-8719-75d48031d3a4", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "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()" - }, - "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 - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\", \"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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0071_snapshot.json b/db/migrations/meta/0071_snapshot.json deleted file mode 100644 index c8fce189..00000000 --- a/db/migrations/meta/0071_snapshot.json +++ /dev/null @@ -1,3656 +0,0 @@ -{ - "id": "27f8fcb6-9761-428f-a16f-261f3b93d0ba", - "prevId": "821893cc-d8c2-43a9-9b4c-e9578e1d342b", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0072_snapshot.json b/db/migrations/meta/0072_snapshot.json deleted file mode 100644 index 98bb8c97..00000000 --- a/db/migrations/meta/0072_snapshot.json +++ /dev/null @@ -1,3643 +0,0 @@ -{ - "id": "b589b3ea-f034-4663-81d4-c48f70dc56cc", - "prevId": "27f8fcb6-9761-428f-a16f-261f3b93d0ba", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "description": { - "name": "description", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "project_code": { - "name": "project_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "project_name": { - "name": "project_name", - "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'" - }, - "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_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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "rfqs_rfq_code_unique": { - "name": "rfqs_rfq_code_unique", - "nullsNotDistinct": false, - "columns": [ - "rfq_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "contract_items_contract_id_item_id_unique": { - "name": "contract_items_contract_id_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"vendors\" left join \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfq_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\" from \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"updated_at\" as \"rfq_vendor_updated\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"project_code\" as \"project_code\", \"rfqs\".\"project_name\" as \"project_name\", \"rfqs\".\"description\" as \"description\", \"rfqs\".\"due_date\" as \"due_date\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0073_snapshot.json b/db/migrations/meta/0073_snapshot.json deleted file mode 100644 index 640abdde..00000000 --- a/db/migrations/meta/0073_snapshot.json +++ /dev/null @@ -1,3676 +0,0 @@ -{ - "id": "34bef97d-7e1c-4199-826f-69131079cc2a", - "prevId": "b589b3ea-f034-4663-81d4-c48f70dc56cc", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "contract_items_contract_id_item_id_unique": { - "name": "contract_items_contract_id_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"id\", \"rfqs\".\"status\" as \"status\", \"rfqs\".\"created_at\" as \"created_at\", \"rfqs\".\"updated_at\" as \"updated_at\", \"rfqs\".\"created_by\" as \"created_by\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0074_snapshot.json b/db/migrations/meta/0074_snapshot.json deleted file mode 100644 index 9062f08d..00000000 --- a/db/migrations/meta/0074_snapshot.json +++ /dev/null @@ -1,3676 +0,0 @@ -{ - "id": "b741d86f-c226-47d4-bc58-017433bccef2", - "prevId": "34bef97d-7e1c-4199-826f-69131079cc2a", - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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.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 - }, - "quantity": { - "name": "quantity", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 1 - }, - "price": { - "name": "price", - "type": "numeric(10, 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": {}, - "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" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "contract_items_contract_id_item_id_unique": { - "name": "contract_items_contract_id_item_id_unique", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - }, - "contract_items_contract_item_idx": { - "name": "contract_items_contract_item_idx", - "nullsNotDistinct": false, - "columns": [ - "contract_id", - "item_id" - ] - } - }, - "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 - }, - "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.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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0075_snapshot.json b/db/migrations/meta/0075_snapshot.json deleted file mode 100644 index d60d1c49..00000000 --- a/db/migrations/meta/0075_snapshot.json +++ /dev/null @@ -1,3978 +0,0 @@ -{ - "id": "ca57aefa-1895-4164-bcd2-a06cf332f2c7", - "prevId": "b741d86f-c226-47d4-bc58-017433bccef2", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.user_domain": { - "name": "user_domain", - "schema": "public", - "values": [ - "evcp", - "partners" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": { - "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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0076_snapshot.json b/db/migrations/meta/0076_snapshot.json deleted file mode 100644 index e5b0d579..00000000 --- a/db/migrations/meta/0076_snapshot.json +++ /dev/null @@ -1,4167 +0,0 @@ -{ - "id": "5d92a726-36ab-4f08-9d33-89c62cb66aff", - "prevId": "ca57aefa-1895-4164-bcd2-a06cf332f2c7", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0077_snapshot.json b/db/migrations/meta/0077_snapshot.json deleted file mode 100644 index e6bd4d25..00000000 --- a/db/migrations/meta/0077_snapshot.json +++ /dev/null @@ -1,4175 +0,0 @@ -{ - "id": "405a3435-c9ee-4275-8509-0cf44a3b67fd", - "prevId": "5d92a726-36ab-4f08-9d33-89c62cb66aff", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"projects\".\"id\" as \"project_id\", \"projects\".\"code\" as \"project_code\", \"projects\".\"name\" as \"project_name\" from \"rfqs\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0078_snapshot.json b/db/migrations/meta/0078_snapshot.json deleted file mode 100644 index 225e4c3e..00000000 --- a/db/migrations/meta/0078_snapshot.json +++ /dev/null @@ -1,4175 +0,0 @@ -{ - "id": "9436a7ac-fa58-4111-832b-0cc43609e0f6", - "prevId": "405a3435-c9ee-4275-8509-0cf44a3b67fd", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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\", (\n SELECT MAX(\"created_at\") \n FROM \"rfq_attachments\" \n WHERE \"rfq_attachments\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"latest_attachment_date\", (\n SELECT MIN(\"unit_price\") \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"min_item_price\", (\n SELECT MAX(\"unit_price\") \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"max_item_price\", (\n SELECT SUM(\"unit_price\" * \"quantity\") \n FROM \"rfq_items\" \n WHERE \"rfq_items\".\"rfq_id\" = \"rfqs\".\"id\"\n ) as \"total_items_amount\" 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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0079_snapshot.json b/db/migrations/meta/0079_snapshot.json deleted file mode 100644 index cfa046c9..00000000 --- a/db/migrations/meta/0079_snapshot.json +++ /dev/null @@ -1,4175 +0,0 @@ -{ - "id": "2259fd8d-dd5d-450b-98a5-fd318b84a887", - "prevId": "9436a7ac-fa58-4111-832b-0cc43609e0f6", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"name\" as \"company_name\", \n array_agg(\"roles\".\"name\")\n as \"roles\", \"users\".\"created_at\" as \"created_at\" from \"users\" left join \"companies\" on \"users\".\"company_id\" = \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0080_snapshot.json b/db/migrations/meta/0080_snapshot.json deleted file mode 100644 index f04961cd..00000000 --- a/db/migrations/meta/0080_snapshot.json +++ /dev/null @@ -1,4175 +0,0 @@ -{ - "id": "4c385f06-bc36-451b-a6e3-a7b3205f7b43", - "prevId": "2259fd8d-dd5d-450b-98a5-fd318b84a887", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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\", \"companies\".\"id\"", - "name": "user_view", - "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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0081_snapshot.json b/db/migrations/meta/0081_snapshot.json deleted file mode 100644 index 24f40c9b..00000000 --- a/db/migrations/meta/0081_snapshot.json +++ /dev/null @@ -1,4175 +0,0 @@ -{ - "id": "e039b64a-9af3-4058-9c1b-3883f2777b60", - "prevId": "4c385f06-bc36-451b-a6e3-a7b3205f7b43", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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.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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0082_snapshot.json b/db/migrations/meta/0082_snapshot.json deleted file mode 100644 index 875c3fb4..00000000 --- a/db/migrations/meta/0082_snapshot.json +++ /dev/null @@ -1,4453 +0,0 @@ -{ - "id": "610f27ad-2c8a-488d-b538-24d9d49ff63d", - "prevId": "e039b64a-9af3-4058-9c1b-3883f2777b60", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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_companies_id_fk": { - "name": "roles_company_id_companies_id_fk", - "tableFrom": "roles", - "tableTo": "companies", - "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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0083_snapshot.json b/db/migrations/meta/0083_snapshot.json deleted file mode 100644 index 68c3c779..00000000 --- a/db/migrations/meta/0083_snapshot.json +++ /dev/null @@ -1,4453 +0,0 @@ -{ - "id": "fb7a9ccc-5f92-4f6b-ad37-d7055a898ce3", - "prevId": "610f27ad-2c8a-488d-b538-24d9d49ff63d", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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\", \"companies\".\"id\" as \"company_id\", \"companies\".\"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 \"companies\" on \"roles\".\"company_id\" = \"companies\".\"id\" group by \"roles\".\"id\", \"companies\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0084_snapshot.json b/db/migrations/meta/0084_snapshot.json deleted file mode 100644 index c39d9093..00000000 --- a/db/migrations/meta/0084_snapshot.json +++ /dev/null @@ -1,4453 +0,0 @@ -{ - "id": "66f383c4-ab04-402c-aad0-5a9a173d71d2", - "prevId": "fb7a9ccc-5f92-4f6b-ad37-d7055a898ce3", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0085_snapshot.json b/db/migrations/meta/0085_snapshot.json deleted file mode 100644 index 64d44671..00000000 --- a/db/migrations/meta/0085_snapshot.json +++ /dev/null @@ -1,4453 +0,0 @@ -{ - "id": "e54704da-ddb7-4547-8b2f-66d04d4f0a0d", - "prevId": "66f383c4-ab04-402c-aad0-5a9a173d71d2", - "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 - }, - "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" - } - }, - "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 - }, - "signer_email": { - "name": "signer_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "signer_name": { - "name": "signer_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_position": { - "name": "signer_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "signer_status": { - "name": "signer_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0086_snapshot.json b/db/migrations/meta/0086_snapshot.json deleted file mode 100644 index 6f4c7aaf..00000000 --- a/db/migrations/meta/0086_snapshot.json +++ /dev/null @@ -1,4557 +0,0 @@ -{ - "id": "c16ad018-03f1-405b-986f-3cdf4ba1d262", - "prevId": "e54704da-ddb7-4547-8b2f-66d04d4f0a0d", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0087_snapshot.json b/db/migrations/meta/0087_snapshot.json deleted file mode 100644 index ce9ae1b0..00000000 --- a/db/migrations/meta/0087_snapshot.json +++ /dev/null @@ -1,4971 +0,0 @@ -{ - "id": "986557e7-7d62-4efe-8b37-dca102b8c33f", - "prevId": "c16ad018-03f1-405b-986f-3cdf4ba1d262", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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.rfq_vendors": { - "name": "rfq_vendors", - "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 - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'INVITED'" - }, - "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": { - "rfq_vendors_unique_rfqs": { - "name": "rfq_vendors_unique_rfqs", - "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": { - "rfq_vendors_rfq_id_rfqs_id_fk": { - "name": "rfq_vendors_rfq_id_rfqs_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "rfq_vendors_vendor_id_vendors_id_fk": { - "name": "rfq_vendors_vendor_id_vendors_id_fk", - "tableFrom": "rfq_vendors", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - }, - "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_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_quotes": { - "name": "vendor_quotes", - "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 - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(18, 2)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false, - "default": "'USD'" - }, - "lead_time": { - "name": "lead_time", - "type": "varchar(100)", - "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": { - "uq_vendor_quotes": { - "name": "uq_vendor_quotes", - "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_quotes_rfq_id_rfqs_id_fk": { - "name": "vendor_quotes_rfq_id_rfqs_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "rfqs", - "columnsFrom": [ - "rfq_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_quotes_vendor_id_vendors_id_fk": { - "name": "vendor_quotes_vendor_id_vendors_id_fk", - "tableFrom": "vendor_quotes", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"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_rfqs_view": { - "columns": {}, - "definition": "select \"rfqs\".\"id\" as \"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\", \"rfq_vendors\".\"id\" as \"rfq_vendor_id\", \"rfq_vendors\".\"vendor_id\" as \"vendor_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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 \"rfq_vendors\" inner join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\"", - "name": "vendor_rfqs_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\", \"rfq_vendors\".\"rfq_id\" as \"rfq_id\", \"rfq_vendors\".\"status\" as \"rfq_vendor_status\", \"rfq_vendors\".\"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\", \"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 \"rfq_vendors\" on \"rfq_vendors\".\"vendor_id\" = \"vendors\".\"id\" left join \"rfqs\" on \"rfq_vendors\".\"rfq_id\" = \"rfqs\".\"id\" left join \"projects\" on \"rfqs\".\"project_id\" = \"projects\".\"id\" left join \"rfq_evaluations\" on (\"rfq_evaluations\".\"vendor_id\" = \"vendors\".\"id\" and \"rfq_evaluations\".\"eval_type\" = 'TBE' and \"rfq_evaluations\".\"rfq_id\" = \"rfq_vendors\".\"rfq_id\")", - "name": "vendor_tbe_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\", \"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\" 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 \"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.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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0088_snapshot.json b/db/migrations/meta/0088_snapshot.json deleted file mode 100644 index 54ba90ef..00000000 --- a/db/migrations/meta/0088_snapshot.json +++ /dev/null @@ -1,4743 +0,0 @@ -{ - "id": "638e4d5e-121f-4676-a717-2fa13cad3ae8", - "prevId": "986557e7-7d62-4efe-8b37-dca102b8c33f", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_responses_view": { - "columns": {}, - "definition": "select \"vendor_responses\".\"id\" as \"response_id\", \"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\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"responded_by\" 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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0089_snapshot.json b/db/migrations/meta/0089_snapshot.json deleted file mode 100644 index 594baec6..00000000 --- a/db/migrations/meta/0089_snapshot.json +++ /dev/null @@ -1,4743 +0,0 @@ -{ - "id": "0383a570-b565-4aa7-ad37-b2bdf1c4eb9a", - "prevId": "638e4d5e-121f-4676-a717-2fa13cad3ae8", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_attachments": { - "name": "cbe_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_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 - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_attachments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_attachments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_attachments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.cbe_comments": { - "name": "cbe_comments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "cbe_id": { - "name": "cbe_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "commented_by": { - "name": "commented_by", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "comment_text": { - "name": "comment_text", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "cbe_comments_cbe_id_cbe_evaluations_id_fk": { - "name": "cbe_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "cbe_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "cbe_comments_commented_by_users_id_fk": { - "name": "cbe_comments_commented_by_users_id_fk", - "tableFrom": "cbe_comments", - "tableTo": "users", - "columnsFrom": [ - "commented_by" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "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 - }, - "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_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 - }, - "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_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" - } - }, - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\".\"rfq_id\" as \"rfq_id\", \"vendor_responses\".\"responded_by\" 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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0090_snapshot.json b/db/migrations/meta/0090_snapshot.json deleted file mode 100644 index 11a0f4c7..00000000 --- a/db/migrations/meta/0090_snapshot.json +++ /dev/null @@ -1,4627 +0,0 @@ -{ - "id": "3a94d6ac-9c72-4560-ae7a-5223852c9cc2", - "prevId": "0383a570-b565-4aa7-ad37-b2bdf1c4eb9a", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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 - }, - "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_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 - }, - "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_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_evaluation_id_cbe_evaluations_id_fk": { - "name": "rfq_comments_evaluation_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "evaluation_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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0091_snapshot.json b/db/migrations/meta/0091_snapshot.json deleted file mode 100644 index ec7d92fc..00000000 --- a/db/migrations/meta/0091_snapshot.json +++ /dev/null @@ -1,4627 +0,0 @@ -{ - "id": "2faefd29-56c3-47e3-b9ed-96a1360d102b", - "prevId": "3a94d6ac-9c72-4560-ae7a-5223852c9cc2", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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 - }, - "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_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 - }, - "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_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_evaluation_id_cbe_evaluations_id_fk": { - "name": "rfq_comments_evaluation_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "evaluation_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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"rfqs\".\"rfq_code\" as \"rfq_code\", \"rfqs\".\"rfq_type\" 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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0092_snapshot.json b/db/migrations/meta/0092_snapshot.json deleted file mode 100644 index dbed63db..00000000 --- a/db/migrations/meta/0092_snapshot.json +++ /dev/null @@ -1,4627 +0,0 @@ -{ - "id": "dcc4061e-cddf-45b0-9d0e-312c44d4de9f", - "prevId": "2faefd29-56c3-47e3-b9ed-96a1360d102b", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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 - }, - "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_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 - }, - "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_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_evaluation_id_cbe_evaluations_id_fk": { - "name": "rfq_comments_evaluation_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "evaluation_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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0093_snapshot.json b/db/migrations/meta/0093_snapshot.json deleted file mode 100644 index 7f7117af..00000000 --- a/db/migrations/meta/0093_snapshot.json +++ /dev/null @@ -1,4635 +0,0 @@ -{ - "id": "d0bcc07a-7aa7-426e-a8dd-c686149a3277", - "prevId": "dcc4061e-cddf-45b0-9d0e-312c44d4de9f", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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 - }, - "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_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 - }, - "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_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_evaluation_id_cbe_evaluations_id_fk": { - "name": "rfq_comments_evaluation_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "columnsFrom": [ - "evaluation_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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0094_snapshot.json b/db/migrations/meta/0094_snapshot.json index 8f120e76..acc0c4b0 100644 --- a/db/migrations/meta/0094_snapshot.json +++ b/db/migrations/meta/0094_snapshot.json @@ -1,6 +1,6 @@ { - "id": "bbb77029-dc7f-437a-a9ec-2d7550285af0", - "prevId": "d0bcc07a-7aa7-426e-a8dd-c686149a3277", + "id": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78", + "prevId": "00000000-0000-0000-0000-000000000000", "version": "7", "dialect": "postgresql", "tables": { @@ -1190,6 +1190,12 @@ "primaryKey": false, "notNull": false }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, "created_at": { "name": "created_at", "type": "timestamp", @@ -1245,6 +1251,19 @@ "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", @@ -1354,6 +1373,19 @@ "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", @@ -3268,6 +3300,90 @@ "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.view_tag_subfields": { "name": "view_tag_subfields", "schema": "", @@ -4329,7 +4445,7 @@ "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\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "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\", EXISTS (\n SELECT 1 \n FROM \"contract_items\" \n WHERE \"contract_items\".\"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, diff --git a/db/migrations/meta/0095_snapshot.json b/db/migrations/meta/0095_snapshot.json index 1055728a..cf5f424c 100644 --- a/db/migrations/meta/0095_snapshot.json +++ b/db/migrations/meta/0095_snapshot.json @@ -1,6 +1,6 @@ { - "id": "96b4b0a0-553d-477d-8f69-1947503efade", - "prevId": "bbb77029-dc7f-437a-a9ec-2d7550285af0", + "id": "a87c6f47-5579-4e23-9f26-6a6da4a21a1c", + "prevId": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78", "version": "7", "dialect": "postgresql", "tables": { @@ -1190,6 +1190,12 @@ "primaryKey": false, "notNull": false }, + "cbe_id": { + "name": "cbe_id", + "type": "integer", + "primaryKey": false, + "notNull": false + }, "created_at": { "name": "created_at", "type": "timestamp", @@ -1245,6 +1251,19 @@ "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", @@ -3281,6 +3300,90 @@ "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.view_tag_subfields": { "name": "view_tag_subfields", "schema": "", @@ -4342,7 +4445,7 @@ "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\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", + "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, diff --git a/db/migrations/meta/0096_snapshot.json b/db/migrations/meta/0096_snapshot.json deleted file mode 100644 index b876e8bd..00000000 --- a/db/migrations/meta/0096_snapshot.json +++ /dev/null @@ -1,4673 +0,0 @@ -{ - "id": "4a660f03-fec2-4a7d-ae42-8a7628b9c863", - "prevId": "96b4b0a0-553d-477d-8f69-1947503efade", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0097_snapshot.json b/db/migrations/meta/0097_snapshot.json deleted file mode 100644 index fdb6c54e..00000000 --- a/db/migrations/meta/0097_snapshot.json +++ /dev/null @@ -1,4743 +0,0 @@ -{ - "id": "a5bc1fe9-c221-4f2e-a48b-b62eb54b7f88", - "prevId": "4a660f03-fec2-4a7d-ae42-8a7628b9c863", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "form_code": { - "name": "form_code", - "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 - } - }, - "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_code_forms_form_code_fk": { - "name": "vendor_data_report_temps_form_code_forms_form_code_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "forms", - "columnsFrom": [ - "form_code" - ], - "columnsTo": [ - "form_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0098_snapshot.json b/db/migrations/meta/0098_snapshot.json deleted file mode 100644 index a53a4d05..00000000 --- a/db/migrations/meta/0098_snapshot.json +++ /dev/null @@ -1,4743 +0,0 @@ -{ - "id": "202bde2b-fe88-44d0-a5c2-89f82048929a", - "prevId": "a5bc1fe9-c221-4f2e-a48b-b62eb54b7f88", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "formId": { - "name": "formId", - "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 - } - }, - "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_formId_forms_id_fk": { - "name": "vendor_data_report_temps_formId_forms_id_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "forms", - "columnsFrom": [ - "formId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0099_snapshot.json b/db/migrations/meta/0099_snapshot.json deleted file mode 100644 index 8d523550..00000000 --- a/db/migrations/meta/0099_snapshot.json +++ /dev/null @@ -1,4755 +0,0 @@ -{ - "id": "b97e2871-b8a6-480d-996e-dbe325ddfb7b", - "prevId": "202bde2b-fe88-44d0-a5c2-89f82048929a", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "formId": { - "name": "formId", - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "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_formId_forms_id_fk": { - "name": "vendor_data_report_temps_formId_forms_id_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "forms", - "columnsFrom": [ - "formId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0100_snapshot.json b/db/migrations/meta/0100_snapshot.json deleted file mode 100644 index 7c9063af..00000000 --- a/db/migrations/meta/0100_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "506bd563-e934-402b-bce6-ba2a55db0676", - "prevId": "b97e2871-b8a6-480d-996e-dbe325ddfb7b", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "formId": { - "name": "formId", - "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_formId_forms_id_fk": { - "name": "vendor_data_report_temps_formId_forms_id_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "forms", - "columnsFrom": [ - "formId" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0101_snapshot.json b/db/migrations/meta/0101_snapshot.json deleted file mode 100644 index 902d8918..00000000 --- a/db/migrations/meta/0101_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "7a88e8e5-37a2-4531-a021-d15d3a47e143", - "prevId": "506bd563-e934-402b-bce6-ba2a55db0676", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "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.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0102_snapshot.json b/db/migrations/meta/0102_snapshot.json deleted file mode 100644 index 11bbc60d..00000000 --- a/db/migrations/meta/0102_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "1f9424b7-fa9e-44bf-a5d1-dbceb2d9da56", - "prevId": "7a88e8e5-37a2-4531-a021-d15d3a47e143", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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\" 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -} \ No newline at end of file diff --git a/db/migrations/meta/0103_snapshot.json b/db/migrations/meta/0103_snapshot.json deleted file mode 100644 index a334d505..00000000 --- a/db/migrations/meta/0103_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "c61340a1-8aed-47e6-8d5b-7528e1a5538f", - "prevId": "1f9424b7-fa9e-44bf-a5d1-dbceb2d9da56", - "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" - } - }, - "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.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.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 - }, - "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": "no action" - }, - "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": "no action" - } - }, - "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.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_cbe_evaluations_id_fk": { - "name": "rfq_comments_cbe_id_cbe_evaluations_id_fk", - "tableFrom": "rfq_comments", - "tableTo": "cbe_evaluations", - "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 - }, - "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_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 - }, - "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 - }, - "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.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, - "default": "concat('TASK-', to_char(nextval('tasks_code_seq'), 'FM0000'))" - }, - "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.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 - } - }, - "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 - }, - "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": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "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 - }, - "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.form_templates": { - "name": "form_templates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "form_id": { - "name": "form_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 - }, - "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": { - "form_templates_form_id_forms_id_fk": { - "name": "form_templates_form_id_forms_id_fk", - "tableFrom": "form_templates", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "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 - } - }, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_classes_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_attributes_id_tag_subfields_attributes_id_fk": { - "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id" - ], - "columnsTo": [ - "attributes_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "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_tag_type_code_tag_types_code_fk": { - "name": "tag_subfields_tag_type_code_tag_types_code_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code" - ], - "columnsTo": [ - "code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "tag_type_code", - "attributes_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 - }, - "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 - }, - "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": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": true, - "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": {}, - "compositePrimaryKeys": {}, - "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": {}, - "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.view_tag_subfields": { - "name": "view_tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "tag_type_description": { - "name": "tag_type_description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "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": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "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_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_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.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'" - }, - "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()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "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', 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.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_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\", \"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\", \"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 \"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.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_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 - } - }, - "_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 f2725ef7..36896522 100644 --- a/db/migrations/meta/_journal.json +++ b/db/migrations/meta/_journal.json @@ -659,6 +659,20 @@ "when": 1742834014376, "tag": "0093_young_the_hunter", "breakpoints": true - } + }, + { + "idx": 94, + "version": "7", + "when": 1743082855735, + "tag": "0094_fresh_blur", + "breakpoints": true + }, + { + "idx": 95, + "version": "7", + "when": 1743082939613, + "tag": "0095_odd_slayback", + "breakpoints": true + } ] } \ No newline at end of file -- cgit v1.2.3