diff options
Diffstat (limited to 'db/migrations_backup')
134 files changed, 0 insertions, 100013 deletions
diff --git a/db/migrations_backup/0000_dusty_skaar.sql b/db/migrations_backup/0000_dusty_skaar.sql deleted file mode 100644 index 1f56428d..00000000 --- a/db/migrations_backup/0000_dusty_skaar.sql +++ /dev/null @@ -1,51 +0,0 @@ -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 "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 "user_roles" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "user_roles_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "user_id" integer, - "role" varchar(30) DEFAULT 'normal' 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 -ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "users" ADD CONSTRAINT "users_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE set null ON UPDATE no action;--> 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"."image_url" as "user_image", "companies"."id" as "company_id", "companies"."name" as "company_name", - array_agg("user_roles"."role") - 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");
\ No newline at end of file diff --git a/db/migrations_backup/0001_robust_landau.sql b/db/migrations_backup/0001_robust_landau.sql deleted file mode 100644 index 94368814..00000000 --- a/db/migrations_backup/0001_robust_landau.sql +++ /dev/null @@ -1,32 +0,0 @@ -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, - "created_at" timestamp DEFAULT now() -); ---> statement-breakpoint -DROP VIEW "public"."user_view";--> statement-breakpoint -ALTER TABLE "user_roles" DROP CONSTRAINT "user_roles_user_id_users_id_fk"; ---> statement-breakpoint -ALTER TABLE "user_roles" ALTER COLUMN "user_id" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "user_roles" ADD COLUMN "role_id" integer NOT NULL;--> 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 "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 "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" DROP COLUMN "id";--> statement-breakpoint -ALTER TABLE "user_roles" DROP COLUMN "role";--> 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"."image_url" as "user_image", "companies"."id" as "company_id", "companies"."name" as "company_name", - array_agg("roles"."name") - 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");
\ No newline at end of file diff --git a/db/migrations_backup/0002_puzzling_johnny_blaze.sql b/db/migrations_backup/0002_puzzling_johnny_blaze.sql deleted file mode 100644 index f49fcbe7..00000000 --- a/db/migrations_backup/0002_puzzling_johnny_blaze.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "roles" ADD COLUMN "domain" "user_domain" NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0003_unknown_speed_demon.sql b/db/migrations_backup/0003_unknown_speed_demon.sql deleted file mode 100644 index 19fc36a8..00000000 --- a/db/migrations_backup/0003_unknown_speed_demon.sql +++ /dev/null @@ -1,5 +0,0 @@ -DROP VIEW "public"."user_view";--> statement-breakpoint -ALTER TABLE "roles" ADD COLUMN "description" text DEFAULT '' NOT NULL;--> 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", "companies"."id" as "company_id", "companies"."name" as "company_name", - array_agg("roles"."name") - 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");
\ No newline at end of file diff --git a/db/migrations_backup/0004_cheerful_stark_industries.sql b/db/migrations_backup/0004_cheerful_stark_industries.sql deleted file mode 100644 index 5f8648e9..00000000 --- a/db/migrations_backup/0004_cheerful_stark_industries.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "roles" ADD COLUMN "company_id" integer;--> statement-breakpoint -ALTER TABLE "roles" ADD CONSTRAINT "roles_company_id_companies_id_fk" FOREIGN KEY ("company_id") REFERENCES "public"."companies"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0005_loud_whizzer.sql b/db/migrations_backup/0005_loud_whizzer.sql deleted file mode 100644 index cfd7a735..00000000 --- a/db/migrations_backup/0005_loud_whizzer.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE VIEW "public"."role_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0006_tan_mongu.sql b/db/migrations_backup/0006_tan_mongu.sql deleted file mode 100644 index 418429d5..00000000 --- a/db/migrations_backup/0006_tan_mongu.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."role_view";--> 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", "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");
\ No newline at end of file diff --git a/db/migrations_backup/0007_big_franklin_storm.sql b/db/migrations_backup/0007_big_franklin_storm.sql deleted file mode 100644 index 33e34a8a..00000000 --- a/db/migrations_backup/0007_big_franklin_storm.sql +++ /dev/null @@ -1,37 +0,0 @@ -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_name" varchar(255), - "description" text, - "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), - "address" text, - "country" varchar(100), - "phone" varchar(50), - "email" varchar(255), - "website" varchar(255), - "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0008_previous_omega_red.sql b/db/migrations_backup/0008_previous_omega_red.sql deleted file mode 100644 index 4f569763..00000000 --- a/db/migrations_backup/0008_previous_omega_red.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "vendors" ALTER COLUMN "status" SET DATA TYPE varchar(30);
\ No newline at end of file diff --git a/db/migrations_backup/0009_aromatic_falcon.sql b/db/migrations_backup/0009_aromatic_falcon.sql deleted file mode 100644 index 07ec787b..00000000 --- a/db/migrations_backup/0009_aromatic_falcon.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "vendor_possible_items" ADD COLUMN "item_code" varchar(100);
\ No newline at end of file diff --git a/db/migrations_backup/0010_big_sue_storm.sql b/db/migrations_backup/0010_big_sue_storm.sql deleted file mode 100644 index 572b3c11..00000000 --- a/db/migrations_backup/0010_big_sue_storm.sql +++ /dev/null @@ -1,92 +0,0 @@ -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, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> 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, - "created_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, - "item_name" varchar(255) 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 "rfq_vendors" ( - "id" serial PRIMARY KEY NOT NULL, - "rfq_id" integer NOT NULL, - "vendor_id" integer NOT NULL, - "status" varchar(30) DEFAULT 'INVITED' NOT NULL, - "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_code" varchar(50), - "project_name" varchar(255), - "due_date" date, - "status" varchar(30) DEFAULT 'DRAFT' NOT NULL, - "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_quotes" ( - "id" serial PRIMARY KEY NOT NULL, - "rfq_id" integer NOT NULL, - "vendor_id" integer NOT NULL, - "total_amount" numeric(18, 2), - "currency" varchar(10) DEFAULT 'USD', - "lead_time" varchar(100), - "notes" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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_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_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_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 no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "rfq_vendors" ADD CONSTRAINT "rfq_vendors_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_vendors" ADD CONSTRAINT "rfq_vendors_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_quotes" ADD CONSTRAINT "vendor_quotes_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 "vendor_quotes" ADD CONSTRAINT "vendor_quotes_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE UNIQUE INDEX "rfq_vendors_unique_rfqs" ON "rfq_vendors" USING btree ("rfq_id","vendor_id");--> statement-breakpoint -CREATE UNIQUE INDEX "uq_vendor_quotes" ON "vendor_quotes" USING btree ("rfq_id","vendor_id");
\ No newline at end of file diff --git a/db/migrations_backup/0011_tense_madame_web.sql b/db/migrations_backup/0011_tense_madame_web.sql deleted file mode 100644 index 49414174..00000000 --- a/db/migrations_backup/0011_tense_madame_web.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "rfq_items" ALTER COLUMN "quantity" SET DEFAULT 1;--> statement-breakpoint -ALTER TABLE "rfqs" ALTER COLUMN "due_date" SET NOT NULL;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0012_giant_sunfire.sql b/db/migrations_backup/0012_giant_sunfire.sql deleted file mode 100644 index 97077702..00000000 --- a/db/migrations_backup/0012_giant_sunfire.sql +++ /dev/null @@ -1,6 +0,0 @@ -ALTER TABLE "rfq_items" DROP CONSTRAINT "rfq_items_rfq_id_rfqs_id_fk"; ---> statement-breakpoint -ALTER TABLE "rfq_vendors" DROP CONSTRAINT "rfq_vendors_rfq_id_rfqs_id_fk"; ---> 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_vendors" ADD CONSTRAINT "rfq_vendors_rfq_id_rfqs_id_fk" FOREIGN KEY ("rfq_id") REFERENCES "public"."rfqs"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0013_exotic_blazing_skull.sql b/db/migrations_backup/0013_exotic_blazing_skull.sql deleted file mode 100644 index 367cc428..00000000 --- a/db/migrations_backup/0013_exotic_blazing_skull.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "rfqs" ADD COLUMN "description" varchar(255);
\ No newline at end of file diff --git a/db/migrations_backup/0014_clammy_power_man.sql b/db/migrations_backup/0014_clammy_power_man.sql deleted file mode 100644 index 3fd6a1e3..00000000 --- a/db/migrations_backup/0014_clammy_power_man.sql +++ /dev/null @@ -1,14 +0,0 @@ -CREATE TABLE "items" ( - "id" serial PRIMARY KEY NOT NULL, - "item_code" varchar(100) PRIMARY KEY NOT NULL, - "item_name" varchar(255) NOT NULL, - "description" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "vendor_possible_items" ALTER COLUMN "item_code" SET NOT NULL;--> 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 "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 -ALTER TABLE "rfq_items" DROP COLUMN "item_name";--> statement-breakpoint -ALTER TABLE "vendor_possible_items" DROP COLUMN "item_name";
\ No newline at end of file diff --git a/db/migrations_backup/0015_black_fixer.sql b/db/migrations_backup/0015_black_fixer.sql deleted file mode 100644 index da6260c8..00000000 --- a/db/migrations_backup/0015_black_fixer.sql +++ /dev/null @@ -1,18 +0,0 @@ -/* - Unfortunately in current drizzle-kit version we can't automatically get name for primary key. - We are working on making it available! - - Meanwhile you can: - 1. Check pk name in your database, by running - SELECT constraint_name FROM information_schema.table_constraints - WHERE table_schema = 'public' - AND table_name = 'items' - AND constraint_type = 'PRIMARY KEY'; - 2. Uncomment code below and paste pk name manually - - Hope to release this update as soon as possible -*/ - --- ALTER TABLE "items" DROP CONSTRAINT "<constraint_name>";--> statement-breakpoint -ALTER TABLE "items" ALTER COLUMN "item_code" DROP NOT NULL;--> statement-breakpoint -ALTER TABLE "items" ADD CONSTRAINT "items_item_code_unique" UNIQUE("item_code");
\ No newline at end of file diff --git a/db/migrations_backup/0016_fat_komodo.sql b/db/migrations_backup/0016_fat_komodo.sql deleted file mode 100644 index f9e1840c..00000000 --- a/db/migrations_backup/0016_fat_komodo.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "users" DROP CONSTRAINT "users_company_id_companies_id_fk"; ---> statement-breakpoint -ALTER TABLE "rfq_attachments" ADD COLUMN "comment_id" integer;--> 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 "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;
\ No newline at end of file diff --git a/db/migrations_backup/0017_thin_chimera.sql b/db/migrations_backup/0017_thin_chimera.sql deleted file mode 100644 index 13ea1472..00000000 --- a/db/migrations_backup/0017_thin_chimera.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "rfq_comments" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0018_tiny_robbie_robertson.sql b/db/migrations_backup/0018_tiny_robbie_robertson.sql deleted file mode 100644 index 85367f7c..00000000 --- a/db/migrations_backup/0018_tiny_robbie_robertson.sql +++ /dev/null @@ -1,2 +0,0 @@ -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", "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");--> statement-breakpoint -CREATE VIEW "public"."vendor_rfqs_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0019_bumpy_anthem.sql b/db/migrations_backup/0019_bumpy_anthem.sql deleted file mode 100644 index 8d8498f1..00000000 --- a/db/migrations_backup/0019_bumpy_anthem.sql +++ /dev/null @@ -1,3 +0,0 @@ -DROP VIEW "public"."vendor_rfq_view";--> 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", "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"));--> 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", "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");
\ No newline at end of file diff --git a/db/migrations_backup/0020_chubby_carnage.sql b/db/migrations_backup/0020_chubby_carnage.sql deleted file mode 100644 index 5f0a6352..00000000 --- a/db/migrations_backup/0020_chubby_carnage.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_tbe_view";--> 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", "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"));
\ No newline at end of file diff --git a/db/migrations_backup/0021_nappy_dexter_bennett.sql b/db/migrations_backup/0021_nappy_dexter_bennett.sql deleted file mode 100644 index 77326cb4..00000000 --- a/db/migrations_backup/0021_nappy_dexter_bennett.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "vendors" ADD COLUMN "tax_id" varchar(100) NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0022_panoramic_mad_thinker.sql b/db/migrations_backup/0022_panoramic_mad_thinker.sql deleted file mode 100644 index dfdbd420..00000000 --- a/db/migrations_backup/0022_panoramic_mad_thinker.sql +++ /dev/null @@ -1,8 +0,0 @@ -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 -); ---> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0023_familiar_raza.sql b/db/migrations_backup/0023_familiar_raza.sql deleted file mode 100644 index 1345d0bb..00000000 --- a/db/migrations_backup/0023_familiar_raza.sql +++ /dev/null @@ -1,56 +0,0 @@ -CREATE TABLE "projects" ( - "id" serial PRIMARY KEY NOT NULL, - "code" varchar(50) NOT NULL, - "name" text 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, - "quantity" integer DEFAULT 1 NOT NULL, - "price" numeric(10, 2), - "remark" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "contract_items_item_id_unique" UNIQUE("item_id") -); ---> 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), - "vendor_id" integer NOT NULL, - "contract_no" varchar(100) NOT NULL, - "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL, - "start_date" date, - "end_date" date, - "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 "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), - "form_code" varchar(100) NOT NULL, - "form_name" varchar(255) NOT NULL, - "tag_type" varchar(50) NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL, - CONSTRAINT "forms_form_code_unique" UNIQUE("form_code") -); ---> 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, - "tag_no" varchar(100) NOT NULL, - "tag_type" varchar(50) NOT NULL, - "description" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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_items" ADD CONSTRAINT "contract_items_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("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 "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;
\ No newline at end of file diff --git a/db/migrations_backup/0024_eager_bill_hollister.sql b/db/migrations_backup/0024_eager_bill_hollister.sql deleted file mode 100644 index 4b7da41f..00000000 --- a/db/migrations_backup/0024_eager_bill_hollister.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "contract_items" ADD CONSTRAINT "contract_items_contract_id_item_id_unique" UNIQUE("contract_id","item_id");--> statement-breakpoint -ALTER TABLE "contract_items" ADD CONSTRAINT "contract_items_contract_item_idx" UNIQUE("contract_id","item_id");
\ No newline at end of file diff --git a/db/migrations_backup/0025_complex_husk.sql b/db/migrations_backup/0025_complex_husk.sql deleted file mode 100644 index d007055f..00000000 --- a/db/migrations_backup/0025_complex_husk.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "contract_items" DROP CONSTRAINT "contract_items_item_id_unique";
\ No newline at end of file diff --git a/db/migrations_backup/0026_tiresome_jackpot.sql b/db/migrations_backup/0026_tiresome_jackpot.sql deleted file mode 100644 index 96ea847b..00000000 --- a/db/migrations_backup/0026_tiresome_jackpot.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "contracts" ADD COLUMN "project_id" integer NOT NULL;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0027_yummy_senator_kelly.sql b/db/migrations_backup/0027_yummy_senator_kelly.sql deleted file mode 100644 index 4cdf5c1b..00000000 --- a/db/migrations_backup/0027_yummy_senator_kelly.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "contracts" ADD COLUMN "contract_name" varchar(255) NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0028_eminent_shockwave.sql b/db/migrations_backup/0028_eminent_shockwave.sql deleted file mode 100644 index e7c7997c..00000000 --- a/db/migrations_backup/0028_eminent_shockwave.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "forms" ADD COLUMN "contract_item_id" integer NOT NULL;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0029_oval_carmella_unuscione.sql b/db/migrations_backup/0029_oval_carmella_unuscione.sql deleted file mode 100644 index 78b2a4b0..00000000 --- a/db/migrations_backup/0029_oval_carmella_unuscione.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "tags" ADD COLUMN "form_id" integer;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0030_zippy_the_order.sql b/db/migrations_backup/0030_zippy_the_order.sql deleted file mode 100644 index 020f8329..00000000 --- a/db/migrations_backup/0030_zippy_the_order.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "form_entries" ( - "id" serial PRIMARY KEY NOT NULL, - "form_code" varchar(50) NOT NULL, - "data" 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 "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 -); diff --git a/db/migrations_backup/0031_curvy_starhawk.sql b/db/migrations_backup/0031_curvy_starhawk.sql deleted file mode 100644 index 019db4c6..00000000 --- a/db/migrations_backup/0031_curvy_starhawk.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "tags" ADD COLUMN "class" varchar(100) NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0032_unusual_speedball.sql b/db/migrations_backup/0032_unusual_speedball.sql deleted file mode 100644 index b977f270..00000000 --- a/db/migrations_backup/0032_unusual_speedball.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "forms" ADD COLUMN "class" varchar(100) NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0033_chemical_maggott.sql b/db/migrations_backup/0033_chemical_maggott.sql deleted file mode 100644 index 9c87c07e..00000000 --- a/db/migrations_backup/0033_chemical_maggott.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "form_entries" ADD COLUMN "contract_item_id" integer NOT NULL;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0035_sweet_revanche.sql b/db/migrations_backup/0035_sweet_revanche.sql deleted file mode 100644 index e54ae28c..00000000 --- a/db/migrations_backup/0035_sweet_revanche.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "tag_subfields" RENAME COLUMN "numbering_label" TO "attributes_description";--> statement-breakpoint -ALTER TABLE "tag_subfields" DROP COLUMN "subfield_type";
\ No newline at end of file diff --git a/db/migrations_backup/0036_aberrant_marvel_apes.sql b/db/migrations_backup/0036_aberrant_marvel_apes.sql deleted file mode 100644 index 54c6c86d..00000000 --- a/db/migrations_backup/0036_aberrant_marvel_apes.sql +++ /dev/null @@ -1,9 +0,0 @@ -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, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "tag_subfield_options" ALTER COLUMN "attributes_id" SET DATA TYPE varchar(50);
\ No newline at end of file diff --git a/db/migrations_backup/0037_legal_pretty_boy.sql b/db/migrations_backup/0037_legal_pretty_boy.sql deleted file mode 100644 index 603798fe..00000000 --- a/db/migrations_backup/0037_legal_pretty_boy.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "tag_type_class_form_mappings" ( - "id" serial PRIMARY KEY NOT NULL, - "tag_type" varchar(50) NOT NULL, - "class" varchar(100) 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 -); diff --git a/db/migrations_backup/0038_tough_mimic.sql b/db/migrations_backup/0038_tough_mimic.sql deleted file mode 100644 index 8ec5213a..00000000 --- a/db/migrations_backup/0038_tough_mimic.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "tag_type_class_form_mappings" RENAME COLUMN "tag_type" TO "tag_type_label";--> statement-breakpoint -ALTER TABLE "tag_type_class_form_mappings" RENAME COLUMN "class" TO "class_label";
\ No newline at end of file diff --git a/db/migrations_backup/0039_elite_zemo.sql b/db/migrations_backup/0039_elite_zemo.sql deleted file mode 100644 index 638b03ef..00000000 --- a/db/migrations_backup/0039_elite_zemo.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "tag_classes" ADD COLUMN "tag_type_code" varchar(50) NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_classes" ADD CONSTRAINT "tag_classes_tag_type_code_tag_subfields_tag_type_code_fk" FOREIGN KEY ("tag_type_code") REFERENCES "public"."tag_subfields"("tag_type_code") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_subfields" ADD CONSTRAINT "tag_subfields_tag_type_code_unique" UNIQUE("tag_type_code");
\ No newline at end of file diff --git a/db/migrations_backup/0040_absurd_human_cannonball.sql b/db/migrations_backup/0040_absurd_human_cannonball.sql deleted file mode 100644 index 7a6170f5..00000000 --- a/db/migrations_backup/0040_absurd_human_cannonball.sql +++ /dev/null @@ -1,15 +0,0 @@ -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 -ALTER TABLE "tag_subfields" DROP CONSTRAINT "tag_subfields_tag_type_code_unique";--> statement-breakpoint -ALTER TABLE "tag_classes" DROP CONSTRAINT "tag_classes_tag_type_code_tag_subfields_tag_type_code_fk"; ---> statement-breakpoint -ALTER TABLE "tag_classes" ALTER COLUMN "id" SET DATA TYPE serial;--> statement-breakpoint -ALTER TABLE "tag_classes" ALTER COLUMN "id" DROP IDENTITY;--> 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_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 "tag_subfields" DROP COLUMN "tag_type_description";
\ No newline at end of file diff --git a/db/migrations_backup/0041_absurd_spyke.sql b/db/migrations_backup/0041_absurd_spyke.sql deleted file mode 100644 index 99eca50c..00000000 --- a/db/migrations_backup/0041_absurd_spyke.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "tag_subfields" ADD CONSTRAINT "uniq_tag_type_attribute" UNIQUE("tag_type_code","attributes_id");
\ No newline at end of file diff --git a/db/migrations_backup/0042_panoramic_daimon_hellstrom.sql b/db/migrations_backup/0042_panoramic_daimon_hellstrom.sql deleted file mode 100644 index 83288796..00000000 --- a/db/migrations_backup/0042_panoramic_daimon_hellstrom.sql +++ /dev/null @@ -1,12 +0,0 @@ -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 -); diff --git a/db/migrations_backup/0043_pale_black_bird.sql b/db/migrations_backup/0043_pale_black_bird.sql deleted file mode 100644 index b50ea4e1..00000000 --- a/db/migrations_backup/0043_pale_black_bird.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "tag_classes" DROP CONSTRAINT "tag_classes_tag_type_code_tag_types_code_fk"; ---> statement-breakpoint -ALTER TABLE "tag_classes" DROP COLUMN "tag_type_code";
\ No newline at end of file diff --git a/db/migrations_backup/0044_lush_tenebrous.sql b/db/migrations_backup/0044_lush_tenebrous.sql deleted file mode 100644 index 514a440d..00000000 --- a/db/migrations_backup/0044_lush_tenebrous.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "tag_classes" ADD COLUMN "tag_type_code" varchar(50) NOT NULL;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0045_complex_gamora.sql b/db/migrations_backup/0045_complex_gamora.sql deleted file mode 100644 index f39e6de5..00000000 --- a/db/migrations_backup/0045_complex_gamora.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "tag_classes" ALTER COLUMN "id" SET DATA TYPE integer;--> statement-breakpoint -ALTER TABLE "tag_classes" ALTER COLUMN "id" ADD GENERATED ALWAYS AS IDENTITY (sequence name "tag_classes_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1);
\ No newline at end of file diff --git a/db/migrations_backup/0046_overjoyed_tinkerer.sql b/db/migrations_backup/0046_overjoyed_tinkerer.sql deleted file mode 100644 index 118d5f4c..00000000 --- a/db/migrations_backup/0046_overjoyed_tinkerer.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "forms" DROP COLUMN "tag_type";--> statement-breakpoint -ALTER TABLE "forms" DROP COLUMN "class";
\ No newline at end of file diff --git a/db/migrations_backup/0047_broad_the_executioner.sql b/db/migrations_backup/0047_broad_the_executioner.sql deleted file mode 100644 index 287830a0..00000000 --- a/db/migrations_backup/0047_broad_the_executioner.sql +++ /dev/null @@ -1,34 +0,0 @@ -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, - "file_path" varchar(255), - "approved_date" date, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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 "revisions" ADD CONSTRAINT "revisions_issue_stage_id_issue_stages_id_fk" FOREIGN KEY ("issue_stage_id") REFERENCES "public"."issue_stages"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0048_strange_ultimo.sql b/db/migrations_backup/0048_strange_ultimo.sql deleted file mode 100644 index 22abcf99..00000000 --- a/db/migrations_backup/0048_strange_ultimo.sql +++ /dev/null @@ -1,16 +0,0 @@ -CREATE TABLE "vendor_documents" ( - "vendor_id" integer NOT NULL, - "id" integer NOT NULL, - "doc_number" varchar(100) NOT NULL, - "title" varchar(255) NOT NULL, - "contract_id" integer NOT NULL, - "contract_no" varchar(100) NOT NULL, - "contract_name" varchar(255) NOT NULL, - "status" varchar(50) NOT NULL, - "created_at" timestamp with time zone, - "updated_at" timestamp with time zone -); ---> statement-breakpoint -ALTER TABLE "revisions" ALTER COLUMN "file_path" SET DATA TYPE varchar(1024);--> statement-breakpoint -ALTER TABLE "revisions" ALTER COLUMN "file_path" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "revisions" ADD COLUMN "file_name" varchar(255) NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0049_green_mattie_franklin.sql b/db/migrations_backup/0049_green_mattie_franklin.sql deleted file mode 100644 index bdab2091..00000000 --- a/db/migrations_backup/0049_green_mattie_franklin.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "revisions" DROP CONSTRAINT "revisions_issue_stage_id_issue_stages_id_fk"; ---> statement-breakpoint -CREATE UNIQUE INDEX "unique_stage_rev" ON "revisions" USING btree ("issue_stage_id","revision");
\ No newline at end of file diff --git a/db/migrations_backup/0050_furry_black_tarantula.sql b/db/migrations_backup/0050_furry_black_tarantula.sql deleted file mode 100644 index 66aaa47e..00000000 --- a/db/migrations_backup/0050_furry_black_tarantula.sql +++ /dev/null @@ -1,14 +0,0 @@ -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 -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 "revisions" DROP COLUMN "file_name";--> statement-breakpoint -ALTER TABLE "revisions" DROP COLUMN "file_path";
\ No newline at end of file diff --git a/db/migrations_backup/0051_perpetual_war_machine.sql b/db/migrations_backup/0051_perpetual_war_machine.sql deleted file mode 100644 index ec89fe0d..00000000 --- a/db/migrations_backup/0051_perpetual_war_machine.sql +++ /dev/null @@ -1,5 +0,0 @@ -ALTER TABLE "revisions" ADD COLUMN "uploader_type" varchar(20) DEFAULT 'vendor' NOT NULL;--> statement-breakpoint -ALTER TABLE "revisions" ADD COLUMN "uploader_id" integer;--> statement-breakpoint -ALTER TABLE "revisions" ADD COLUMN "uploader_name" varchar(100);--> statement-breakpoint -ALTER TABLE "revisions" ADD COLUMN "comment" varchar(500);--> statement-breakpoint -ALTER TABLE "revisions" ADD COLUMN "status" varchar(50);
\ No newline at end of file diff --git a/db/migrations_backup/0052_little_legion.sql b/db/migrations_backup/0052_little_legion.sql deleted file mode 100644 index 89cf16dd..00000000 --- a/db/migrations_backup/0052_little_legion.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "forms" DROP CONSTRAINT "forms_form_code_unique";--> statement-breakpoint -CREATE UNIQUE INDEX "contract_item_form_code_unique" ON "forms" USING btree ("contract_item_id","form_code");
\ No newline at end of file diff --git a/db/migrations_backup/0053_fantastic_synch.sql b/db/migrations_backup/0053_fantastic_synch.sql deleted file mode 100644 index ea43ba7e..00000000 --- a/db/migrations_backup/0053_fantastic_synch.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "projects" ADD COLUMN "type" varchar(20) DEFAULT 'ship' NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0054_polite_darwin.sql b/db/migrations_backup/0054_polite_darwin.sql deleted file mode 100644 index ead16a74..00000000 --- a/db/migrations_backup/0054_polite_darwin.sql +++ /dev/null @@ -1,81 +0,0 @@ -DROP TABLE "vendor_documents" CASCADE;--> 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, - c.contract_no, - c.name AS contract_name, - - c.vendor_id, - v.name AS vendor_name, - - c.project_id, - p.code AS project_code, - p.name AS project_name, - p.type AS project_type, - - ( - 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 - JOIN vendors v ON c.vendor_id = v.id - JOIN projects p ON c.project_id = p.id - );
\ No newline at end of file diff --git a/db/migrations_backup/0055_lonely_excalibur.sql b/db/migrations_backup/0055_lonely_excalibur.sql deleted file mode 100644 index 30d5d9bd..00000000 --- a/db/migrations_backup/0055_lonely_excalibur.sql +++ /dev/null @@ -1,69 +0,0 @@ -DROP VIEW "public"."vendor_documents_view";--> 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 - );
\ No newline at end of file diff --git a/db/migrations_backup/0056_majestic_khan.sql b/db/migrations_backup/0056_majestic_khan.sql deleted file mode 100644 index 161e1c3c..00000000 --- a/db/migrations_backup/0056_majestic_khan.sql +++ /dev/null @@ -1,34 +0,0 @@ -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, - - ( - SELECT json_agg( - json_build_object( - 'id', i.id, - 'stageName', i.stage_name, - 'planDate', i.plan_date, - 'actualDate', i.actual_date, - 'createdAt', i.created_at, - 'updatedAt', i.updated_at - ) - ) - FROM issue_stages i - WHERE i.document_id = d.id - ) AS stage_list, - - d.created_at, - d.updated_at - FROM documents d -);
\ No newline at end of file diff --git a/db/migrations_backup/0057_fancy_serpent_society.sql b/db/migrations_backup/0057_fancy_serpent_society.sql deleted file mode 100644 index 780d023b..00000000 --- a/db/migrations_backup/0057_fancy_serpent_society.sql +++ /dev/null @@ -1,29 +0,0 @@ -DROP VIEW "public"."document_stages_view";--> 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 -);
\ No newline at end of file diff --git a/db/migrations_backup/0058_familiar_bloodscream.sql b/db/migrations_backup/0058_familiar_bloodscream.sql deleted file mode 100644 index 6c4bdc8d..00000000 --- a/db/migrations_backup/0058_familiar_bloodscream.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE UNIQUE INDEX "unique_document_stage" ON "issue_stages" USING btree ("document_id","stage_name");
\ No newline at end of file diff --git a/db/migrations_backup/0059_familiar_yellow_claw.sql b/db/migrations_backup/0059_familiar_yellow_claw.sql deleted file mode 100644 index 902e8cde..00000000 --- a/db/migrations_backup/0059_familiar_yellow_claw.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE UNIQUE INDEX "unique_contract_doc_status" ON "documents" USING btree ("contract_id","doc_number","status");
\ No newline at end of file diff --git a/db/migrations_backup/0060_confused_ultimo.sql b/db/migrations_backup/0060_confused_ultimo.sql deleted file mode 100644 index ff3beef8..00000000 --- a/db/migrations_backup/0060_confused_ultimo.sql +++ /dev/null @@ -1,32 +0,0 @@ -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) -); ---> 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, - "attachment_paths" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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_criteria_id_pq_criterias_id_fk" FOREIGN KEY ("criteria_id") REFERENCES "public"."pq_criterias"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0061_warm_secret_warriors.sql b/db/migrations_backup/0061_warm_secret_warriors.sql deleted file mode 100644 index 61850127..00000000 --- a/db/migrations_backup/0061_warm_secret_warriors.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "pq_criterias" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint -ALTER TABLE "pq_criterias" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;
\ No newline at end of file diff --git a/db/migrations_backup/0062_zippy_human_torch.sql b/db/migrations_backup/0062_zippy_human_torch.sql deleted file mode 100644 index 907276e7..00000000 --- a/db/migrations_backup/0062_zippy_human_torch.sql +++ /dev/null @@ -1,12 +0,0 @@ -ALTER TABLE "vendors" ALTER COLUMN "status" SET DEFAULT 'PENDING_REVIEW';--> statement-breakpoint -ALTER TABLE "vendor_attachments" ADD COLUMN "attachment_type" varchar(50) DEFAULT 'GENERAL';--> statement-breakpoint -ALTER TABLE "vendor_attachments" ADD COLUMN "created_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint -ALTER TABLE "vendor_attachments" ADD COLUMN "updated_at" timestamp DEFAULT now() NOT NULL;--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "representative_name" varchar(255);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "representative_birth" varchar(20);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "representative_email" varchar(255);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "representative_phone" varchar(50);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "corporate_registration_number" varchar(100);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "credit_agency" varchar(50);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "credit_rating" varchar(50);--> statement-breakpoint -ALTER TABLE "vendors" ADD COLUMN "cash_flow_rating" varchar(50);
\ No newline at end of file diff --git a/db/migrations_backup/0063_amused_nightcrawler.sql b/db/migrations_backup/0063_amused_nightcrawler.sql deleted file mode 100644 index bd7b34b7..00000000 --- a/db/migrations_backup/0063_amused_nightcrawler.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "vendor_pq_criteria_answers" DROP COLUMN "attachment_paths";
\ No newline at end of file diff --git a/db/migrations_backup/0064_curved_tony_stark.sql b/db/migrations_backup/0064_curved_tony_stark.sql deleted file mode 100644 index e5f8b280..00000000 --- a/db/migrations_backup/0064_curved_tony_stark.sql +++ /dev/null @@ -1 +0,0 @@ -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;
\ No newline at end of file diff --git a/db/migrations_backup/0065_redundant_sunset_bain.sql b/db/migrations_backup/0065_redundant_sunset_bain.sql deleted file mode 100644 index ad2d8ca7..00000000 --- a/db/migrations_backup/0065_redundant_sunset_bain.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE "vendor_pq_review_logs" ( - "id" serial PRIMARY KEY NOT NULL, - "vendor_id" integer NOT NULL, - "reviewer_comment" text NOT NULL, - "reviewer_name" text, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "vendor_pq_review_logs" ADD CONSTRAINT "vendor_pq_review_logs_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0066_powerful_shard.sql b/db/migrations_backup/0066_powerful_shard.sql deleted file mode 100644 index cbd39199..00000000 --- a/db/migrations_backup/0066_powerful_shard.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "vendor_pq_review_logs" RENAME COLUMN "vendor_id" TO "vendor_pq_criteria_answer_id";--> statement-breakpoint -ALTER TABLE "vendor_pq_review_logs" DROP CONSTRAINT "vendor_pq_review_logs_vendor_id_vendors_id_fk"; ---> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0067_careless_chameleon.sql b/db/migrations_backup/0067_careless_chameleon.sql deleted file mode 100644 index 26dca9e5..00000000 --- a/db/migrations_backup/0067_careless_chameleon.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER TABLE "vendor_possible_items" DROP COLUMN "description";--> statement-breakpoint -CREATE VIEW "public"."vendor_items_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0068_worried_annihilus.sql b/db/migrations_backup/0068_worried_annihilus.sql deleted file mode 100644 index 8f53b83e..00000000 --- a/db/migrations_backup/0068_worried_annihilus.sql +++ /dev/null @@ -1,2 +0,0 @@ - -CREATE VIEW "public"."vendor_items_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0069_whole_madelyne_pryor.sql b/db/migrations_backup/0069_whole_madelyne_pryor.sql deleted file mode 100644 index 4db061a6..00000000 --- a/db/migrations_backup/0069_whole_madelyne_pryor.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_items_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_items_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0070_cool_rage.sql b/db/migrations_backup/0070_cool_rage.sql deleted file mode 100644 index ee4148eb..00000000 --- a/db/migrations_backup/0070_cool_rage.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_items_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_items_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0071_worthless_shadow_king.sql b/db/migrations_backup/0071_worthless_shadow_king.sql deleted file mode 100644 index 4311126a..00000000 --- a/db/migrations_backup/0071_worthless_shadow_king.sql +++ /dev/null @@ -1 +0,0 @@ -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_backup/0072_certain_punisher.sql b/db/migrations_backup/0072_certain_punisher.sql deleted file mode 100644 index f47de26d..00000000 --- a/db/migrations_backup/0072_certain_punisher.sql +++ /dev/null @@ -1 +0,0 @@ -ALTER TABLE "contract_items" DROP CONSTRAINT "contract_items_item_id_items_id_fk"; diff --git a/db/migrations_backup/0073_damp_reaper.sql b/db/migrations_backup/0073_damp_reaper.sql deleted file mode 100644 index 437a2d04..00000000 --- a/db/migrations_backup/0073_damp_reaper.sql +++ /dev/null @@ -1,13 +0,0 @@ -DROP VIEW "public"."vendor_rfq_view";--> statement-breakpoint -DROP VIEW "public"."vendor_rfqs_view";--> statement-breakpoint -DROP VIEW "public"."vendor_tbe_view";--> statement-breakpoint -ALTER TABLE "rfqs" ADD COLUMN "project_id" integer;--> statement-breakpoint -ALTER TABLE "rfqs" ADD COLUMN "rfq_type" varchar(30) DEFAULT 'PURCHASE';--> statement-breakpoint -ALTER TABLE "rfqs" ADD COLUMN "parent_rfq_id" integer;--> 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_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 "rfqs" DROP COLUMN "project_code";--> statement-breakpoint -ALTER TABLE "rfqs" DROP COLUMN "project_name";--> 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", "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");--> statement-breakpoint -CREATE VIEW "public"."vendor_rfqs_view" AS (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");--> 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", "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"));
\ No newline at end of file diff --git a/db/migrations_backup/0074_wet_ezekiel.sql b/db/migrations_backup/0074_wet_ezekiel.sql deleted file mode 100644 index d8651f05..00000000 --- a/db/migrations_backup/0074_wet_ezekiel.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_rfqs_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_rfqs_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0075_tough_epoch.sql b/db/migrations_backup/0075_tough_epoch.sql deleted file mode 100644 index 0428f864..00000000 --- a/db/migrations_backup/0075_tough_epoch.sql +++ /dev/null @@ -1,46 +0,0 @@ -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), - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> 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, - "signer_email" varchar(255), - "signer_name" varchar(100), - "signer_position" varchar(100), - "signer_status" varchar(50), - "signed_at" timestamp, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "contract_items" DROP CONSTRAINT "contract_items_contract_item_idx";--> statement-breakpoint -ALTER TABLE "contract_items" ADD COLUMN "description" text;--> statement-breakpoint -ALTER TABLE "contract_items" ADD COLUMN "unit_price" numeric(10, 2);--> statement-breakpoint -ALTER TABLE "contract_items" ADD COLUMN "tax_rate" numeric(5, 2);--> statement-breakpoint -ALTER TABLE "contract_items" ADD COLUMN "tax_amount" numeric(10, 2);--> statement-breakpoint -ALTER TABLE "contract_items" ADD COLUMN "total_line_amount" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "payment_terms" text;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "delivery_terms" text;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "delivery_date" date;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "delivery_location" varchar(255);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "currency" varchar(10) DEFAULT 'KRW';--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "total_amount" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "discount" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "tax" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "shipping_fee" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "net_total" numeric(12, 2);--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "partial_shipping_allowed" boolean DEFAULT false;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "partial_payment_allowed" boolean DEFAULT false;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "remarks" text;--> statement-breakpoint -ALTER TABLE "contracts" ADD COLUMN "version" integer DEFAULT 1;--> 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_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 -CREATE UNIQUE INDEX "contract_items_contract_item_idx" ON "contract_items" USING btree ("contract_id","item_id");--> statement-breakpoint -ALTER TABLE "contract_items" DROP COLUMN "price";
\ No newline at end of file diff --git a/db/migrations_backup/0076_cloudy_vindicator.sql b/db/migrations_backup/0076_cloudy_vindicator.sql deleted file mode 100644 index b8721caf..00000000 --- a/db/migrations_backup/0076_cloudy_vindicator.sql +++ /dev/null @@ -1 +0,0 @@ -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" 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_backup/0077_past_ted_forrester.sql b/db/migrations_backup/0077_past_ted_forrester.sql deleted file mode 100644 index 8168fd1d..00000000 --- a/db/migrations_backup/0077_past_ted_forrester.sql +++ /dev/null @@ -1 +0,0 @@ -CREATE VIEW "public"."rfqs_view" AS (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");
\ No newline at end of file diff --git a/db/migrations_backup/0078_empty_shooting_star.sql b/db/migrations_backup/0078_empty_shooting_star.sql deleted file mode 100644 index 032f9ae0..00000000 --- a/db/migrations_backup/0078_empty_shooting_star.sql +++ /dev/null @@ -1,26 +0,0 @@ -DROP VIEW "public"."rfqs_view";--> 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", ( - SELECT MAX("created_at") - FROM "rfq_attachments" - WHERE "rfq_attachments"."rfq_id" = "rfqs"."id" - ) as "latest_attachment_date", ( - SELECT MIN("unit_price") - FROM "rfq_items" - WHERE "rfq_items"."rfq_id" = "rfqs"."id" - ) as "min_item_price", ( - SELECT MAX("unit_price") - FROM "rfq_items" - WHERE "rfq_items"."rfq_id" = "rfqs"."id" - ) as "max_item_price", ( - SELECT SUM("unit_price" * "quantity") - FROM "rfq_items" - WHERE "rfq_items"."rfq_id" = "rfqs"."id" - ) as "total_items_amount" from "rfqs" left join "projects" on "rfqs"."project_id" = "projects"."id" left join "users" on "rfqs"."created_by" = "users"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0079_big_sue_storm.sql b/db/migrations_backup/0079_big_sue_storm.sql deleted file mode 100644 index c9d01535..00000000 --- a/db/migrations_backup/0079_big_sue_storm.sql +++ /dev/null @@ -1,10 +0,0 @@ -DROP VIEW "public"."rfqs_view";--> 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");
\ No newline at end of file diff --git a/db/migrations_backup/0080_slim_quasar.sql b/db/migrations_backup/0080_slim_quasar.sql deleted file mode 100644 index e7d4e183..00000000 --- a/db/migrations_backup/0080_slim_quasar.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP VIEW "public"."user_view";--> 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", "companies"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0081_wealthy_roxanne_simpson.sql b/db/migrations_backup/0081_wealthy_roxanne_simpson.sql deleted file mode 100644 index 90e63a27..00000000 --- a/db/migrations_backup/0081_wealthy_roxanne_simpson.sql +++ /dev/null @@ -1,4 +0,0 @@ -DROP VIEW "public"."user_view";--> 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");
\ No newline at end of file diff --git a/db/migrations_backup/0082_serious_revanche.sql b/db/migrations_backup/0082_serious_revanche.sql deleted file mode 100644 index c48e582b..00000000 --- a/db/migrations_backup/0082_serious_revanche.sql +++ /dev/null @@ -1,40 +0,0 @@ -CREATE TABLE "cbe_attachments" ( - "id" serial PRIMARY KEY NOT NULL, - "cbe_id" integer, - "file_name" varchar(255) NOT NULL, - "file_path" varchar(1024) NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "cbe_comments" ( - "id" serial PRIMARY KEY NOT NULL, - "cbe_id" integer, - "commented_by" integer, - "comment_text" text NOT NULL, - "created_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 -ALTER TABLE "cbe_attachments" ADD CONSTRAINT "cbe_attachments_cbe_id_cbe_evaluations_id_fk" FOREIGN KEY ("cbe_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "cbe_comments" ADD CONSTRAINT "cbe_comments_cbe_id_cbe_evaluations_id_fk" FOREIGN KEY ("cbe_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "cbe_comments" ADD CONSTRAINT "cbe_comments_commented_by_users_id_fk" FOREIGN KEY ("commented_by") REFERENCES "public"."users"("id") ON DELETE set null 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 -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");
\ No newline at end of file diff --git a/db/migrations_backup/0083_dark_firestar.sql b/db/migrations_backup/0083_dark_firestar.sql deleted file mode 100644 index 9b05fbe3..00000000 --- a/db/migrations_backup/0083_dark_firestar.sql +++ /dev/null @@ -1,3 +0,0 @@ -ALTER TABLE "roles" DROP CONSTRAINT "roles_company_id_companies_id_fk"; ---> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0084_familiar_skrulls.sql b/db/migrations_backup/0084_familiar_skrulls.sql deleted file mode 100644 index 95bed728..00000000 --- a/db/migrations_backup/0084_familiar_skrulls.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."role_view";--> 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");
\ No newline at end of file diff --git a/db/migrations_backup/0085_thankful_medusa.sql b/db/migrations_backup/0085_thankful_medusa.sql deleted file mode 100644 index d07347bb..00000000 --- a/db/migrations_backup/0085_thankful_medusa.sql +++ /dev/null @@ -1,6 +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" 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_backup/0086_chubby_proudstar.sql b/db/migrations_backup/0086_chubby_proudstar.sql deleted file mode 100644 index 450f31fb..00000000 --- a/db/migrations_backup/0086_chubby_proudstar.sql +++ /dev/null @@ -1,18 +0,0 @@ -CREATE TABLE "form_templates" ( - "id" serial PRIMARY KEY NOT NULL, - "form_id" integer, - "file_name" varchar(255) NOT NULL, - "file_path" varchar(1024) NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "contract_signers" ALTER COLUMN "signer_email" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "contract_signers" ALTER COLUMN "signer_name" SET NOT NULL;--> statement-breakpoint -ALTER TABLE "contract_signers" ALTER COLUMN "signer_status" SET DEFAULT 'PENDING';--> statement-breakpoint -ALTER TABLE "contract_envelopes" ADD COLUMN "file_name" varchar(255) NOT NULL;--> statement-breakpoint -ALTER TABLE "contract_envelopes" ADD COLUMN "file_path" varchar(1024) NOT NULL;--> statement-breakpoint -ALTER TABLE "contract_signers" ADD COLUMN "vendor_contact_id" integer;--> statement-breakpoint -ALTER TABLE "contract_signers" ADD COLUMN "signer_type" varchar(20) DEFAULT 'VENDOR' NOT NULL;--> statement-breakpoint -ALTER TABLE "form_templates" ADD CONSTRAINT "form_templates_form_id_forms_id_fk" FOREIGN KEY ("form_id") REFERENCES "public"."forms"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "contract_signers" ADD CONSTRAINT "contract_signers_vendor_contact_id_vendor_contacts_id_fk" FOREIGN KEY ("vendor_contact_id") REFERENCES "public"."vendor_contacts"("id") ON DELETE no action ON UPDATE no action;
\ No newline at end of file diff --git a/db/migrations_backup/0087_tidy_eddie_brock.sql b/db/migrations_backup/0087_tidy_eddie_brock.sql deleted file mode 100644 index 533d3a40..00000000 --- a/db/migrations_backup/0087_tidy_eddie_brock.sql +++ /dev/null @@ -1,59 +0,0 @@ -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 -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 -CREATE UNIQUE INDEX "vendor_response_unique" ON "vendor_responses" USING btree ("rfq_id","vendor_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", "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"));
\ No newline at end of file diff --git a/db/migrations_backup/0088_secret_quentin_quire.sql b/db/migrations_backup/0088_secret_quentin_quire.sql deleted file mode 100644 index c19408e9..00000000 --- a/db/migrations_backup/0088_secret_quentin_quire.sql +++ /dev/null @@ -1,13 +0,0 @@ -DROP VIEW "public"."vendor_rfqs_view";--> statement-breakpoint -DROP VIEW "public"."vendor_rfq_view";--> statement-breakpoint -DROP VIEW "public"."vendor_tbe_view";--> statement-breakpoint -DROP VIEW "public"."vendor_responses_view";--> statement-breakpoint -DROP TABLE "rfq_vendors" CASCADE;--> statement-breakpoint -DROP TABLE "vendor_quotes" CASCADE;--> 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"."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"));--> statement-breakpoint -CREATE VIEW "public"."vendor_responses_view" AS (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", ( - 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"));
\ No newline at end of file diff --git a/db/migrations_backup/0089_faulty_lester.sql b/db/migrations_backup/0089_faulty_lester.sql deleted file mode 100644 index 9d495f30..00000000 --- a/db/migrations_backup/0089_faulty_lester.sql +++ /dev/null @@ -1,6 +0,0 @@ -DROP VIEW "public"."vendor_responses_view";--> 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"));
\ No newline at end of file diff --git a/db/migrations_backup/0090_outstanding_sebastian_shaw.sql b/db/migrations_backup/0090_outstanding_sebastian_shaw.sql deleted file mode 100644 index d448890b..00000000 --- a/db/migrations_backup/0090_outstanding_sebastian_shaw.sql +++ /dev/null @@ -1,7 +0,0 @@ -ALTER TABLE "cbe_attachments" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint -ALTER TABLE "cbe_comments" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint -DROP VIEW "public"."vendor_tbe_view";--> statement-breakpoint -DROP TABLE "cbe_attachments" CASCADE;--> statement-breakpoint -DROP TABLE "cbe_comments" CASCADE;--> statement-breakpoint -ALTER TABLE "rfq_comments" ADD CONSTRAINT "rfq_comments_evaluation_id_cbe_evaluations_id_fk" FOREIGN KEY ("evaluation_id") REFERENCES "public"."cbe_evaluations"("id") ON DELETE no action ON UPDATE no action;--> 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"."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"));
\ No newline at end of file diff --git a/db/migrations_backup/0091_condemned_warstar.sql b/db/migrations_backup/0091_condemned_warstar.sql deleted file mode 100644 index e4b74f2c..00000000 --- a/db/migrations_backup/0091_condemned_warstar.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_tbe_view";--> 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_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"));
\ No newline at end of file diff --git a/db/migrations_backup/0092_smart_karma.sql b/db/migrations_backup/0092_smart_karma.sql deleted file mode 100644 index 1ce421b9..00000000 --- a/db/migrations_backup/0092_smart_karma.sql +++ /dev/null @@ -1,2 +0,0 @@ -DROP VIEW "public"."vendor_tbe_view";--> 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"));
\ No newline at end of file diff --git a/db/migrations_backup/0093_young_the_hunter.sql b/db/migrations_backup/0093_young_the_hunter.sql deleted file mode 100644 index f290be7f..00000000 --- a/db/migrations_backup/0093_young_the_hunter.sql +++ /dev/null @@ -1 +0,0 @@ -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"));
\ No newline at end of file diff --git a/db/migrations_backup/0094_brave_sue_storm.sql b/db/migrations_backup/0094_brave_sue_storm.sql deleted file mode 100644 index bdea91f0..00000000 --- a/db/migrations_backup/0094_brave_sue_storm.sql +++ /dev/null @@ -1,55 +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', 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_backup/0094_fresh_blur.sql b/db/migrations_backup/0094_fresh_blur.sql deleted file mode 100644 index 007336d2..00000000 --- a/db/migrations_backup/0094_fresh_blur.sql +++ /dev/null @@ -1,783 +0,0 @@ -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_backup/0094_yellow_living_tribunal.sql b/db/migrations_backup/0094_yellow_living_tribunal.sql deleted file mode 100644 index 6e97ef73..00000000 --- a/db/migrations_backup/0094_yellow_living_tribunal.sql +++ /dev/null @@ -1,4 +0,0 @@ -ALTER TABLE "rfq_comments" DROP CONSTRAINT "rfq_comments_evaluation_id_cbe_evaluations_id_fk"; ---> statement-breakpoint -ALTER TABLE "rfq_comments" ADD COLUMN "cbe_id" integer;--> 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;
\ No newline at end of file diff --git a/db/migrations_backup/0095_abnormal_virginia_dare.sql b/db/migrations_backup/0095_abnormal_virginia_dare.sql deleted file mode 100644 index bdea91f0..00000000 --- a/db/migrations_backup/0095_abnormal_virginia_dare.sql +++ /dev/null @@ -1,55 +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', 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_backup/0095_mute_lizard.sql b/db/migrations_backup/0095_mute_lizard.sql deleted file mode 100644 index 062fcf53..00000000 --- a/db/migrations_backup/0095_mute_lizard.sql +++ /dev/null @@ -1 +0,0 @@ -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;
\ No newline at end of file diff --git a/db/migrations_backup/0095_odd_slayback.sql b/db/migrations_backup/0095_odd_slayback.sql deleted file mode 100644 index bdea91f0..00000000 --- a/db/migrations_backup/0095_odd_slayback.sql +++ /dev/null @@ -1,55 +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', 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_backup/0096_real_inhumans.sql b/db/migrations_backup/0096_real_inhumans.sql deleted file mode 100644 index d97dc83e..00000000 --- a/db/migrations_backup/0096_real_inhumans.sql +++ /dev/null @@ -1,85 +0,0 @@ -CREATE TABLE "poa" ( - "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "poa_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), - "contract_no" varchar(100) NOT NULL, - "original_contract_no" varchar(100) NOT NULL, - "project_id" integer NOT NULL, - "vendor_id" integer NOT NULL, - "original_contract_name" varchar(255) NOT NULL, - "original_status" varchar(50) NOT NULL, - "delivery_terms" text, - "delivery_date" date, - "delivery_location" varchar(255), - "currency" varchar(10), - "total_amount" numeric(12, 2), - "discount" numeric(12, 2), - "tax" numeric(12, 2), - "shipping_fee" numeric(12, 2), - "net_total" numeric(12, 2), - "change_reason" text, - "approval_status" varchar(50) DEFAULT 'PENDING', - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "vendor_investigation_attachments" ( - "id" serial PRIMARY KEY NOT NULL, - "investigation_id" integer NOT NULL, - "file_name" varchar(255) NOT NULL, - "file_path" varchar(1024) NOT NULL, - "attachment_type" varchar(50) DEFAULT 'REPORT', - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -CREATE TABLE "vendor_investigations" ( - "id" serial PRIMARY KEY NOT NULL, - "vendor_id" integer NOT NULL, - "status" varchar(50) DEFAULT 'PLANNED' NOT NULL, - "scheduled_start_at" timestamp, - "scheduled_end_at" timestamp, - "completed_at" timestamp, - "investigation_notes" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "poa" ADD CONSTRAINT "poa_original_contract_no_contracts_contract_no_fk" FOREIGN KEY ("original_contract_no") REFERENCES "public"."contracts"("contract_no") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "poa" ADD CONSTRAINT "poa_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "poa" ADD CONSTRAINT "poa_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_investigation_attachments" ADD CONSTRAINT "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk" FOREIGN KEY ("investigation_id") REFERENCES "public"."vendor_investigations"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "vendor_investigations" ADD CONSTRAINT "vendor_investigations_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint -CREATE VIEW "public"."poa_detail_view" AS (select "poa"."id", "poa"."contract_no", "contracts"."project_id", "contracts"."vendor_id", "poa"."change_reason", "poa"."approval_status", "contracts"."contract_name" as "original_contract_name", "contracts"."status" as "original_status", "contracts"."start_date" as "original_start_date", "contracts"."end_date" as "original_end_date", "poa"."delivery_terms", "poa"."delivery_date", "poa"."delivery_location", "poa"."currency", "poa"."total_amount", "poa"."discount", "poa"."tax", "poa"."shipping_fee", "poa"."net_total", "poa"."created_at", "poa"."updated_at", EXISTS ( - SELECT 1 - FROM "contract_envelopes" - WHERE "contract_envelopes"."contract_id" = "poa"."id" - ) as "has_signature" from "poa" left join "contracts" on "poa"."contract_no" = "contracts"."contract_no");--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendors"."id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'id', c.id, - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'createdAt', c.created_at, - 'updatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'id', pi.id, - 'vendorId', pi.vendor_id, - 'itemCode', pi.item_code, - 'createdAt', pi.created_at, - 'updatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0097_luxuriant_taskmaster.sql b/db/migrations_backup/0097_luxuriant_taskmaster.sql deleted file mode 100644 index db42ff3f..00000000 --- a/db/migrations_backup/0097_luxuriant_taskmaster.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendors"."id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactId', c.id, - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'createdAt', c.created_at, - 'updatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemId', pi.id, - 'vendorId', pi.vendor_id, - 'itemCode', pi.item_code, - 'createdAt', pi.created_at, - 'updatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0098_easy_may_parker.sql b/db/migrations_backup/0098_easy_may_parker.sql deleted file mode 100644 index 0d5ae836..00000000 --- a/db/migrations_backup/0098_easy_may_parker.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendors"."id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactId', c.id, - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemId', pi.id, - 'itemVendorId', pi.vendor_id, - 'itemCode', pi.item_code, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0099_clear_captain_marvel.sql b/db/migrations_backup/0099_clear_captain_marvel.sql deleted file mode 100644 index f2db52f8..00000000 --- a/db/migrations_backup/0099_clear_captain_marvel.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendors"."id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemId', pi.id, - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0100_normal_dreaming_celestial.sql b/db/migrations_backup/0100_normal_dreaming_celestial.sql deleted file mode 100644 index c3ec34b5..00000000 --- a/db/migrations_backup/0100_normal_dreaming_celestial.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendors"."id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0101_curious_landau.sql b/db/migrations_backup/0101_curious_landau.sql deleted file mode 100644 index e0ce3bc2..00000000 --- a/db/migrations_backup/0101_curious_landau.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendor_investigations"."vendor_id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0102_organic_bloodscream.sql b/db/migrations_backup/0102_organic_bloodscream.sql deleted file mode 100644 index b295d844..00000000 --- a/db/migrations_backup/0102_organic_bloodscream.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendor_investigations"."vendor_id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", "vendors"."created_at", "vendors"."updated_at", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0103_married_risque.sql b/db/migrations_backup/0103_married_risque.sql deleted file mode 100644 index ecbc27dc..00000000 --- a/db/migrations_backup/0103_married_risque.sql +++ /dev/null @@ -1,30 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendor_investigations"."vendor_id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0104_lovely_captain_america.sql b/db/migrations_backup/0104_lovely_captain_america.sql deleted file mode 100644 index fadb6dc2..00000000 --- a/db/migrations_backup/0104_lovely_captain_america.sql +++ /dev/null @@ -1,31 +0,0 @@ -DROP VIEW "public"."vendor_investigations_view";--> statement-breakpoint -ALTER TABLE "vendor_investigations" RENAME COLUMN "status" TO "investigation_status";--> statement-breakpoint -CREATE VIEW "public"."vendor_investigations_view" AS (select "vendor_investigations"."id", "vendor_investigations"."investigation_status", "vendor_investigations"."scheduled_start_at", "vendor_investigations"."scheduled_end_at", "vendor_investigations"."completed_at", "vendor_investigations"."investigation_notes", "vendor_investigations"."created_at", "vendor_investigations"."updated_at", "vendor_investigations"."vendor_id", "vendors"."vendor_name", "vendors"."vendor_code", "vendors"."tax_id", "vendors"."status", "vendors"."country", "vendors"."email", "vendors"."phone", "vendors"."website", ( - SELECT COALESCE( - json_agg(json_build_object( - 'contactName', c.contact_name, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'contactPosition', c.contact_position, - 'isPrimary', c.is_primary, - 'contactCreatedAt', c.created_at, - 'contactUpdatedAt', c.updated_at - )), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "vendors"."id" - ) as "contacts", ( - SELECT COALESCE( - json_agg(json_build_object( - 'itemCode', pi.item_code, - 'itemName', i.item_name, - 'itemCreatedAt', pi.created_at, - 'itemUpdatedAt', pi.updated_at - )), - '[]'::json - ) - FROM vendor_possible_items pi - LEFT JOIN items i ON pi.item_code = i.item_code - WHERE pi.vendor_id = "vendors"."id" - ) as "possibleItems" from "vendor_investigations" left join "vendors" on "vendor_investigations"."vendor_id" = "vendors"."id");
\ No newline at end of file diff --git a/db/migrations_backup/0105_eminent_brother_voodoo.sql b/db/migrations_backup/0105_eminent_brother_voodoo.sql deleted file mode 100644 index 88bb4fdf..00000000 --- a/db/migrations_backup/0105_eminent_brother_voodoo.sql +++ /dev/null @@ -1,11 +0,0 @@ -CREATE TABLE "vendor_candidates" ( - "id" serial PRIMARY KEY NOT NULL, - "company_name" varchar(255) NOT NULL, - "contact_email" varchar(255) NOT NULL, - "contact_phone" varchar(50), - "country" varchar(100), - "source" varchar(100), - "status" varchar(30) DEFAULT 'COLLECTED' NOT NULL, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); diff --git a/db/migrations_backup/0106_mature_hawkeye.sql b/db/migrations_backup/0106_mature_hawkeye.sql deleted file mode 100644 index 7d6fde8d..00000000 --- a/db/migrations_backup/0106_mature_hawkeye.sql +++ /dev/null @@ -1,42 +0,0 @@ -DROP TABLE "tasks" CASCADE;--> statement-breakpoint -CREATE VIEW "public"."vendor_detail_view" AS (select "id", "vendor_name", "vendor_code", "tax_id", "address", "country", "phone", "email", "website", "status", "representative_name", "representative_birth", "representative_email", "representative_phone", "corporate_registration_number", "credit_agency", "credit_rating", "cash_flow_rating", "created_at", "updated_at", ( - SELECT COALESCE( - json_agg( - json_build_object( - 'id', c.id, - 'contactName', c.contact_name, - 'contactPosition', c.contact_position, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'isPrimary', c.is_primary - ) - ), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = "id" - ) as "contacts", ( - SELECT COALESCE( - json_agg( - json_build_object( - 'id', a.id, - 'fileName', a.file_name, - 'filePath', a.file_path, - 'attachmentType', a.attachment_type, - 'createdAt', a.created_at - ) - ORDER BY a.attachment_type, a.created_at DESC - ), - '[]'::json - ) - FROM vendor_attachments a - WHERE a.vendor_id = "id" - ) as "attachments", ( - SELECT COUNT(*) - FROM vendor_attachments a - WHERE a.vendor_id = "id" - ) as "attachment_count", ( - SELECT COUNT(*) - FROM vendor_contacts c - WHERE c.vendor_id = "id" - ) as "contact_count" from "vendors");
\ No newline at end of file diff --git a/db/migrations_backup/0107_curly_thor.sql b/db/migrations_backup/0107_curly_thor.sql deleted file mode 100644 index 72b8e1ad..00000000 --- a/db/migrations_backup/0107_curly_thor.sql +++ /dev/null @@ -1,12 +0,0 @@ -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") -); diff --git a/db/migrations_backup/0108_known_grim_reaper.sql b/db/migrations_backup/0108_known_grim_reaper.sql deleted file mode 100644 index 3cf24516..00000000 --- a/db/migrations_backup/0108_known_grim_reaper.sql +++ /dev/null @@ -1,42 +0,0 @@ -DROP VIEW "public"."vendor_detail_view";--> statement-breakpoint -CREATE VIEW "public"."vendor_detail_view" AS (select "id", "vendor_name", "vendor_code", "tax_id", "address", "country", "phone", "email", "website", "status", "representative_name", "representative_birth", "representative_email", "representative_phone", "corporate_registration_number", "credit_agency", "credit_rating", "cash_flow_rating", "created_at", "updated_at", - (SELECT COALESCE( - json_agg( - json_build_object( - 'id', c.id, - 'contactName', c.contact_name, - 'contactPosition', c.contact_position, - 'contactEmail', c.contact_email, - 'contactPhone', c.contact_phone, - 'isPrimary', c.is_primary - ) - ), - '[]'::json - ) - FROM vendor_contacts c - WHERE c.vendor_id = vendors.id) - as "contacts", - (SELECT COALESCE( - json_agg( - json_build_object( - 'id', a.id, - 'fileName', a.file_name, - 'filePath', a.file_path, - 'attachmentType', a.attachment_type, - 'createdAt', a.created_at - ) - ORDER BY a.attachment_type, a.created_at DESC - ), - '[]'::json - ) - FROM vendor_attachments a - WHERE a.vendor_id = vendors.id) - as "attachments", - (SELECT COUNT(*) - FROM vendor_attachments a - WHERE a.vendor_id = vendors.id) - as "attachment_count", - (SELECT COUNT(*) - FROM vendor_contacts c - WHERE c.vendor_id = vendors.id) - as "contact_count" from "vendors");
\ No newline at end of file diff --git a/db/migrations_backup/0109_wooden_blade.sql b/db/migrations_backup/0109_wooden_blade.sql deleted file mode 100644 index 215bba5b..00000000 --- a/db/migrations_backup/0109_wooden_blade.sql +++ /dev/null @@ -1,12 +0,0 @@ -CREATE TABLE "pq_criterias_extension" ( - "id" serial PRIMARY KEY NOT NULL, - "pq_criteria_id" integer NOT NULL, - "project_id" integer NOT NULL, - "contract_info" text, - "additional_requirement" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "pq_criterias_extension" ADD CONSTRAINT "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk" FOREIGN KEY ("pq_criteria_id") REFERENCES "public"."pq_criterias"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint -ALTER TABLE "pq_criterias_extension" ADD CONSTRAINT "pq_criterias_extension_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE cascade;
\ No newline at end of file diff --git a/db/migrations_backup/0110_round_iron_monger.sql b/db/migrations_backup/0110_round_iron_monger.sql deleted file mode 100644 index f41290d3..00000000 --- a/db/migrations_backup/0110_round_iron_monger.sql +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE "vendor_project_pqs" ( - "id" serial PRIMARY KEY NOT NULL, - "vendor_id" integer NOT NULL, - "project_id" integer NOT NULL, - "status" varchar(20) DEFAULT 'REQUESTED' NOT NULL, - "submitted_at" timestamp, - "approved_at" timestamp, - "rejected_at" timestamp, - "reject_reason" text, - "created_at" timestamp DEFAULT now() NOT NULL, - "updated_at" timestamp DEFAULT now() NOT NULL -); ---> statement-breakpoint -ALTER TABLE "vendor_pq_criteria_answers" DROP CONSTRAINT "vendor_pq_criteria_answers_vendor_id_vendors_id_fk"; ---> statement-breakpoint -ALTER TABLE "vendor_pq_criteria_answers" DROP CONSTRAINT "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk"; ---> statement-breakpoint -ALTER TABLE "vendor_pq_criteria_answers" ADD COLUMN "project_id" integer;--> statement-breakpoint -ALTER TABLE "vendor_project_pqs" ADD CONSTRAINT "vendor_project_pqs_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint -ALTER TABLE "vendor_project_pqs" ADD CONSTRAINT "vendor_project_pqs_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE cascade;--> statement-breakpoint -ALTER TABLE "vendor_pq_criteria_answers" ADD CONSTRAINT "vendor_pq_criteria_answers_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE cascade;--> 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 cascade;--> 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 cascade;
\ No newline at end of file diff --git a/db/migrations_backup/0111_old_amphibian.sql b/db/migrations_backup/0111_old_amphibian.sql deleted file mode 100644 index 95aadf9f..00000000 --- a/db/migrations_backup/0111_old_amphibian.sql +++ /dev/null @@ -1,49 +0,0 @@ -ALTER TABLE "form_templates" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint -ALTER TABLE "view_tag_subfields" DISABLE ROW LEVEL SECURITY;--> statement-breakpoint -DROP TABLE "form_templates" CASCADE;--> statement-breakpoint -DROP TABLE "view_tag_subfields" CASCADE;--> statement-breakpoint -ALTER TABLE "tag_subfields" DROP CONSTRAINT "uniq_tag_type_attribute";--> statement-breakpoint -ALTER TABLE "tag_classes" DROP CONSTRAINT "tag_classes_tag_type_code_tag_types_code_fk"; ---> statement-breakpoint -ALTER TABLE "tag_subfield_options" DROP CONSTRAINT "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk"; ---> statement-breakpoint -ALTER TABLE "tag_subfields" DROP CONSTRAINT "tag_subfields_tag_type_code_tag_types_code_fk"; ---> statement-breakpoint -/* - Unfortunately in current drizzle-kit version we can't automatically get name for primary key. - We are working on making it available! - - Meanwhile you can: - 1. Check pk name in your database, by running - SELECT constraint_name FROM information_schema.table_constraints - WHERE table_schema = 'public' - AND table_name = 'tag_types' - AND constraint_type = 'PRIMARY KEY'; - 2. Uncomment code below and paste pk name manually - - Hope to release this update as soon as possible -*/ - --- ALTER TABLE "tag_types" DROP CONSTRAINT "<constraint_name>";--> statement-breakpoint -ALTER TABLE "tag_types" ADD CONSTRAINT "tag_types_code_project_id_pk" PRIMARY KEY("code","project_id");--> statement-breakpoint -ALTER TABLE "form_metas" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_classes" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_subfield_options" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_subfields" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_type_class_form_mappings" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "tag_types" ADD COLUMN "project_id" integer NOT NULL;--> statement-breakpoint -ALTER TABLE "form_metas" ADD CONSTRAINT "form_metas_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_classes" ADD CONSTRAINT "tag_classes_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_classes" ADD CONSTRAINT "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk" FOREIGN KEY ("tag_type_code","project_id") REFERENCES "public"."tag_types"("code","project_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_subfield_options" ADD CONSTRAINT "tag_subfield_options_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_subfield_options" ADD CONSTRAINT "tag_subfield_options_attributes_id_project_id_tag_subfields_attributes_id_project_id_fk" FOREIGN KEY ("attributes_id","project_id") REFERENCES "public"."tag_subfields"("attributes_id","project_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_subfields" ADD CONSTRAINT "tag_subfields_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_subfields" ADD CONSTRAINT "tag_subfields_tag_type_code_project_id_tag_types_code_project_id_fk" FOREIGN KEY ("tag_type_code","project_id") REFERENCES "public"."tag_types"("code","project_id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_type_class_form_mappings" ADD CONSTRAINT "tag_type_class_form_mappings_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "tag_types" ADD CONSTRAINT "tag_types_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint -ALTER TABLE "form_metas" ADD CONSTRAINT "form_code_project_unique" UNIQUE("project_id","form_code");--> statement-breakpoint -ALTER TABLE "tag_classes" ADD CONSTRAINT "uniq_code_in_project" UNIQUE("project_id","code");--> statement-breakpoint -ALTER TABLE "tag_subfield_options" ADD CONSTRAINT "uniq_attribute_project_code" UNIQUE("project_id","attributes_id","code");--> statement-breakpoint -ALTER TABLE "tag_subfields" ADD CONSTRAINT "uniq_tag_type_attribute" UNIQUE("project_id","tag_type_code","attributes_id");--> statement-breakpoint -ALTER TABLE "tag_type_class_form_mappings" ADD CONSTRAINT "uniq_mapping_in_project" UNIQUE("project_id","tag_type_label","class_label","form_code");--> statement-breakpoint -CREATE VIEW "public"."view_tag_subfields" AS (select "tag_subfields"."id", "tag_subfields"."project_id", "tag_subfields"."tag_type_code", "tag_types"."description", "tag_subfields"."attributes_id", "tag_subfields"."attributes_description", "tag_subfields"."expression", "tag_subfields"."delimiter", "tag_subfields"."sort_order", "tag_subfields"."created_at", "tag_subfields"."updated_at", "projects"."code", "projects"."name" from "tag_subfields" inner join "tag_types" on ("tag_subfields"."tag_type_code" = "tag_types"."code" and "tag_subfields"."project_id" = "tag_types"."project_id") inner join "projects" on "tag_subfields"."project_id" = "projects"."id");
\ No newline at end of file diff --git a/db/migrations_backup/meta/0094_snapshot.json b/db/migrations_backup/meta/0094_snapshot.json deleted file mode 100644 index acc0c4b0..00000000 --- a/db/migrations_backup/meta/0094_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78", - "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.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\", 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, - "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_backup/meta/0095_snapshot.json b/db/migrations_backup/meta/0095_snapshot.json deleted file mode 100644 index cf5f424c..00000000 --- a/db/migrations_backup/meta/0095_snapshot.json +++ /dev/null @@ -1,4757 +0,0 @@ -{ - "id": "a87c6f47-5579-4e23-9f26-6a6da4a21a1c", - "prevId": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78", - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_backup/meta/0096_snapshot.json b/db/migrations_backup/meta/0096_snapshot.json deleted file mode 100644 index e3959df5..00000000 --- a/db/migrations_backup/meta/0096_snapshot.json +++ /dev/null @@ -1,5327 +0,0 @@ -{ - "id": "97c1fa3b-9071-43b6-a2d0-cd9fa2d2b5af", - "prevId": "a87c6f47-5579-4e23-9f26-6a6da4a21a1c", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_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 - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'createdAt', c.created_at,\n 'updatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'id', pi.id,\n 'vendorId', pi.vendor_id,\n 'itemCode', pi.item_code,\n 'createdAt', pi.created_at,\n 'updatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0097_snapshot.json b/db/migrations_backup/meta/0097_snapshot.json deleted file mode 100644 index 0661f225..00000000 --- a/db/migrations_backup/meta/0097_snapshot.json +++ /dev/null @@ -1,5327 +0,0 @@ -{ - "id": "2f688857-1fcb-42e8-b5af-f898a5dae533", - "prevId": "97c1fa3b-9071-43b6-a2d0-cd9fa2d2b5af", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_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 - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactId', c.id,\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'createdAt', c.created_at,\n 'updatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemId', pi.id,\n 'vendorId', pi.vendor_id,\n 'itemCode', pi.item_code,\n 'createdAt', pi.created_at,\n 'updatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0098_snapshot.json b/db/migrations_backup/meta/0098_snapshot.json deleted file mode 100644 index 25ccc2e5..00000000 --- a/db/migrations_backup/meta/0098_snapshot.json +++ /dev/null @@ -1,5327 +0,0 @@ -{ - "id": "d6f3d748-5f80-4777-bf03-82264c0958ee", - "prevId": "2f688857-1fcb-42e8-b5af-f898a5dae533", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_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 - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactId', c.id,\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemId', pi.id,\n 'itemVendorId', pi.vendor_id,\n 'itemCode', pi.item_code,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0099_snapshot.json b/db/migrations_backup/meta/0099_snapshot.json deleted file mode 100644 index 39ca84da..00000000 --- a/db/migrations_backup/meta/0099_snapshot.json +++ /dev/null @@ -1,5327 +0,0 @@ -{ - "id": "9104ca46-bc65-418a-847c-767bd553c292", - "prevId": "d6f3d748-5f80-4777-bf03-82264c0958ee", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_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 - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemId', pi.id,\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0100_snapshot.json b/db/migrations_backup/meta/0100_snapshot.json deleted file mode 100644 index a871d4d7..00000000 --- a/db/migrations_backup/meta/0100_snapshot.json +++ /dev/null @@ -1,5327 +0,0 @@ -{ - "id": "8c70af83-c639-43c9-a9d8-9d570eab3eaf", - "prevId": "9104ca46-bc65-418a-847c-767bd553c292", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_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 - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendors\".\"id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0101_snapshot.json b/db/migrations_backup/meta/0101_snapshot.json deleted file mode 100644 index d38330b9..00000000 --- a/db/migrations_backup/meta/0101_snapshot.json +++ /dev/null @@ -1,5333 +0,0 @@ -{ - "id": "fe73ed72-2037-497a-bc50-3a7194a52bd7", - "prevId": "8c70af83-c639-43c9-a9d8-9d570eab3eaf", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0102_snapshot.json b/db/migrations_backup/meta/0102_snapshot.json deleted file mode 100644 index d02a5593..00000000 --- a/db/migrations_backup/meta/0102_snapshot.json +++ /dev/null @@ -1,5333 +0,0 @@ -{ - "id": "bbb2a0fd-2d5d-4a04-8d7c-4dd05931321d", - "prevId": "fe73ed72-2037-497a-bc50-3a7194a52bd7", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", \"vendors\".\"created_at\", \"vendors\".\"updated_at\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0103_snapshot.json b/db/migrations_backup/meta/0103_snapshot.json deleted file mode 100644 index f3164153..00000000 --- a/db/migrations_backup/meta/0103_snapshot.json +++ /dev/null @@ -1,5333 +0,0 @@ -{ - "id": "89627997-7460-4205-832f-e325d32c8d86", - "prevId": "bbb2a0fd-2d5d-4a04-8d7c-4dd05931321d", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0104_snapshot.json b/db/migrations_backup/meta/0104_snapshot.json deleted file mode 100644 index f4b20b97..00000000 --- a/db/migrations_backup/meta/0104_snapshot.json +++ /dev/null @@ -1,5340 +0,0 @@ -{ - "id": "0ed0214d-082e-4c8f-94e2-c2ab6f19c094", - "prevId": "89627997-7460-4205-832f-e325d32c8d86", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0105_snapshot.json b/db/migrations_backup/meta/0105_snapshot.json deleted file mode 100644 index ac60bf7b..00000000 --- a/db/migrations_backup/meta/0105_snapshot.json +++ /dev/null @@ -1,5410 +0,0 @@ -{ - "id": "5351a436-5038-4064-8058-2be22aa68865", - "prevId": "0ed0214d-082e-4c8f-94e2-c2ab6f19c094", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0106_snapshot.json b/db/migrations_backup/meta/0106_snapshot.json deleted file mode 100644 index a779e88c..00000000 --- a/db/migrations_backup/meta/0106_snapshot.json +++ /dev/null @@ -1,5460 +0,0 @@ -{ - "id": "8185f90a-e341-4f84-9603-80e79515ae73", - "prevId": "5351a436-5038-4064-8058-2be22aa68865", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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.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.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.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.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", (\n SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = \"id\"\n ) as \"attachments\", (\n SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = \"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = \"id\"\n ) as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0107_snapshot.json b/db/migrations_backup/meta/0107_snapshot.json deleted file mode 100644 index 2cac3f84..00000000 --- a/db/migrations_backup/meta/0107_snapshot.json +++ /dev/null @@ -1,5542 +0,0 @@ -{ - "id": "6ce7fb25-8935-4b60-b767-b6b8b172ea3a", - "prevId": "8185f90a-e341-4f84-9603-80e79515ae73", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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.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.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.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.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "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 - } - }, - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", (\n SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = \"id\"\n ) as \"attachments\", (\n SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = \"id\"\n ) as \"attachment_count\", (\n SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = \"id\"\n ) as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0108_snapshot.json b/db/migrations_backup/meta/0108_snapshot.json deleted file mode 100644 index 53bd5c6d..00000000 --- a/db/migrations_backup/meta/0108_snapshot.json +++ /dev/null @@ -1,5542 +0,0 @@ -{ - "id": "76d8ab04-7ffb-424a-97e9-de707ecbcea0", - "prevId": "6ce7fb25-8935-4b60-b767-b6b8b172ea3a", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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.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.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.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.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "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 - } - }, - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0109_snapshot.json b/db/migrations_backup/meta/0109_snapshot.json deleted file mode 100644 index 3dd00488..00000000 --- a/db/migrations_backup/meta/0109_snapshot.json +++ /dev/null @@ -1,5626 +0,0 @@ -{ - "id": "e566e387-ae65-4264-b8f4-5c050fe42efe", - "prevId": "76d8ab04-7ffb-424a-97e9-de707ecbcea0", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.items": { - "name": "items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "items_item_code_unique": { - "name": "items_item_code_unique", - "nullsNotDistinct": false, - "columns": [ - "item_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias": { - "name": "pq_criterias", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "check_point": { - "name": "check_point", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remarks": { - "name": "remarks", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "group_name": { - "name": "group_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias_extension": { - "name": "pq_criterias_extension", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "pq_criteria_id": { - "name": "pq_criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_info": { - "name": "contract_info", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "additional_requirement": { - "name": "additional_requirement", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { - "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "pq_criterias", - "columnsFrom": [ - "pq_criteria_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "pq_criterias_extension_project_id_projects_id_fk": { - "name": "pq_criterias_extension_project_id_projects_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_criteria_attachments": { - "name": "vendor_criteria_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_criteria_answer_id": { - "name": "vendor_criteria_answer_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "file_type": { - "name": "file_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { - "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", - "tableFrom": "vendor_criteria_attachments", - "tableTo": "vendor_pq_criteria_answers", - "columnsFrom": [ - "vendor_criteria_answer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_pq_criteria_answers": { - "name": "vendor_pq_criteria_answers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "criteria_id": { - "name": "criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "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.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.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.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.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "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 - } - }, - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0110_snapshot.json b/db/migrations_backup/meta/0110_snapshot.json deleted file mode 100644 index dbf05e17..00000000 --- a/db/migrations_backup/meta/0110_snapshot.json +++ /dev/null @@ -1,5748 +0,0 @@ -{ - "id": "257d313c-cbec-4937-86f5-a3cb81332ac5", - "prevId": "e566e387-ae65-4264-b8f4-5c050fe42efe", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.items": { - "name": "items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "items_item_code_unique": { - "name": "items_item_code_unique", - "nullsNotDistinct": false, - "columns": [ - "item_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias": { - "name": "pq_criterias", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "check_point": { - "name": "check_point", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remarks": { - "name": "remarks", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "group_name": { - "name": "group_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias_extension": { - "name": "pq_criterias_extension", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "pq_criteria_id": { - "name": "pq_criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_info": { - "name": "contract_info", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "additional_requirement": { - "name": "additional_requirement", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { - "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "pq_criterias", - "columnsFrom": [ - "pq_criteria_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "pq_criterias_extension_project_id_projects_id_fk": { - "name": "pq_criterias_extension_project_id_projects_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_criteria_attachments": { - "name": "vendor_criteria_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_criteria_answer_id": { - "name": "vendor_criteria_answer_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "file_type": { - "name": "file_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { - "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", - "tableFrom": "vendor_criteria_attachments", - "tableTo": "vendor_pq_criteria_answers", - "columnsFrom": [ - "vendor_criteria_answer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_pq_criteria_answers": { - "name": "vendor_pq_criteria_answers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "criteria_id": { - "name": "criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "answer": { - "name": "answer", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { - "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { - "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "pq_criterias", - "columnsFrom": [ - "criteria_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_pq_criteria_answers_project_id_projects_id_fk": { - "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_pq_review_logs": { - "name": "vendor_pq_review_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_pq_criteria_answer_id": { - "name": "vendor_pq_criteria_answer_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "reviewer_comment": { - "name": "reviewer_comment", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reviewer_name": { - "name": "reviewer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { - "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", - "tableFrom": "vendor_pq_review_logs", - "tableTo": "vendor_pq_criteria_answers", - "columnsFrom": [ - "vendor_pq_criteria_answer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_project_pqs": { - "name": "vendor_project_pqs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true, - "default": "'REQUESTED'" - }, - "submitted_at": { - "name": "submitted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "approved_at": { - "name": "approved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "rejected_at": { - "name": "rejected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "reject_reason": { - "name": "reject_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_project_pqs_vendor_id_vendors_id_fk": { - "name": "vendor_project_pqs_vendor_id_vendors_id_fk", - "tableFrom": "vendor_project_pqs", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_project_pqs_project_id_projects_id_fk": { - "name": "vendor_project_pqs_project_id_projects_id_fk", - "tableFrom": "vendor_project_pqs", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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.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.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.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.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_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "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 - } - }, - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/0111_snapshot.json b/db/migrations_backup/meta/0111_snapshot.json deleted file mode 100644 index 959264d2..00000000 --- a/db/migrations_backup/meta/0111_snapshot.json +++ /dev/null @@ -1,5870 +0,0 @@ -{ - "id": "c6ef853d-1502-4f41-9b90-19ca2b0e5ff8", - "prevId": "257d313c-cbec-4937-86f5-a3cb81332ac5", - "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.poa": { - "name": "poa", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "original_contract_no": { - "name": "original_contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "original_contract_name": { - "name": "original_contract_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "original_status": { - "name": "original_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "poa_original_contract_no_contracts_contract_no_fk": { - "name": "poa_original_contract_no_contracts_contract_no_fk", - "tableFrom": "poa", - "tableTo": "contracts", - "columnsFrom": [ - "original_contract_no" - ], - "columnsTo": [ - "contract_no" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_project_id_projects_id_fk": { - "name": "poa_project_id_projects_id_fk", - "tableFrom": "poa", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "poa_vendor_id_vendors_id_fk": { - "name": "poa_vendor_id_vendors_id_fk", - "tableFrom": "poa", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.items": { - "name": "items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "items_item_code_unique": { - "name": "items_item_code_unique", - "nullsNotDistinct": false, - "columns": [ - "item_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias": { - "name": "pq_criterias", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "check_point": { - "name": "check_point", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "remarks": { - "name": "remarks", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "group_name": { - "name": "group_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.pq_criterias_extension": { - "name": "pq_criterias_extension", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "pq_criteria_id": { - "name": "pq_criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contract_info": { - "name": "contract_info", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "additional_requirement": { - "name": "additional_requirement", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk": { - "name": "pq_criterias_extension_pq_criteria_id_pq_criterias_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "pq_criterias", - "columnsFrom": [ - "pq_criteria_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "pq_criterias_extension_project_id_projects_id_fk": { - "name": "pq_criterias_extension_project_id_projects_id_fk", - "tableFrom": "pq_criterias_extension", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_criteria_attachments": { - "name": "vendor_criteria_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_criteria_answer_id": { - "name": "vendor_criteria_answer_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "file_type": { - "name": "file_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { - "name": "vendor_criteria_attachments_vendor_criteria_answer_id_vendor_pq_criteria_answers_id_fk", - "tableFrom": "vendor_criteria_attachments", - "tableTo": "vendor_pq_criteria_answers", - "columnsFrom": [ - "vendor_criteria_answer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_pq_criteria_answers": { - "name": "vendor_pq_criteria_answers", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "criteria_id": { - "name": "criteria_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "answer": { - "name": "answer", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_pq_criteria_answers_vendor_id_vendors_id_fk": { - "name": "vendor_pq_criteria_answers_vendor_id_vendors_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": { - "name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "pq_criterias", - "columnsFrom": [ - "criteria_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_pq_criteria_answers_project_id_projects_id_fk": { - "name": "vendor_pq_criteria_answers_project_id_projects_id_fk", - "tableFrom": "vendor_pq_criteria_answers", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_pq_review_logs": { - "name": "vendor_pq_review_logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_pq_criteria_answer_id": { - "name": "vendor_pq_criteria_answer_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "reviewer_comment": { - "name": "reviewer_comment", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "reviewer_name": { - "name": "reviewer_name", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk": { - "name": "vendor_pq_review_logs_vendor_pq_criteria_answer_id_vendor_pq_criteria_answers_id_fk", - "tableFrom": "vendor_pq_review_logs", - "tableTo": "vendor_pq_criteria_answers", - "columnsFrom": [ - "vendor_pq_criteria_answer_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_project_pqs": { - "name": "vendor_project_pqs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true, - "default": "'REQUESTED'" - }, - "submitted_at": { - "name": "submitted_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "approved_at": { - "name": "approved_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "rejected_at": { - "name": "rejected_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "reject_reason": { - "name": "reject_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_project_pqs_vendor_id_vendors_id_fk": { - "name": "vendor_project_pqs_vendor_id_vendors_id_fk", - "tableFrom": "vendor_project_pqs", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - }, - "vendor_project_pqs_project_id_projects_id_fk": { - "name": "vendor_project_pqs_project_id_projects_id_fk", - "tableFrom": "vendor_project_pqs", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "cascade" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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.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 - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "form_code": { - "name": "form_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "columns": { - "name": "columns", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "form_metas_project_id_projects_id_fk": { - "name": "form_metas_project_id_projects_id_fk", - "tableFrom": "form_metas", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "form_code_project_unique": { - "name": "form_code_project_unique", - "nullsNotDistinct": false, - "columns": [ - "project_id", - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.forms": { - "name": "forms", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "forms_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "form_code": { - "name": "form_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "contract_item_form_code_unique": { - "name": "contract_item_form_code_unique", - "columns": [ - { - "expression": "contract_item_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "form_code", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "forms_contract_item_id_contract_items_id_fk": { - "name": "forms_contract_item_id_contract_items_id_fk", - "tableFrom": "forms", - "tableTo": "contract_items", - "columnsFrom": [ - "contract_item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_classes": { - "name": "tag_classes", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "tag_classes_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "tag_classes_project_id_projects_id_fk": { - "name": "tag_classes_project_id_projects_id_fk", - "tableFrom": "tag_classes", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk": { - "name": "tag_classes_tag_type_code_project_id_tag_types_code_project_id_fk", - "tableFrom": "tag_classes", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code", - "project_id" - ], - "columnsTo": [ - "code", - "project_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_code_in_project": { - "name": "uniq_code_in_project", - "nullsNotDistinct": false, - "columns": [ - "project_id", - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfield_options": { - "name": "tag_subfield_options", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "attributes_id": { - "name": "attributes_id", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "label": { - "name": "label", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "tag_subfield_options_project_id_projects_id_fk": { - "name": "tag_subfield_options_project_id_projects_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tag_subfield_options_attributes_id_project_id_tag_subfields_attributes_id_project_id_fk": { - "name": "tag_subfield_options_attributes_id_project_id_tag_subfields_attributes_id_project_id_fk", - "tableFrom": "tag_subfield_options", - "tableTo": "tag_subfields", - "columnsFrom": [ - "attributes_id", - "project_id" - ], - "columnsTo": [ - "attributes_id", - "project_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_attribute_project_code": { - "name": "uniq_attribute_project_code", - "nullsNotDistinct": false, - "columns": [ - "project_id", - "attributes_id", - "code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_subfields": { - "name": "tag_subfields", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "attributes_id": { - "name": "attributes_id", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "attributes_description": { - "name": "attributes_description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expression": { - "name": "expression", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delimiter": { - "name": "delimiter", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "tag_subfields_project_id_projects_id_fk": { - "name": "tag_subfields_project_id_projects_id_fk", - "tableFrom": "tag_subfields", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tag_subfields_tag_type_code_project_id_tag_types_code_project_id_fk": { - "name": "tag_subfields_tag_type_code_project_id_tag_types_code_project_id_fk", - "tableFrom": "tag_subfields", - "tableTo": "tag_types", - "columnsFrom": [ - "tag_type_code", - "project_id" - ], - "columnsTo": [ - "code", - "project_id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_tag_type_attribute": { - "name": "uniq_tag_type_attribute", - "nullsNotDistinct": false, - "columns": [ - "project_id", - "tag_type_code", - "attributes_id" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_type_class_form_mappings": { - "name": "tag_type_class_form_mappings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "tag_type_label": { - "name": "tag_type_label", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "class_label": { - "name": "class_label", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "form_code": { - "name": "form_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "form_name": { - "name": "form_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "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_type_class_form_mappings_project_id_projects_id_fk": { - "name": "tag_type_class_form_mappings_project_id_projects_id_fk", - "tableFrom": "tag_type_class_form_mappings", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": { - "uniq_mapping_in_project": { - "name": "uniq_mapping_in_project", - "nullsNotDistinct": false, - "columns": [ - "project_id", - "tag_type_label", - "class_label", - "form_code" - ] - } - }, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tag_types": { - "name": "tag_types", - "schema": "", - "columns": { - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "tag_types_project_id_projects_id_fk": { - "name": "tag_types_project_id_projects_id_fk", - "tableFrom": "tag_types", - "tableTo": "projects", - "columnsFrom": [ - "project_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": { - "tag_types_code_project_id_pk": { - "name": "tag_types_code_project_id_pk", - "columns": [ - "code", - "project_id" - ] - } - }, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.tags": { - "name": "tags", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "tags_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "form_id": { - "name": "form_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "tag_no": { - "name": "tag_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "tag_type": { - "name": "tag_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "class": { - "name": "class", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "tags_contract_item_id_contract_items_id_fk": { - "name": "tags_contract_item_id_contract_items_id_fk", - "tableFrom": "tags", - "tableTo": "contract_items", - "columnsFrom": [ - "contract_item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "tags_form_id_forms_id_fk": { - "name": "tags_form_id_forms_id_fk", - "tableFrom": "tags", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_data_report_temps": { - "name": "vendor_data_report_temps", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "contract_item_id": { - "name": "contract_item_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "form_id": { - "name": "form_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_data_report_temps_contract_item_id_contract_items_id_fk": { - "name": "vendor_data_report_temps_contract_item_id_contract_items_id_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "contract_items", - "columnsFrom": [ - "contract_item_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "vendor_data_report_temps_form_id_forms_id_fk": { - "name": "vendor_data_report_temps_form_id_forms_id_fk", - "tableFrom": "vendor_data_report_temps", - "tableTo": "forms", - "columnsFrom": [ - "form_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.document_attachments": { - "name": "document_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "document_attachments_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "revision_id": { - "name": "revision_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "file_type": { - "name": "file_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "file_size": { - "name": "file_size", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "document_attachments_revision_id_revisions_id_fk": { - "name": "document_attachments_revision_id_revisions_id_fk", - "tableFrom": "document_attachments", - "tableTo": "revisions", - "columnsFrom": [ - "revision_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.documents": { - "name": "documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "documents_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_id": { - "name": "contract_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "doc_number": { - "name": "doc_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'ACTIVE'" - }, - "issued_date": { - "name": "issued_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "unique_contract_doc_status": { - "name": "unique_contract_doc_status", - "columns": [ - { - "expression": "contract_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "doc_number", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "documents_contract_id_contracts_id_fk": { - "name": "documents_contract_id_contracts_id_fk", - "tableFrom": "documents", - "tableTo": "contracts", - "columnsFrom": [ - "contract_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.issue_stages": { - "name": "issue_stages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "issue_stages_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "document_id": { - "name": "document_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "stage_name": { - "name": "stage_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "plan_date": { - "name": "plan_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "actual_date": { - "name": "actual_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "unique_document_stage": { - "name": "unique_document_stage", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "stage_name", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "issue_stages_document_id_documents_id_fk": { - "name": "issue_stages_document_id_documents_id_fk", - "tableFrom": "issue_stages", - "tableTo": "documents", - "columnsFrom": [ - "document_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.revisions": { - "name": "revisions", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "revisions_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "issue_stage_id": { - "name": "issue_stage_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "revision": { - "name": "revision", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "uploader_type": { - "name": "uploader_type", - "type": "varchar(20)", - "primaryKey": false, - "notNull": true, - "default": "'vendor'" - }, - "uploader_id": { - "name": "uploader_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "uploader_name": { - "name": "uploader_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "comment": { - "name": "comment", - "type": "varchar(500)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "approved_date": { - "name": "approved_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "unique_stage_rev": { - "name": "unique_stage_rev", - "columns": [ - { - "expression": "issue_stage_id", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "revision", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_attachments": { - "name": "vendor_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'GENERAL'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_attachments_vendor_id_vendors_id_fk": { - "name": "vendor_attachments_vendor_id_vendors_id_fk", - "tableFrom": "vendor_attachments", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_candidates": { - "name": "vendor_candidates", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "company_name": { - "name": "company_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "source": { - "name": "source", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'COLLECTED'" - }, - "created_at": { - "name": "created_at", - "type": "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_contacts": { - "name": "vendor_contacts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "contact_name": { - "name": "contact_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_position": { - "name": "contact_position", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "contact_email": { - "name": "contact_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "contact_phone": { - "name": "contact_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "is_primary": { - "name": "is_primary", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_contacts_vendor_id_vendors_id_fk": { - "name": "vendor_contacts_vendor_id_vendors_id_fk", - "tableFrom": "vendor_contacts", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigation_attachments": { - "name": "vendor_investigation_attachments", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_id": { - "name": "investigation_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "file_name": { - "name": "file_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "file_path": { - "name": "file_path", - "type": "varchar(1024)", - "primaryKey": false, - "notNull": true - }, - "attachment_type": { - "name": "attachment_type", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'REPORT'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk": { - "name": "vendor_investigation_attachments_investigation_id_vendor_investigations_id_fk", - "tableFrom": "vendor_investigation_attachments", - "tableTo": "vendor_investigations", - "columnsFrom": [ - "investigation_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_investigations": { - "name": "vendor_investigations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_investigations_vendor_id_vendors_id_fk": { - "name": "vendor_investigations_vendor_id_vendors_id_fk", - "tableFrom": "vendor_investigations", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.vendor_possible_items": { - "name": "vendor_possible_items", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": {}, - "foreignKeys": { - "vendor_possible_items_vendor_id_vendors_id_fk": { - "name": "vendor_possible_items_vendor_id_vendors_id_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "vendors", - "columnsFrom": [ - "vendor_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "no action", - "onUpdate": "no action" - }, - "vendor_possible_items_item_code_items_item_code_fk": { - "name": "vendor_possible_items_item_code_items_item_code_fk", - "tableFrom": "vendor_possible_items", - "tableTo": "items", - "columnsFrom": [ - "item_code" - ], - "columnsTo": [ - "item_code" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.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 - }, - "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 - } - }, - "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', ci.id,\n 'itemId', ci.item_id,\n 'description', ci.description,\n 'quantity', ci.quantity,\n 'unitPrice', ci.unit_price,\n 'taxRate', ci.tax_rate,\n 'taxAmount', ci.tax_amount,\n 'totalLineAmount', ci.total_line_amount,\n 'remark', ci.remark,\n 'createdAt', ci.created_at,\n 'updatedAt', ci.updated_at\n )\n )\n FROM \"contract_items\" AS ci\n WHERE ci.contract_id = \"contracts\".\"id\"\n ), '[]') as \"items\", COALESCE((\n SELECT json_agg(\n json_build_object(\n 'id', ce.id,\n 'envelopeId', ce.envelope_id,\n 'documentId', ce.document_id,\n 'envelopeStatus', ce.envelope_status,\n 'fileName', ce.file_name,\n 'filePath', ce.file_path,\n 'createdAt', ce.created_at,\n 'updatedAt', ce.updated_at,\n 'signers', (\n SELECT json_agg(\n json_build_object(\n 'id', cs.id,\n 'vendorContactId', cs.vendor_contact_id,\n 'signerType', cs.signer_type,\n 'signerEmail', cs.signer_email,\n 'signerName', cs.signer_name,\n 'signerPosition', cs.signer_position,\n 'signerStatus', cs.signer_status,\n 'signedAt', cs.signed_at\n )\n )\n FROM \"contract_signers\" AS cs\n WHERE cs.envelope_id = ce.id\n )\n )\n )\n FROM \"contract_envelopes\" AS ce\n WHERE ce.contract_id = \"contracts\".\"id\"\n ), '[]') as \"envelopes\" from \"contracts\" left join \"projects\" on \"contracts\".\"project_id\" = \"projects\".\"id\" left join \"vendors\" on \"contracts\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "contracts_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.poa_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": true, - "notNull": true, - "identity": { - "type": "always", - "name": "poa_detail_view_id_seq", - "schema": "public", - "increment": "1", - "startWith": "1", - "minValue": "1", - "maxValue": "2147483647", - "cache": "1", - "cycle": false - } - }, - "contract_no": { - "name": "contract_no", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "change_reason": { - "name": "change_reason", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "approval_status": { - "name": "approval_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false, - "default": "'PENDING'" - }, - "delivery_terms": { - "name": "delivery_terms", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delivery_date": { - "name": "delivery_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "delivery_location": { - "name": "delivery_location", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "currency": { - "name": "currency", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "total_amount": { - "name": "total_amount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "discount": { - "name": "discount", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "tax": { - "name": "tax", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "shipping_fee": { - "name": "shipping_fee", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "net_total": { - "name": "net_total", - "type": "numeric(12, 2)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"poa\".\"id\", \"poa\".\"contract_no\", \"contracts\".\"project_id\", \"contracts\".\"vendor_id\", \"poa\".\"change_reason\", \"poa\".\"approval_status\", \"contracts\".\"contract_name\" as \"original_contract_name\", \"contracts\".\"status\" as \"original_status\", \"contracts\".\"start_date\" as \"original_start_date\", \"contracts\".\"end_date\" as \"original_end_date\", \"poa\".\"delivery_terms\", \"poa\".\"delivery_date\", \"poa\".\"delivery_location\", \"poa\".\"currency\", \"poa\".\"total_amount\", \"poa\".\"discount\", \"poa\".\"tax\", \"poa\".\"shipping_fee\", \"poa\".\"net_total\", \"poa\".\"created_at\", \"poa\".\"updated_at\", EXISTS (\n SELECT 1 \n FROM \"contract_envelopes\" \n WHERE \"contract_envelopes\".\"contract_id\" = \"poa\".\"id\"\n ) as \"has_signature\" from \"poa\" left join \"contracts\" on \"poa\".\"contract_no\" = \"contracts\".\"contract_no\"", - "name": "poa_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.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.view_tag_subfields": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "project_id": { - "name": "project_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "tag_type_code": { - "name": "tag_type_code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "attributes_id": { - "name": "attributes_id", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "attributes_description": { - "name": "attributes_description", - "type": "text", - "primaryKey": false, - "notNull": true - }, - "expression": { - "name": "expression", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "delimiter": { - "name": "delimiter", - "type": "varchar(10)", - "primaryKey": false, - "notNull": false - }, - "sort_order": { - "name": "sort_order", - "type": "integer", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "code": { - "name": "code", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "text", - "primaryKey": false, - "notNull": true - } - }, - "definition": "select \"tag_subfields\".\"id\", \"tag_subfields\".\"project_id\", \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"code\", \"projects\".\"name\" from \"tag_subfields\" inner join \"tag_types\" on (\"tag_subfields\".\"tag_type_code\" = \"tag_types\".\"code\" and \"tag_subfields\".\"project_id\" = \"tag_types\".\"project_id\") inner join \"projects\" on \"tag_subfields\".\"project_id\" = \"projects\".\"id\"", - "name": "view_tag_subfields", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.document_stages_view": { - "columns": { - "document_id": { - "name": "document_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "doc_number": { - "name": "doc_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "issued_date": { - "name": "issued_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "contract_id": { - "name": "contract_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "stage_count": { - "name": "stage_count", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "stage_list": { - "name": "stage_list", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "definition": "\n SELECT\n d.id AS document_id,\n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n d.contract_id,\n\n (\n SELECT COUNT(*)\n FROM issue_stages\n WHERE document_id = d.id\n ) AS stage_count,\n\n COALESCE( \n (\n SELECT json_agg(i.stage_name)\n FROM issue_stages i\n WHERE i.document_id = d.id\n ), \n '[]'\n ) AS stage_list,\n\n d.created_at,\n d.updated_at\n FROM documents d\n", - "name": "document_stages_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_documents_view": { - "columns": { - "id": { - "name": "id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "doc_number": { - "name": "doc_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true - }, - "issued_date": { - "name": "issued_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "contract_id": { - "name": "contract_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "latest_stage_id": { - "name": "latest_stage_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "latest_stage_name": { - "name": "latest_stage_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "latest_stage_plan_date": { - "name": "latest_stage_plan_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "latest_stage_actual_date": { - "name": "latest_stage_actual_date", - "type": "date", - "primaryKey": false, - "notNull": false - }, - "latest_revision_id": { - "name": "latest_revision_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "latest_revision": { - "name": "latest_revision", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "latest_revision_uploader_type": { - "name": "latest_revision_uploader_type", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "latest_revision_uploader_name": { - "name": "latest_revision_uploader_name", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "attachment_count": { - "name": "attachment_count", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp with time zone", - "primaryKey": false, - "notNull": true - } - }, - "definition": "\n SELECT \n d.id, \n d.doc_number,\n d.title,\n d.status,\n d.issued_date,\n \n d.contract_id,\n \n (\n SELECT id FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_id,\n (\n SELECT stage_name FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_name,\n (\n SELECT plan_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_plan_date,\n (\n SELECT actual_date FROM issue_stages\n WHERE document_id = d.id\n ORDER BY created_at DESC LIMIT 1\n ) AS latest_stage_actual_date,\n \n (\n SELECT r.id FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_id,\n (\n SELECT r.revision FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision,\n (\n SELECT r.uploader_type FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_type,\n (\n SELECT r.uploader_name FROM revisions r\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ORDER BY r.created_at DESC LIMIT 1\n ) AS latest_revision_uploader_name,\n \n (\n SELECT COUNT(*) FROM document_attachments a\n JOIN revisions r ON a.revision_id = r.id\n JOIN issue_stages i ON r.issue_stage_id = i.id\n WHERE i.document_id = d.id\n ) AS attachment_count,\n \n d.created_at,\n d.updated_at\n FROM documents d\n JOIN contracts c ON d.contract_id = c.id\n ", - "name": "vendor_documents_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_detail_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "address": { - "name": "address", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "representative_name": { - "name": "representative_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_birth": { - "name": "representative_birth", - "type": "varchar(20)", - "primaryKey": false, - "notNull": false - }, - "representative_email": { - "name": "representative_email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "representative_phone": { - "name": "representative_phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "corporate_registration_number": { - "name": "corporate_registration_number", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "credit_agency": { - "name": "credit_agency", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "credit_rating": { - "name": "credit_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "cash_flow_rating": { - "name": "cash_flow_rating", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"id\", \"vendor_name\", \"vendor_code\", \"tax_id\", \"address\", \"country\", \"phone\", \"email\", \"website\", \"status\", \"representative_name\", \"representative_birth\", \"representative_email\", \"representative_phone\", \"corporate_registration_number\", \"credit_agency\", \"credit_rating\", \"cash_flow_rating\", \"created_at\", \"updated_at\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', c.id,\n 'contactName', c.contact_name,\n 'contactPosition', c.contact_position,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'isPrimary', c.is_primary\n )\n ),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contacts\", \n (SELECT COALESCE(\n json_agg(\n json_build_object(\n 'id', a.id,\n 'fileName', a.file_name,\n 'filePath', a.file_path,\n 'attachmentType', a.attachment_type,\n 'createdAt', a.created_at\n )\n ORDER BY a.attachment_type, a.created_at DESC\n ),\n '[]'::json\n )\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachments\", \n (SELECT COUNT(*)\n FROM vendor_attachments a\n WHERE a.vendor_id = vendors.id)\n as \"attachment_count\", \n (SELECT COUNT(*) \n FROM vendor_contacts c\n WHERE c.vendor_id = vendors.id)\n as \"contact_count\" from \"vendors\"", - "name": "vendor_detail_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_investigations_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "investigation_status": { - "name": "investigation_status", - "type": "varchar(50)", - "primaryKey": false, - "notNull": true, - "default": "'PLANNED'" - }, - "scheduled_start_at": { - "name": "scheduled_start_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "scheduled_end_at": { - "name": "scheduled_end_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp", - "primaryKey": false, - "notNull": false - }, - "investigation_notes": { - "name": "investigation_notes", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "vendor_name": { - "name": "vendor_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "vendor_code": { - "name": "vendor_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "tax_id": { - "name": "tax_id", - "type": "varchar(100)", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "varchar(30)", - "primaryKey": false, - "notNull": true, - "default": "'PENDING_REVIEW'" - }, - "country": { - "name": "country", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "email": { - "name": "email", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - }, - "phone": { - "name": "phone", - "type": "varchar(50)", - "primaryKey": false, - "notNull": false - }, - "website": { - "name": "website", - "type": "varchar(255)", - "primaryKey": false, - "notNull": false - } - }, - "definition": "select \"vendor_investigations\".\"id\", \"vendor_investigations\".\"investigation_status\", \"vendor_investigations\".\"scheduled_start_at\", \"vendor_investigations\".\"scheduled_end_at\", \"vendor_investigations\".\"completed_at\", \"vendor_investigations\".\"investigation_notes\", \"vendor_investigations\".\"created_at\", \"vendor_investigations\".\"updated_at\", \"vendor_investigations\".\"vendor_id\", \"vendors\".\"vendor_name\", \"vendors\".\"vendor_code\", \"vendors\".\"tax_id\", \"vendors\".\"status\", \"vendors\".\"country\", \"vendors\".\"email\", \"vendors\".\"phone\", \"vendors\".\"website\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'contactName', c.contact_name,\n 'contactEmail', c.contact_email,\n 'contactPhone', c.contact_phone,\n 'contactPosition', c.contact_position,\n 'isPrimary', c.is_primary,\n 'contactCreatedAt', c.created_at,\n 'contactUpdatedAt', c.updated_at\n )),\n '[]'::json\n )\n FROM vendor_contacts c\n WHERE c.vendor_id = \"vendors\".\"id\"\n ) as \"contacts\", (\n SELECT COALESCE(\n json_agg(json_build_object(\n 'itemCode', pi.item_code,\n 'itemName', i.item_name,\n 'itemCreatedAt', pi.created_at,\n 'itemUpdatedAt', pi.updated_at\n )),\n '[]'::json\n )\n FROM vendor_possible_items pi\n LEFT JOIN items i ON pi.item_code = i.item_code\n WHERE pi.vendor_id = \"vendors\".\"id\"\n ) as \"possibleItems\" from \"vendor_investigations\" left join \"vendors\" on \"vendor_investigations\".\"vendor_id\" = \"vendors\".\"id\"", - "name": "vendor_investigations_view", - "schema": "public", - "isExisting": false, - "materialized": false - }, - "public.vendor_items_view": { - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "vendor_id": { - "name": "vendor_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "item_name": { - "name": "item_name", - "type": "varchar(255)", - "primaryKey": false, - "notNull": true - }, - "item_code": { - "name": "item_code", - "type": "varchar(100)", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "text", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "definition": "select \"vendor_possible_items\".\"id\", \"vendor_possible_items\".\"vendor_id\", \"items\".\"item_name\", \"items\".\"item_code\", \"items\".\"description\", \"vendor_possible_items\".\"created_at\", \"vendor_possible_items\".\"updated_at\" from \"vendor_possible_items\" left join \"items\" on \"vendor_possible_items\".\"item_code\" = \"items\".\"item_code\"", - "name": "vendor_items_view", - "schema": "public", - "isExisting": false, - "materialized": false - } - }, - "_meta": { - "columns": {}, - "schemas": {}, - "tables": {} - } -}
\ No newline at end of file diff --git a/db/migrations_backup/meta/_journal.json b/db/migrations_backup/meta/_journal.json deleted file mode 100644 index 8855f67c..00000000 --- a/db/migrations_backup/meta/_journal.json +++ /dev/null @@ -1,790 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "entries": [ - { - "idx": 0, - "version": "7", - "when": 1736156207023, - "tag": "0000_dusty_skaar", - "breakpoints": true - }, - { - "idx": 1, - "version": "7", - "when": 1736243645330, - "tag": "0001_robust_landau", - "breakpoints": true - }, - { - "idx": 2, - "version": "7", - "when": 1736293765487, - "tag": "0002_puzzling_johnny_blaze", - "breakpoints": true - }, - { - "idx": 3, - "version": "7", - "when": 1736319467635, - "tag": "0003_unknown_speed_demon", - "breakpoints": true - }, - { - "idx": 4, - "version": "7", - "when": 1736401739614, - "tag": "0004_cheerful_stark_industries", - "breakpoints": true - }, - { - "idx": 5, - "version": "7", - "when": 1736492353717, - "tag": "0005_loud_whizzer", - "breakpoints": true - }, - { - "idx": 6, - "version": "7", - "when": 1736492505533, - "tag": "0006_tan_mongu", - "breakpoints": true - }, - { - "idx": 7, - "version": "7", - "when": 1738554783249, - "tag": "0007_big_franklin_storm", - "breakpoints": true - }, - { - "idx": 8, - "version": "7", - "when": 1738562590619, - "tag": "0008_previous_omega_red", - "breakpoints": true - }, - { - "idx": 9, - "version": "7", - "when": 1738581215409, - "tag": "0009_aromatic_falcon", - "breakpoints": true - }, - { - "idx": 10, - "version": "7", - "when": 1738643648064, - "tag": "0010_big_sue_storm", - "breakpoints": true - }, - { - "idx": 11, - "version": "7", - "when": 1738646749076, - "tag": "0011_tense_madame_web", - "breakpoints": true - }, - { - "idx": 12, - "version": "7", - "when": 1738647200959, - "tag": "0012_giant_sunfire", - "breakpoints": true - }, - { - "idx": 13, - "version": "7", - "when": 1738660142551, - "tag": "0013_exotic_blazing_skull", - "breakpoints": true - }, - { - "idx": 14, - "version": "7", - "when": 1738661206454, - "tag": "0014_clammy_power_man", - "breakpoints": true - }, - { - "idx": 15, - "version": "7", - "when": 1738713477636, - "tag": "0015_black_fixer", - "breakpoints": true - }, - { - "idx": 16, - "version": "7", - "when": 1738826234216, - "tag": "0016_fat_komodo", - "breakpoints": true - }, - { - "idx": 17, - "version": "7", - "when": 1738842207615, - "tag": "0017_thin_chimera", - "breakpoints": true - }, - { - "idx": 18, - "version": "7", - "when": 1738894925859, - "tag": "0018_tiny_robbie_robertson", - "breakpoints": true - }, - { - "idx": 19, - "version": "7", - "when": 1738896318801, - "tag": "0019_bumpy_anthem", - "breakpoints": true - }, - { - "idx": 20, - "version": "7", - "when": 1738903803839, - "tag": "0020_chubby_carnage", - "breakpoints": true - }, - { - "idx": 21, - "version": "7", - "when": 1739517880247, - "tag": "0021_nappy_dexter_bennett", - "breakpoints": true - }, - { - "idx": 22, - "version": "7", - "when": 1740466813155, - "tag": "0022_panoramic_mad_thinker", - "breakpoints": true - }, - { - "idx": 23, - "version": "7", - "when": 1740715283222, - "tag": "0023_familiar_raza", - "breakpoints": true - }, - { - "idx": 24, - "version": "7", - "when": 1740718562920, - "tag": "0024_eager_bill_hollister", - "breakpoints": true - }, - { - "idx": 25, - "version": "7", - "when": 1740718788624, - "tag": "0025_complex_husk", - "breakpoints": true - }, - { - "idx": 26, - "version": "7", - "when": 1740719331095, - "tag": "0026_tiresome_jackpot", - "breakpoints": true - }, - { - "idx": 27, - "version": "7", - "when": 1740722863818, - "tag": "0027_yummy_senator_kelly", - "breakpoints": true - }, - { - "idx": 28, - "version": "7", - "when": 1740728029346, - "tag": "0028_eminent_shockwave", - "breakpoints": true - }, - { - "idx": 29, - "version": "7", - "when": 1740992047545, - "tag": "0029_oval_carmella_unuscione", - "breakpoints": true - }, - { - "idx": 30, - "version": "7", - "when": 1741054932004, - "tag": "0030_zippy_the_order", - "breakpoints": true - }, - { - "idx": 31, - "version": "7", - "when": 1741057336151, - "tag": "0031_curvy_starhawk", - "breakpoints": true - }, - { - "idx": 32, - "version": "7", - "when": 1741063928405, - "tag": "0032_unusual_speedball", - "breakpoints": true - }, - { - "idx": 33, - "version": "7", - "when": 1741069686123, - "tag": "0033_chemical_maggott", - "breakpoints": true - }, - { - "idx": 34, - "version": "7", - "when": 1741163140228, - "tag": "0034_jazzy_dragon_lord", - "breakpoints": true - }, - { - "idx": 35, - "version": "7", - "when": 1741163302137, - "tag": "0035_sweet_revanche", - "breakpoints": true - }, - { - "idx": 36, - "version": "7", - "when": 1741167590196, - "tag": "0036_aberrant_marvel_apes", - "breakpoints": true - }, - { - "idx": 37, - "version": "7", - "when": 1741221596251, - "tag": "0037_legal_pretty_boy", - "breakpoints": true - }, - { - "idx": 38, - "version": "7", - "when": 1741221766772, - "tag": "0038_tough_mimic", - "breakpoints": true - }, - { - "idx": 39, - "version": "7", - "when": 1741242476883, - "tag": "0039_elite_zemo", - "breakpoints": true - }, - { - "idx": 40, - "version": "7", - "when": 1741243616145, - "tag": "0040_absurd_human_cannonball", - "breakpoints": true - }, - { - "idx": 41, - "version": "7", - "when": 1741244089299, - "tag": "0041_absurd_spyke", - "breakpoints": true - }, - { - "idx": 42, - "version": "7", - "when": 1741248447680, - "tag": "0042_panoramic_daimon_hellstrom", - "breakpoints": true - }, - { - "idx": 43, - "version": "7", - "when": 1741248502701, - "tag": "0043_pale_black_bird", - "breakpoints": true - }, - { - "idx": 44, - "version": "7", - "when": 1741248524584, - "tag": "0044_lush_tenebrous", - "breakpoints": true - }, - { - "idx": 45, - "version": "7", - "when": 1741248920881, - "tag": "0045_complex_gamora", - "breakpoints": true - }, - { - "idx": 46, - "version": "7", - "when": 1741519612476, - "tag": "0046_overjoyed_tinkerer", - "breakpoints": true - }, - { - "idx": 47, - "version": "7", - "when": 1741583741281, - "tag": "0047_broad_the_executioner", - "breakpoints": true - }, - { - "idx": 48, - "version": "7", - "when": 1741597321085, - "tag": "0048_strange_ultimo", - "breakpoints": true - }, - { - "idx": 49, - "version": "7", - "when": 1741598868911, - "tag": "0049_green_mattie_franklin", - "breakpoints": true - }, - { - "idx": 50, - "version": "7", - "when": 1741665682716, - "tag": "0050_furry_black_tarantula", - "breakpoints": true - }, - { - "idx": 51, - "version": "7", - "when": 1741667437810, - "tag": "0051_perpetual_war_machine", - "breakpoints": true - }, - { - "idx": 52, - "version": "7", - "when": 1741679763811, - "tag": "0052_little_legion", - "breakpoints": true - }, - { - "idx": 53, - "version": "7", - "when": 1741740339429, - "tag": "0053_fantastic_synch", - "breakpoints": true - }, - { - "idx": 54, - "version": "7", - "when": 1741742787453, - "tag": "0054_polite_darwin", - "breakpoints": true - }, - { - "idx": 55, - "version": "7", - "when": 1741742952788, - "tag": "0055_lonely_excalibur", - "breakpoints": true - }, - { - "idx": 56, - "version": "7", - "when": 1741744845828, - "tag": "0056_majestic_khan", - "breakpoints": true - }, - { - "idx": 57, - "version": "7", - "when": 1741746669217, - "tag": "0057_fancy_serpent_society", - "breakpoints": true - }, - { - "idx": 58, - "version": "7", - "when": 1741746972326, - "tag": "0058_familiar_bloodscream", - "breakpoints": true - }, - { - "idx": 59, - "version": "7", - "when": 1741751349481, - "tag": "0059_familiar_yellow_claw", - "breakpoints": true - }, - { - "idx": 60, - "version": "7", - "when": 1741752665593, - "tag": "0060_confused_ultimo", - "breakpoints": true - }, - { - "idx": 61, - "version": "7", - "when": 1741752949252, - "tag": "0061_warm_secret_warriors", - "breakpoints": true - }, - { - "idx": 62, - "version": "7", - "when": 1742171679940, - "tag": "0062_zippy_human_torch", - "breakpoints": true - }, - { - "idx": 63, - "version": "7", - "when": 1742183201052, - "tag": "0063_amused_nightcrawler", - "breakpoints": true - }, - { - "idx": 64, - "version": "7", - "when": 1742193251758, - "tag": "0064_curved_tony_stark", - "breakpoints": true - }, - { - "idx": 65, - "version": "7", - "when": 1742195655579, - "tag": "0065_redundant_sunset_bain", - "breakpoints": true - }, - { - "idx": 66, - "version": "7", - "when": 1742196002887, - "tag": "0066_powerful_shard", - "breakpoints": true - }, - { - "idx": 67, - "version": "7", - "when": 1742204176847, - "tag": "0067_careless_chameleon", - "breakpoints": true - }, - { - "idx": 68, - "version": "7", - "when": 1742204273788, - "tag": "0068_worried_annihilus", - "breakpoints": true - }, - { - "idx": 69, - "version": "7", - "when": 1742204407058, - "tag": "0069_whole_madelyne_pryor", - "breakpoints": true - }, - { - "idx": 70, - "version": "7", - "when": 1742204568348, - "tag": "0070_cool_rage", - "breakpoints": true - }, - { - "idx": 71, - "version": "7", - "when": 1742205210580, - "tag": "0071_worthless_shadow_king", - "breakpoints": true - }, - { - "idx": 72, - "version": "7", - "when": 1742256813633, - "tag": "0072_certain_punisher", - "breakpoints": true - }, - { - "idx": 73, - "version": "7", - "when": 1742267248319, - "tag": "0073_damp_reaper", - "breakpoints": true - }, - { - "idx": 74, - "version": "7", - "when": 1742271875533, - "tag": "0074_wet_ezekiel", - "breakpoints": true - }, - { - "idx": 75, - "version": "7", - "when": 1742290107443, - "tag": "0075_tough_epoch", - "breakpoints": true - }, - { - "idx": 76, - "version": "7", - "when": 1742293919788, - "tag": "0076_cloudy_vindicator", - "breakpoints": true - }, - { - "idx": 77, - "version": "7", - "when": 1742366286367, - "tag": "0077_past_ted_forrester", - "breakpoints": true - }, - { - "idx": 78, - "version": "7", - "when": 1742370068086, - "tag": "0078_empty_shooting_star", - "breakpoints": true - }, - { - "idx": 79, - "version": "7", - "when": 1742370100856, - "tag": "0079_big_sue_storm", - "breakpoints": true - }, - { - "idx": 80, - "version": "7", - "when": 1742438293056, - "tag": "0080_slim_quasar", - "breakpoints": true - }, - { - "idx": 81, - "version": "7", - "when": 1742438325523, - "tag": "0081_wealthy_roxanne_simpson", - "breakpoints": true - }, - { - "idx": 82, - "version": "7", - "when": 1742546361638, - "tag": "0082_serious_revanche", - "breakpoints": true - }, - { - "idx": 83, - "version": "7", - "when": 1742546598469, - "tag": "0083_dark_firestar", - "breakpoints": true - }, - { - "idx": 84, - "version": "7", - "when": 1742546693649, - "tag": "0084_familiar_skrulls", - "breakpoints": true - }, - { - "idx": 85, - "version": "7", - "when": 1742551864808, - "tag": "0085_thankful_medusa", - "breakpoints": true - }, - { - "idx": 86, - "version": "7", - "when": 1742553660359, - "tag": "0086_chubby_proudstar", - "breakpoints": true - }, - { - "idx": 87, - "version": "7", - "when": 1742693077698, - "tag": "0087_tidy_eddie_brock", - "breakpoints": true - }, - { - "idx": 88, - "version": "7", - "when": 1742699998533, - "tag": "0088_secret_quentin_quire", - "breakpoints": true - }, - { - "idx": 89, - "version": "7", - "when": 1742700073390, - "tag": "0089_faulty_lester", - "breakpoints": true - }, - { - "idx": 90, - "version": "7", - "when": 1742804009367, - "tag": "0090_outstanding_sebastian_shaw", - "breakpoints": true - }, - { - "idx": 91, - "version": "7", - "when": 1742827632024, - "tag": "0091_condemned_warstar", - "breakpoints": true - }, - { - "idx": 92, - "version": "7", - "when": 1742827680224, - "tag": "0092_smart_karma", - "breakpoints": true - }, - { - "idx": 93, - "version": "7", - "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 - }, - { - "idx": 96, - "version": "7", - "when": 1743465501411, - "tag": "0096_real_inhumans", - "breakpoints": true - }, - { - "idx": 97, - "version": "7", - "when": 1743465891564, - "tag": "0097_luxuriant_taskmaster", - "breakpoints": true - }, - { - "idx": 98, - "version": "7", - "when": 1743466023446, - "tag": "0098_easy_may_parker", - "breakpoints": true - }, - { - "idx": 99, - "version": "7", - "when": 1743466330883, - "tag": "0099_clear_captain_marvel", - "breakpoints": true - }, - { - "idx": 100, - "version": "7", - "when": 1743466358578, - "tag": "0100_normal_dreaming_celestial", - "breakpoints": true - }, - { - "idx": 101, - "version": "7", - "when": 1743466471098, - "tag": "0101_curious_landau", - "breakpoints": true - }, - { - "idx": 102, - "version": "7", - "when": 1743466532129, - "tag": "0102_organic_bloodscream", - "breakpoints": true - }, - { - "idx": 103, - "version": "7", - "when": 1743466562175, - "tag": "0103_married_risque", - "breakpoints": true - }, - { - "idx": 104, - "version": "7", - "when": 1743466803457, - "tag": "0104_lovely_captain_america", - "breakpoints": true - }, - { - "idx": 105, - "version": "7", - "when": 1743474600187, - "tag": "0105_eminent_brother_voodoo", - "breakpoints": true - }, - { - "idx": 106, - "version": "7", - "when": 1743483515295, - "tag": "0106_mature_hawkeye", - "breakpoints": true - }, - { - "idx": 107, - "version": "7", - "when": 1743483572862, - "tag": "0107_curly_thor", - "breakpoints": true - }, - { - "idx": 108, - "version": "7", - "when": 1743486157089, - "tag": "0108_known_grim_reaper", - "breakpoints": true - }, - { - "idx": 109, - "version": "7", - "when": 1743551772735, - "tag": "0109_wooden_blade", - "breakpoints": true - }, - { - "idx": 110, - "version": "7", - "when": 1743583869604, - "tag": "0110_round_iron_monger", - "breakpoints": true - }, - { - "idx": 111, - "version": "7", - "when": 1743654065918, - "tag": "0111_old_amphibian", - "breakpoints": true - } - ] -}
\ No newline at end of file |
