summaryrefslogtreecommitdiff
path: root/db/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrations')
-rw-r--r--db/migrations/0000_dusty_skaar.sql51
-rw-r--r--db/migrations/0000_shiny_wiccan.sql (renamed from db/migrations/0094_fresh_blur.sql)263
-rw-r--r--db/migrations/0001_fast_cassandra_nova.sql2
-rw-r--r--db/migrations/0001_robust_landau.sql32
-rw-r--r--db/migrations/0002_amusing_squirrel_girl.sql2
-rw-r--r--db/migrations/0002_puzzling_johnny_blaze.sql1
-rw-r--r--db/migrations/0003_unknown_speed_demon.sql5
-rw-r--r--db/migrations/0004_cheerful_stark_industries.sql2
-rw-r--r--db/migrations/0005_loud_whizzer.sql1
-rw-r--r--db/migrations/0006_tan_mongu.sql2
-rw-r--r--db/migrations/0007_big_franklin_storm.sql37
-rw-r--r--db/migrations/0008_previous_omega_red.sql1
-rw-r--r--db/migrations/0009_aromatic_falcon.sql1
-rw-r--r--db/migrations/0010_big_sue_storm.sql92
-rw-r--r--db/migrations/0011_tense_madame_web.sql3
-rw-r--r--db/migrations/0012_giant_sunfire.sql6
-rw-r--r--db/migrations/0013_exotic_blazing_skull.sql1
-rw-r--r--db/migrations/0014_clammy_power_man.sql14
-rw-r--r--db/migrations/0015_black_fixer.sql18
-rw-r--r--db/migrations/0016_fat_komodo.sql5
-rw-r--r--db/migrations/0017_thin_chimera.sql1
-rw-r--r--db/migrations/0018_tiny_robbie_robertson.sql2
-rw-r--r--db/migrations/0019_bumpy_anthem.sql3
-rw-r--r--db/migrations/0020_chubby_carnage.sql2
-rw-r--r--db/migrations/0021_nappy_dexter_bennett.sql1
-rw-r--r--db/migrations/0022_panoramic_mad_thinker.sql8
-rw-r--r--db/migrations/0023_familiar_raza.sql56
-rw-r--r--db/migrations/0024_eager_bill_hollister.sql2
-rw-r--r--db/migrations/0025_complex_husk.sql1
-rw-r--r--db/migrations/0026_tiresome_jackpot.sql2
-rw-r--r--db/migrations/0027_yummy_senator_kelly.sql1
-rw-r--r--db/migrations/0028_eminent_shockwave.sql2
-rw-r--r--db/migrations/0029_oval_carmella_unuscione.sql2
-rw-r--r--db/migrations/0030_zippy_the_order.sql16
-rw-r--r--db/migrations/0031_curvy_starhawk.sql1
-rw-r--r--db/migrations/0032_unusual_speedball.sql1
-rw-r--r--db/migrations/0033_chemical_maggott.sql2
-rw-r--r--db/migrations/0035_sweet_revanche.sql2
-rw-r--r--db/migrations/0036_aberrant_marvel_apes.sql9
-rw-r--r--db/migrations/0037_legal_pretty_boy.sql9
-rw-r--r--db/migrations/0038_tough_mimic.sql2
-rw-r--r--db/migrations/0039_elite_zemo.sql3
-rw-r--r--db/migrations/0040_absurd_human_cannonball.sql15
-rw-r--r--db/migrations/0041_absurd_spyke.sql1
-rw-r--r--db/migrations/0042_panoramic_daimon_hellstrom.sql12
-rw-r--r--db/migrations/0043_pale_black_bird.sql3
-rw-r--r--db/migrations/0044_lush_tenebrous.sql2
-rw-r--r--db/migrations/0045_complex_gamora.sql2
-rw-r--r--db/migrations/0046_overjoyed_tinkerer.sql2
-rw-r--r--db/migrations/0047_broad_the_executioner.sql34
-rw-r--r--db/migrations/0048_strange_ultimo.sql16
-rw-r--r--db/migrations/0049_green_mattie_franklin.sql3
-rw-r--r--db/migrations/0050_furry_black_tarantula.sql14
-rw-r--r--db/migrations/0051_perpetual_war_machine.sql5
-rw-r--r--db/migrations/0052_little_legion.sql2
-rw-r--r--db/migrations/0053_fantastic_synch.sql1
-rw-r--r--db/migrations/0054_polite_darwin.sql81
-rw-r--r--db/migrations/0055_lonely_excalibur.sql69
-rw-r--r--db/migrations/0056_majestic_khan.sql34
-rw-r--r--db/migrations/0057_fancy_serpent_society.sql29
-rw-r--r--db/migrations/0058_familiar_bloodscream.sql1
-rw-r--r--db/migrations/0059_familiar_yellow_claw.sql1
-rw-r--r--db/migrations/0060_confused_ultimo.sql32
-rw-r--r--db/migrations/0061_warm_secret_warriors.sql2
-rw-r--r--db/migrations/0062_zippy_human_torch.sql12
-rw-r--r--db/migrations/0063_amused_nightcrawler.sql1
-rw-r--r--db/migrations/0064_curved_tony_stark.sql1
-rw-r--r--db/migrations/0065_redundant_sunset_bain.sql9
-rw-r--r--db/migrations/0066_powerful_shard.sql4
-rw-r--r--db/migrations/0067_careless_chameleon.sql2
-rw-r--r--db/migrations/0068_worried_annihilus.sql2
-rw-r--r--db/migrations/0069_whole_madelyne_pryor.sql2
-rw-r--r--db/migrations/0070_cool_rage.sql2
-rw-r--r--db/migrations/0071_worthless_shadow_king.sql1
-rw-r--r--db/migrations/0072_certain_punisher.sql1
-rw-r--r--db/migrations/0073_damp_reaper.sql13
-rw-r--r--db/migrations/0074_wet_ezekiel.sql2
-rw-r--r--db/migrations/0075_tough_epoch.sql46
-rw-r--r--db/migrations/0076_cloudy_vindicator.sql1
-rw-r--r--db/migrations/0077_past_ted_forrester.sql1
-rw-r--r--db/migrations/0078_empty_shooting_star.sql26
-rw-r--r--db/migrations/0079_big_sue_storm.sql10
-rw-r--r--db/migrations/0080_slim_quasar.sql4
-rw-r--r--db/migrations/0081_wealthy_roxanne_simpson.sql4
-rw-r--r--db/migrations/0082_serious_revanche.sql40
-rw-r--r--db/migrations/0083_dark_firestar.sql3
-rw-r--r--db/migrations/0084_familiar_skrulls.sql2
-rw-r--r--db/migrations/0085_thankful_medusa.sql6
-rw-r--r--db/migrations/0086_chubby_proudstar.sql18
-rw-r--r--db/migrations/0087_tidy_eddie_brock.sql59
-rw-r--r--db/migrations/0088_secret_quentin_quire.sql13
-rw-r--r--db/migrations/0089_faulty_lester.sql6
-rw-r--r--db/migrations/0090_outstanding_sebastian_shaw.sql7
-rw-r--r--db/migrations/0091_condemned_warstar.sql2
-rw-r--r--db/migrations/0092_smart_karma.sql2
-rw-r--r--db/migrations/0093_young_the_hunter.sql1
-rw-r--r--db/migrations/0094_brave_sue_storm.sql55
-rw-r--r--db/migrations/0094_yellow_living_tribunal.sql4
-rw-r--r--db/migrations/0095_abnormal_virginia_dare.sql55
-rw-r--r--db/migrations/0095_mute_lizard.sql1
-rw-r--r--db/migrations/0095_odd_slayback.sql55
-rw-r--r--db/migrations/0097_poa_initial_setup.sql95
-rw-r--r--db/migrations/meta/0000_snapshot.json5870
-rw-r--r--db/migrations/meta/0001_snapshot.json (renamed from db/migrations/meta/0094_snapshot.json)1601
-rw-r--r--db/migrations/meta/0002_snapshot.json (renamed from db/migrations/meta/0095_snapshot.json)1599
-rw-r--r--db/migrations/meta/_journal.json663
106 files changed, 8797 insertions, 2532 deletions
diff --git a/db/migrations/0000_dusty_skaar.sql b/db/migrations/0000_dusty_skaar.sql
deleted file mode 100644
index 1f56428d..00000000
--- a/db/migrations/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/0094_fresh_blur.sql b/db/migrations/0000_shiny_wiccan.sql
index 007336d2..f269dc04 100644
--- a/db/migrations/0094_fresh_blur.sql
+++ b/db/migrations/0000_shiny_wiccan.sql
@@ -76,6 +76,29 @@ CREATE TABLE "contracts" (
CONSTRAINT "contracts_contract_no_unique" UNIQUE("contract_no")
);
--> statement-breakpoint
+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 "items" (
"id" serial PRIMARY KEY NOT NULL,
"item_code" varchar(100),
@@ -97,6 +120,16 @@ CREATE TABLE "pq_criterias" (
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
+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
CREATE TABLE "vendor_criteria_attachments" (
"id" serial PRIMARY KEY NOT NULL,
"vendor_criteria_answer_id" integer NOT NULL,
@@ -112,6 +145,7 @@ CREATE TABLE "vendor_pq_criteria_answers" (
"id" serial PRIMARY KEY NOT NULL,
"vendor_id" integer NOT NULL,
"criteria_id" integer NOT NULL,
+ "project_id" integer,
"answer" text,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
@@ -125,6 +159,19 @@ CREATE TABLE "vendor_pq_review_logs" (
"created_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
+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
CREATE TABLE "projects" (
"id" serial PRIMARY KEY NOT NULL,
"code" varchar(50) NOT NULL,
@@ -262,19 +309,6 @@ CREATE TABLE "vendor_technical_responses" (
"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,
@@ -331,11 +365,13 @@ CREATE TABLE "form_entries" (
--> statement-breakpoint
CREATE TABLE "form_metas" (
"id" serial PRIMARY KEY NOT NULL,
+ "project_id" integer 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
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "form_code_project_unique" UNIQUE("project_id","form_code")
);
--> statement-breakpoint
CREATE TABLE "forms" (
@@ -347,35 +383,31 @@ CREATE TABLE "forms" (
"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),
+ "project_id" integer NOT NULL,
"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
+ "updated_at" timestamp DEFAULT now() NOT NULL,
+ CONSTRAINT "uniq_code_in_project" UNIQUE("project_id","code")
);
--> statement-breakpoint
CREATE TABLE "tag_subfield_options" (
"id" serial PRIMARY KEY NOT NULL,
+ "project_id" integer 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
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "uniq_attribute_project_code" UNIQUE("project_id","attributes_id","code")
);
--> statement-breakpoint
CREATE TABLE "tag_subfields" (
"id" serial PRIMARY KEY NOT NULL,
+ "project_id" integer NOT NULL,
"tag_type_code" varchar(50) NOT NULL,
"attributes_id" varchar(50) NOT NULL,
"attributes_description" text NOT NULL,
@@ -384,24 +416,28 @@ CREATE TABLE "tag_subfields" (
"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")
+ CONSTRAINT "uniq_tag_type_attribute" UNIQUE("project_id","tag_type_code","attributes_id")
);
--> statement-breakpoint
CREATE TABLE "tag_type_class_form_mappings" (
"id" serial PRIMARY KEY NOT NULL,
+ "project_id" integer 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
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "uniq_mapping_in_project" UNIQUE("project_id","tag_type_label","class_label","form_code")
);
--> statement-breakpoint
CREATE TABLE "tag_types" (
- "code" varchar(50) PRIMARY KEY NOT NULL,
+ "code" varchar(50) NOT NULL,
+ "project_id" integer 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
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+ CONSTRAINT "tag_types_code_project_id_pk" PRIMARY KEY("code","project_id")
);
--> statement-breakpoint
CREATE TABLE "tags" (
@@ -426,19 +462,6 @@ CREATE TABLE "vendor_data_report_temps" (
"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,
@@ -495,6 +518,18 @@ CREATE TABLE "vendor_attachments" (
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
+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
+);
+--> statement-breakpoint
CREATE TABLE "vendor_contacts" (
"id" serial PRIMARY KEY NOT NULL,
"vendor_id" integer NOT NULL,
@@ -507,6 +542,28 @@ CREATE TABLE "vendor_contacts" (
"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,
+ "investigation_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
CREATE TABLE "vendor_possible_items" (
"id" serial PRIMARY KEY NOT NULL,
"vendor_id" integer NOT NULL,
@@ -538,16 +595,37 @@ CREATE TABLE "vendors" (
"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
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 "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 "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;--> 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_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;--> 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_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 "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 "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
@@ -582,11 +660,16 @@ ALTER TABLE "user_roles" ADD CONSTRAINT "user_roles_user_id_users_id_fk" FOREIGN
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 "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 "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 "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 "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
@@ -596,6 +679,8 @@ ALTER TABLE "documents" ADD CONSTRAINT "documents_contract_id_contracts_id_fk" F
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_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
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
@@ -608,11 +693,7 @@ CREATE VIEW "public"."contracts_detail_view" AS (select "contracts"."id", "contr
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((
+ ) as "has_signature", COALESCE((
SELECT json_agg(
json_build_object(
'id', ci.id,
@@ -662,6 +743,11 @@ CREATE VIEW "public"."contracts_detail_view" AS (select "contracts"."id", "contr
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"."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"."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(*)
@@ -684,6 +770,7 @@ CREATE VIEW "public"."role_view" AS (select "roles"."id" as "id", "roles"."name"
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"."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");--> statement-breakpoint
CREATE VIEW "public"."document_stages_view" AS (
SELECT
d.id AS document_id,
@@ -780,4 +867,74 @@ CREATE VIEW "public"."vendor_documents_view" AS (
FROM documents d
JOIN contracts c ON d.contract_id = c.id
);--> 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");--> 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");--> 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/0001_fast_cassandra_nova.sql b/db/migrations/0001_fast_cassandra_nova.sql
new file mode 100644
index 00000000..69be883a
--- /dev/null
+++ b/db/migrations/0001_fast_cassandra_nova.sql
@@ -0,0 +1,2 @@
+DROP VIEW "public"."view_tag_subfields";--> statement-breakpoint
+CREATE VIEW "public"."view_tag_subfields" AS (select "tag_subfields"."id", "tag_subfields"."tag_type_code", "tag_types"."description", "tag_subfields"."attributes_id", "tag_subfields"."attributes_description", "tag_subfields"."expression", "tag_subfields"."delimiter", "tag_subfields"."sort_order", "tag_subfields"."created_at", "tag_subfields"."updated_at", "projects"."id", "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/0001_robust_landau.sql b/db/migrations/0001_robust_landau.sql
deleted file mode 100644
index 94368814..00000000
--- a/db/migrations/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/0002_amusing_squirrel_girl.sql b/db/migrations/0002_amusing_squirrel_girl.sql
new file mode 100644
index 00000000..565a9324
--- /dev/null
+++ b/db/migrations/0002_amusing_squirrel_girl.sql
@@ -0,0 +1,2 @@
+DROP VIEW "public"."view_tag_subfields";--> statement-breakpoint
+CREATE VIEW "public"."view_tag_subfields" AS (select "tag_subfields"."tag_type_code", "tag_types"."description", "tag_subfields"."attributes_id", "tag_subfields"."attributes_description", "tag_subfields"."expression", "tag_subfields"."delimiter", "tag_subfields"."sort_order", "tag_subfields"."created_at", "tag_subfields"."updated_at", "projects"."id", "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/0002_puzzling_johnny_blaze.sql b/db/migrations/0002_puzzling_johnny_blaze.sql
deleted file mode 100644
index f49fcbe7..00000000
--- a/db/migrations/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/0003_unknown_speed_demon.sql b/db/migrations/0003_unknown_speed_demon.sql
deleted file mode 100644
index 19fc36a8..00000000
--- a/db/migrations/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/0004_cheerful_stark_industries.sql b/db/migrations/0004_cheerful_stark_industries.sql
deleted file mode 100644
index 5f8648e9..00000000
--- a/db/migrations/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/0005_loud_whizzer.sql b/db/migrations/0005_loud_whizzer.sql
deleted file mode 100644
index cfd7a735..00000000
--- a/db/migrations/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/0006_tan_mongu.sql b/db/migrations/0006_tan_mongu.sql
deleted file mode 100644
index 418429d5..00000000
--- a/db/migrations/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/0007_big_franklin_storm.sql b/db/migrations/0007_big_franklin_storm.sql
deleted file mode 100644
index 33e34a8a..00000000
--- a/db/migrations/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/0008_previous_omega_red.sql b/db/migrations/0008_previous_omega_red.sql
deleted file mode 100644
index 4f569763..00000000
--- a/db/migrations/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/0009_aromatic_falcon.sql b/db/migrations/0009_aromatic_falcon.sql
deleted file mode 100644
index 07ec787b..00000000
--- a/db/migrations/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/0010_big_sue_storm.sql b/db/migrations/0010_big_sue_storm.sql
deleted file mode 100644
index 572b3c11..00000000
--- a/db/migrations/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/0011_tense_madame_web.sql b/db/migrations/0011_tense_madame_web.sql
deleted file mode 100644
index 49414174..00000000
--- a/db/migrations/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/0012_giant_sunfire.sql b/db/migrations/0012_giant_sunfire.sql
deleted file mode 100644
index 97077702..00000000
--- a/db/migrations/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/0013_exotic_blazing_skull.sql b/db/migrations/0013_exotic_blazing_skull.sql
deleted file mode 100644
index 367cc428..00000000
--- a/db/migrations/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/0014_clammy_power_man.sql b/db/migrations/0014_clammy_power_man.sql
deleted file mode 100644
index 3fd6a1e3..00000000
--- a/db/migrations/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/0015_black_fixer.sql b/db/migrations/0015_black_fixer.sql
deleted file mode 100644
index da6260c8..00000000
--- a/db/migrations/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/0016_fat_komodo.sql b/db/migrations/0016_fat_komodo.sql
deleted file mode 100644
index f9e1840c..00000000
--- a/db/migrations/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/0017_thin_chimera.sql b/db/migrations/0017_thin_chimera.sql
deleted file mode 100644
index 13ea1472..00000000
--- a/db/migrations/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/0018_tiny_robbie_robertson.sql b/db/migrations/0018_tiny_robbie_robertson.sql
deleted file mode 100644
index 85367f7c..00000000
--- a/db/migrations/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/0019_bumpy_anthem.sql b/db/migrations/0019_bumpy_anthem.sql
deleted file mode 100644
index 8d8498f1..00000000
--- a/db/migrations/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/0020_chubby_carnage.sql b/db/migrations/0020_chubby_carnage.sql
deleted file mode 100644
index 5f0a6352..00000000
--- a/db/migrations/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/0021_nappy_dexter_bennett.sql b/db/migrations/0021_nappy_dexter_bennett.sql
deleted file mode 100644
index 77326cb4..00000000
--- a/db/migrations/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/0022_panoramic_mad_thinker.sql b/db/migrations/0022_panoramic_mad_thinker.sql
deleted file mode 100644
index dfdbd420..00000000
--- a/db/migrations/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/0023_familiar_raza.sql b/db/migrations/0023_familiar_raza.sql
deleted file mode 100644
index 1345d0bb..00000000
--- a/db/migrations/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/0024_eager_bill_hollister.sql b/db/migrations/0024_eager_bill_hollister.sql
deleted file mode 100644
index 4b7da41f..00000000
--- a/db/migrations/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/0025_complex_husk.sql b/db/migrations/0025_complex_husk.sql
deleted file mode 100644
index d007055f..00000000
--- a/db/migrations/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/0026_tiresome_jackpot.sql b/db/migrations/0026_tiresome_jackpot.sql
deleted file mode 100644
index 96ea847b..00000000
--- a/db/migrations/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/0027_yummy_senator_kelly.sql b/db/migrations/0027_yummy_senator_kelly.sql
deleted file mode 100644
index 4cdf5c1b..00000000
--- a/db/migrations/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/0028_eminent_shockwave.sql b/db/migrations/0028_eminent_shockwave.sql
deleted file mode 100644
index e7c7997c..00000000
--- a/db/migrations/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/0029_oval_carmella_unuscione.sql b/db/migrations/0029_oval_carmella_unuscione.sql
deleted file mode 100644
index 78b2a4b0..00000000
--- a/db/migrations/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/0030_zippy_the_order.sql b/db/migrations/0030_zippy_the_order.sql
deleted file mode 100644
index 020f8329..00000000
--- a/db/migrations/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/0031_curvy_starhawk.sql b/db/migrations/0031_curvy_starhawk.sql
deleted file mode 100644
index 019db4c6..00000000
--- a/db/migrations/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/0032_unusual_speedball.sql b/db/migrations/0032_unusual_speedball.sql
deleted file mode 100644
index b977f270..00000000
--- a/db/migrations/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/0033_chemical_maggott.sql b/db/migrations/0033_chemical_maggott.sql
deleted file mode 100644
index 9c87c07e..00000000
--- a/db/migrations/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/0035_sweet_revanche.sql b/db/migrations/0035_sweet_revanche.sql
deleted file mode 100644
index e54ae28c..00000000
--- a/db/migrations/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/0036_aberrant_marvel_apes.sql b/db/migrations/0036_aberrant_marvel_apes.sql
deleted file mode 100644
index 54c6c86d..00000000
--- a/db/migrations/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/0037_legal_pretty_boy.sql b/db/migrations/0037_legal_pretty_boy.sql
deleted file mode 100644
index 603798fe..00000000
--- a/db/migrations/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/0038_tough_mimic.sql b/db/migrations/0038_tough_mimic.sql
deleted file mode 100644
index 8ec5213a..00000000
--- a/db/migrations/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/0039_elite_zemo.sql b/db/migrations/0039_elite_zemo.sql
deleted file mode 100644
index 638b03ef..00000000
--- a/db/migrations/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/0040_absurd_human_cannonball.sql b/db/migrations/0040_absurd_human_cannonball.sql
deleted file mode 100644
index 7a6170f5..00000000
--- a/db/migrations/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/0041_absurd_spyke.sql b/db/migrations/0041_absurd_spyke.sql
deleted file mode 100644
index 99eca50c..00000000
--- a/db/migrations/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/0042_panoramic_daimon_hellstrom.sql b/db/migrations/0042_panoramic_daimon_hellstrom.sql
deleted file mode 100644
index 83288796..00000000
--- a/db/migrations/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/0043_pale_black_bird.sql b/db/migrations/0043_pale_black_bird.sql
deleted file mode 100644
index b50ea4e1..00000000
--- a/db/migrations/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/0044_lush_tenebrous.sql b/db/migrations/0044_lush_tenebrous.sql
deleted file mode 100644
index 514a440d..00000000
--- a/db/migrations/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/0045_complex_gamora.sql b/db/migrations/0045_complex_gamora.sql
deleted file mode 100644
index f39e6de5..00000000
--- a/db/migrations/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/0046_overjoyed_tinkerer.sql b/db/migrations/0046_overjoyed_tinkerer.sql
deleted file mode 100644
index 118d5f4c..00000000
--- a/db/migrations/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/0047_broad_the_executioner.sql b/db/migrations/0047_broad_the_executioner.sql
deleted file mode 100644
index 287830a0..00000000
--- a/db/migrations/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/0048_strange_ultimo.sql b/db/migrations/0048_strange_ultimo.sql
deleted file mode 100644
index 22abcf99..00000000
--- a/db/migrations/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/0049_green_mattie_franklin.sql b/db/migrations/0049_green_mattie_franklin.sql
deleted file mode 100644
index bdab2091..00000000
--- a/db/migrations/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/0050_furry_black_tarantula.sql b/db/migrations/0050_furry_black_tarantula.sql
deleted file mode 100644
index 66aaa47e..00000000
--- a/db/migrations/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/0051_perpetual_war_machine.sql b/db/migrations/0051_perpetual_war_machine.sql
deleted file mode 100644
index ec89fe0d..00000000
--- a/db/migrations/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/0052_little_legion.sql b/db/migrations/0052_little_legion.sql
deleted file mode 100644
index 89cf16dd..00000000
--- a/db/migrations/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/0053_fantastic_synch.sql b/db/migrations/0053_fantastic_synch.sql
deleted file mode 100644
index ea43ba7e..00000000
--- a/db/migrations/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/0054_polite_darwin.sql b/db/migrations/0054_polite_darwin.sql
deleted file mode 100644
index ead16a74..00000000
--- a/db/migrations/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/0055_lonely_excalibur.sql b/db/migrations/0055_lonely_excalibur.sql
deleted file mode 100644
index 30d5d9bd..00000000
--- a/db/migrations/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/0056_majestic_khan.sql b/db/migrations/0056_majestic_khan.sql
deleted file mode 100644
index 161e1c3c..00000000
--- a/db/migrations/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/0057_fancy_serpent_society.sql b/db/migrations/0057_fancy_serpent_society.sql
deleted file mode 100644
index 780d023b..00000000
--- a/db/migrations/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/0058_familiar_bloodscream.sql b/db/migrations/0058_familiar_bloodscream.sql
deleted file mode 100644
index 6c4bdc8d..00000000
--- a/db/migrations/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/0059_familiar_yellow_claw.sql b/db/migrations/0059_familiar_yellow_claw.sql
deleted file mode 100644
index 902e8cde..00000000
--- a/db/migrations/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/0060_confused_ultimo.sql b/db/migrations/0060_confused_ultimo.sql
deleted file mode 100644
index ff3beef8..00000000
--- a/db/migrations/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/0061_warm_secret_warriors.sql b/db/migrations/0061_warm_secret_warriors.sql
deleted file mode 100644
index 61850127..00000000
--- a/db/migrations/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/0062_zippy_human_torch.sql b/db/migrations/0062_zippy_human_torch.sql
deleted file mode 100644
index 907276e7..00000000
--- a/db/migrations/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/0063_amused_nightcrawler.sql b/db/migrations/0063_amused_nightcrawler.sql
deleted file mode 100644
index bd7b34b7..00000000
--- a/db/migrations/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/0064_curved_tony_stark.sql b/db/migrations/0064_curved_tony_stark.sql
deleted file mode 100644
index e5f8b280..00000000
--- a/db/migrations/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/0065_redundant_sunset_bain.sql b/db/migrations/0065_redundant_sunset_bain.sql
deleted file mode 100644
index ad2d8ca7..00000000
--- a/db/migrations/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/0066_powerful_shard.sql b/db/migrations/0066_powerful_shard.sql
deleted file mode 100644
index cbd39199..00000000
--- a/db/migrations/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/0067_careless_chameleon.sql b/db/migrations/0067_careless_chameleon.sql
deleted file mode 100644
index 26dca9e5..00000000
--- a/db/migrations/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/0068_worried_annihilus.sql b/db/migrations/0068_worried_annihilus.sql
deleted file mode 100644
index 8f53b83e..00000000
--- a/db/migrations/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/0069_whole_madelyne_pryor.sql b/db/migrations/0069_whole_madelyne_pryor.sql
deleted file mode 100644
index 4db061a6..00000000
--- a/db/migrations/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/0070_cool_rage.sql b/db/migrations/0070_cool_rage.sql
deleted file mode 100644
index ee4148eb..00000000
--- a/db/migrations/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/0071_worthless_shadow_king.sql b/db/migrations/0071_worthless_shadow_king.sql
deleted file mode 100644
index 4311126a..00000000
--- a/db/migrations/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/0072_certain_punisher.sql b/db/migrations/0072_certain_punisher.sql
deleted file mode 100644
index f47de26d..00000000
--- a/db/migrations/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/0073_damp_reaper.sql b/db/migrations/0073_damp_reaper.sql
deleted file mode 100644
index 437a2d04..00000000
--- a/db/migrations/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/0074_wet_ezekiel.sql b/db/migrations/0074_wet_ezekiel.sql
deleted file mode 100644
index d8651f05..00000000
--- a/db/migrations/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/0075_tough_epoch.sql b/db/migrations/0075_tough_epoch.sql
deleted file mode 100644
index 0428f864..00000000
--- a/db/migrations/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/0076_cloudy_vindicator.sql b/db/migrations/0076_cloudy_vindicator.sql
deleted file mode 100644
index b8721caf..00000000
--- a/db/migrations/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/0077_past_ted_forrester.sql b/db/migrations/0077_past_ted_forrester.sql
deleted file mode 100644
index 8168fd1d..00000000
--- a/db/migrations/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/0078_empty_shooting_star.sql b/db/migrations/0078_empty_shooting_star.sql
deleted file mode 100644
index 032f9ae0..00000000
--- a/db/migrations/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/0079_big_sue_storm.sql b/db/migrations/0079_big_sue_storm.sql
deleted file mode 100644
index c9d01535..00000000
--- a/db/migrations/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/0080_slim_quasar.sql b/db/migrations/0080_slim_quasar.sql
deleted file mode 100644
index e7d4e183..00000000
--- a/db/migrations/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/0081_wealthy_roxanne_simpson.sql b/db/migrations/0081_wealthy_roxanne_simpson.sql
deleted file mode 100644
index 90e63a27..00000000
--- a/db/migrations/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/0082_serious_revanche.sql b/db/migrations/0082_serious_revanche.sql
deleted file mode 100644
index c48e582b..00000000
--- a/db/migrations/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/0083_dark_firestar.sql b/db/migrations/0083_dark_firestar.sql
deleted file mode 100644
index 9b05fbe3..00000000
--- a/db/migrations/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/0084_familiar_skrulls.sql b/db/migrations/0084_familiar_skrulls.sql
deleted file mode 100644
index 95bed728..00000000
--- a/db/migrations/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/0085_thankful_medusa.sql b/db/migrations/0085_thankful_medusa.sql
deleted file mode 100644
index d07347bb..00000000
--- a/db/migrations/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/0086_chubby_proudstar.sql b/db/migrations/0086_chubby_proudstar.sql
deleted file mode 100644
index 450f31fb..00000000
--- a/db/migrations/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/0087_tidy_eddie_brock.sql b/db/migrations/0087_tidy_eddie_brock.sql
deleted file mode 100644
index 533d3a40..00000000
--- a/db/migrations/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/0088_secret_quentin_quire.sql b/db/migrations/0088_secret_quentin_quire.sql
deleted file mode 100644
index c19408e9..00000000
--- a/db/migrations/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/0089_faulty_lester.sql b/db/migrations/0089_faulty_lester.sql
deleted file mode 100644
index 9d495f30..00000000
--- a/db/migrations/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/0090_outstanding_sebastian_shaw.sql b/db/migrations/0090_outstanding_sebastian_shaw.sql
deleted file mode 100644
index d448890b..00000000
--- a/db/migrations/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/0091_condemned_warstar.sql b/db/migrations/0091_condemned_warstar.sql
deleted file mode 100644
index e4b74f2c..00000000
--- a/db/migrations/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/0092_smart_karma.sql b/db/migrations/0092_smart_karma.sql
deleted file mode 100644
index 1ce421b9..00000000
--- a/db/migrations/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/0093_young_the_hunter.sql b/db/migrations/0093_young_the_hunter.sql
deleted file mode 100644
index f290be7f..00000000
--- a/db/migrations/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/0094_brave_sue_storm.sql b/db/migrations/0094_brave_sue_storm.sql
deleted file mode 100644
index bdea91f0..00000000
--- a/db/migrations/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/0094_yellow_living_tribunal.sql b/db/migrations/0094_yellow_living_tribunal.sql
deleted file mode 100644
index 6e97ef73..00000000
--- a/db/migrations/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/0095_abnormal_virginia_dare.sql b/db/migrations/0095_abnormal_virginia_dare.sql
deleted file mode 100644
index bdea91f0..00000000
--- a/db/migrations/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/0095_mute_lizard.sql b/db/migrations/0095_mute_lizard.sql
deleted file mode 100644
index 062fcf53..00000000
--- a/db/migrations/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/0095_odd_slayback.sql b/db/migrations/0095_odd_slayback.sql
deleted file mode 100644
index bdea91f0..00000000
--- a/db/migrations/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/0097_poa_initial_setup.sql b/db/migrations/0097_poa_initial_setup.sql
deleted file mode 100644
index fae3f4d1..00000000
--- a/db/migrations/0097_poa_initial_setup.sql
+++ /dev/null
@@ -1,95 +0,0 @@
--- Drop existing tables and views
-DROP VIEW IF EXISTS change_orders_detail_view;
-DROP TABLE IF EXISTS change_order_items CASCADE;
-DROP TABLE IF EXISTS change_orders CASCADE;
-DROP VIEW IF EXISTS poa_detail_view;
-DROP TABLE IF EXISTS poa CASCADE;
-
--- Create POA table
-CREATE TABLE poa (
- id SERIAL PRIMARY KEY,
- 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 NOT NULL DEFAULT NOW(),
- updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
- CONSTRAINT poa_original_contract_no_contracts_contract_no_fk
- FOREIGN KEY (original_contract_no)
- REFERENCES contracts(contract_no)
- ON DELETE CASCADE,
- CONSTRAINT poa_project_id_projects_id_fk
- FOREIGN KEY (project_id)
- REFERENCES projects(id)
- ON DELETE CASCADE,
- CONSTRAINT poa_vendor_id_vendors_id_fk
- FOREIGN KEY (vendor_id)
- REFERENCES vendors(id)
- ON DELETE CASCADE
-);
-
--- Create POA detail view
-CREATE VIEW poa_detail_view AS
-SELECT
- -- POA primary information
- poa.id,
- poa.contract_no,
- poa.change_reason,
- poa.approval_status,
-
- -- Original PO information
- poa.original_contract_no,
- poa.original_contract_name,
- poa.original_status,
- c.start_date as original_start_date,
- c.end_date as original_end_date,
-
- -- Project information
- poa.project_id,
- p.code as project_code,
- p.name as project_name,
-
- -- Vendor information
- poa.vendor_id,
- v.vendor_name,
-
- -- Changed delivery details
- poa.delivery_terms,
- poa.delivery_date,
- poa.delivery_location,
-
- -- Changed financial information
- poa.currency,
- poa.total_amount,
- poa.discount,
- poa.tax,
- poa.shipping_fee,
- poa.net_total,
-
- -- Timestamps
- poa.created_at,
- poa.updated_at,
-
- -- Electronic signature status
- EXISTS (
- SELECT 1
- FROM contract_envelopes
- WHERE contract_envelopes.contract_id = poa.id
- ) as has_signature
-FROM poa
-LEFT JOIN contracts c ON poa.original_contract_no = c.contract_no
-LEFT JOIN projects p ON poa.project_id = p.id
-LEFT JOIN vendors v ON poa.vendor_id = v.id; \ No newline at end of file
diff --git a/db/migrations/meta/0000_snapshot.json b/db/migrations/meta/0000_snapshot.json
new file mode 100644
index 00000000..055727b4
--- /dev/null
+++ b/db/migrations/meta/0000_snapshot.json
@@ -0,0 +1,5870 @@
+{
+ "id": "68675fae-994e-4be4-b8be-153c90faa9a4",
+ "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.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/meta/0094_snapshot.json b/db/migrations/meta/0001_snapshot.json
index acc0c4b0..434c60de 100644
--- a/db/migrations/meta/0094_snapshot.json
+++ b/db/migrations/meta/0001_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78",
- "prevId": "00000000-0000-0000-0000-000000000000",
+ "id": "7f934853-824a-413b-936f-b1b147eeedbe",
+ "prevId": "68675fae-994e-4be4-b8be-153c90faa9a4",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -622,6 +622,193 @@
"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": "",
@@ -744,6 +931,90 @@
"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": "",
@@ -843,6 +1114,12 @@
"primaryKey": false,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
"answer": {
"name": "answer",
"type": "text",
@@ -877,7 +1154,7 @@
"id"
],
"onDelete": "cascade",
- "onUpdate": "no action"
+ "onUpdate": "cascade"
},
"vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": {
"name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk",
@@ -890,7 +1167,20 @@
"id"
],
"onDelete": "cascade",
- "onUpdate": "no action"
+ "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": {},
@@ -957,6 +1247,109 @@
"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": "",
@@ -2137,88 +2530,6 @@
"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": "",
@@ -2659,6 +2970,12 @@
"primaryKey": true,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"form_code": {
"name": "form_code",
"type": "varchar(50)",
@@ -2693,9 +3010,32 @@
}
},
"indexes": {},
- "foreignKeys": {},
+ "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": {},
+ "uniqueConstraints": {
+ "form_code_project_unique": {
+ "name": "form_code_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "form_code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -2798,71 +3138,6 @@
"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": "",
@@ -2884,6 +3159,12 @@
"cycle": false
}
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"code": {
"name": "code",
"type": "varchar(100)",
@@ -2919,22 +3200,46 @@
},
"indexes": {},
"foreignKeys": {
- "tag_classes_tag_type_code_tag_types_code_fk": {
- "name": "tag_classes_tag_type_code_tag_types_code_fk",
+ "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"
+ "tag_type_code",
+ "project_id"
],
"columnsTo": [
- "code"
+ "code",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
- "uniqueConstraints": {},
+ "uniqueConstraints": {
+ "uniq_code_in_project": {
+ "name": "uniq_code_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -2949,6 +3254,12 @@
"primaryKey": true,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"attributes_id": {
"name": "attributes_id",
"type": "varchar(50)",
@@ -2984,22 +3295,47 @@
},
"indexes": {},
"foreignKeys": {
- "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk": {
- "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk",
+ "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"
+ "attributes_id",
+ "project_id"
],
"columnsTo": [
- "attributes_id"
+ "attributes_id",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
- "uniqueConstraints": {},
+ "uniqueConstraints": {
+ "uniq_attribute_project_code": {
+ "name": "uniq_attribute_project_code",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "attributes_id",
+ "code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -3014,6 +3350,12 @@
"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)",
@@ -3068,15 +3410,30 @@
},
"indexes": {},
"foreignKeys": {
- "tag_subfields_tag_type_code_tag_types_code_fk": {
- "name": "tag_subfields_tag_type_code_tag_types_code_fk",
+ "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"
+ "tag_type_code",
+ "project_id"
],
"columnsTo": [
- "code"
+ "code",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
@@ -3088,6 +3445,7 @@
"name": "uniq_tag_type_attribute",
"nullsNotDistinct": false,
"columns": [
+ "project_id",
"tag_type_code",
"attributes_id"
]
@@ -3107,6 +3465,12 @@
"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)",
@@ -3147,9 +3511,34 @@
}
},
"indexes": {},
- "foreignKeys": {},
+ "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": {},
+ "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
@@ -3161,7 +3550,13 @@
"code": {
"name": "code",
"type": "varchar(50)",
- "primaryKey": true,
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
"notNull": true
},
"description": {
@@ -3186,8 +3581,30 @@
}
},
"indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
+ "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": {},
@@ -3384,80 +3801,6 @@
"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": "",
@@ -3954,6 +4297,76 @@
"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": "",
@@ -4038,6 +4451,162 @@
"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": "",
@@ -4245,6 +4814,88 @@
"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": {
@@ -4445,12 +5096,137 @@
"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\"",
+ "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\"",
@@ -4515,6 +5291,90 @@
"isExisting": false,
"materialized": false
},
+ "public.view_tag_subfields": {
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "serial",
+ "primaryKey": true,
+ "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\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\", \"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": {
@@ -4695,6 +5555,253 @@
"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": {
diff --git a/db/migrations/meta/0095_snapshot.json b/db/migrations/meta/0002_snapshot.json
index cf5f424c..9154b87c 100644
--- a/db/migrations/meta/0095_snapshot.json
+++ b/db/migrations/meta/0002_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "a87c6f47-5579-4e23-9f26-6a6da4a21a1c",
- "prevId": "cb76e692-c56a-4744-b2ac-3d8a4cf4ed78",
+ "id": "49f091fd-e963-4d97-b9a0-748b8ebdcd3a",
+ "prevId": "7f934853-824a-413b-936f-b1b147eeedbe",
"version": "7",
"dialect": "postgresql",
"tables": {
@@ -622,6 +622,193 @@
"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": "",
@@ -744,6 +931,90 @@
"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": "",
@@ -843,6 +1114,12 @@
"primaryKey": false,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false
+ },
"answer": {
"name": "answer",
"type": "text",
@@ -877,7 +1154,7 @@
"id"
],
"onDelete": "cascade",
- "onUpdate": "no action"
+ "onUpdate": "cascade"
},
"vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk": {
"name": "vendor_pq_criteria_answers_criteria_id_pq_criterias_id_fk",
@@ -890,7 +1167,20 @@
"id"
],
"onDelete": "cascade",
- "onUpdate": "no action"
+ "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": {},
@@ -957,6 +1247,109 @@
"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": "",
@@ -2137,88 +2530,6 @@
"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": "",
@@ -2659,6 +2970,12 @@
"primaryKey": true,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"form_code": {
"name": "form_code",
"type": "varchar(50)",
@@ -2693,9 +3010,32 @@
}
},
"indexes": {},
- "foreignKeys": {},
+ "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": {},
+ "uniqueConstraints": {
+ "form_code_project_unique": {
+ "name": "form_code_project_unique",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "form_code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -2798,71 +3138,6 @@
"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": "",
@@ -2884,6 +3159,12 @@
"cycle": false
}
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"code": {
"name": "code",
"type": "varchar(100)",
@@ -2919,22 +3200,46 @@
},
"indexes": {},
"foreignKeys": {
- "tag_classes_tag_type_code_tag_types_code_fk": {
- "name": "tag_classes_tag_type_code_tag_types_code_fk",
+ "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"
+ "tag_type_code",
+ "project_id"
],
"columnsTo": [
- "code"
+ "code",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
- "uniqueConstraints": {},
+ "uniqueConstraints": {
+ "uniq_code_in_project": {
+ "name": "uniq_code_in_project",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -2949,6 +3254,12 @@
"primaryKey": true,
"notNull": true
},
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true
+ },
"attributes_id": {
"name": "attributes_id",
"type": "varchar(50)",
@@ -2984,22 +3295,47 @@
},
"indexes": {},
"foreignKeys": {
- "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk": {
- "name": "tag_subfield_options_attributes_id_tag_subfields_attributes_id_fk",
+ "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"
+ "attributes_id",
+ "project_id"
],
"columnsTo": [
- "attributes_id"
+ "attributes_id",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
- "uniqueConstraints": {},
+ "uniqueConstraints": {
+ "uniq_attribute_project_code": {
+ "name": "uniq_attribute_project_code",
+ "nullsNotDistinct": false,
+ "columns": [
+ "project_id",
+ "attributes_id",
+ "code"
+ ]
+ }
+ },
"policies": {},
"checkConstraints": {},
"isRLSEnabled": false
@@ -3014,6 +3350,12 @@
"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)",
@@ -3068,15 +3410,30 @@
},
"indexes": {},
"foreignKeys": {
- "tag_subfields_tag_type_code_tag_types_code_fk": {
- "name": "tag_subfields_tag_type_code_tag_types_code_fk",
+ "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"
+ "tag_type_code",
+ "project_id"
],
"columnsTo": [
- "code"
+ "code",
+ "project_id"
],
"onDelete": "cascade",
"onUpdate": "no action"
@@ -3088,6 +3445,7 @@
"name": "uniq_tag_type_attribute",
"nullsNotDistinct": false,
"columns": [
+ "project_id",
"tag_type_code",
"attributes_id"
]
@@ -3107,6 +3465,12 @@
"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)",
@@ -3147,9 +3511,34 @@
}
},
"indexes": {},
- "foreignKeys": {},
+ "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": {},
+ "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
@@ -3161,7 +3550,13 @@
"code": {
"name": "code",
"type": "varchar(50)",
- "primaryKey": true,
+ "primaryKey": false,
+ "notNull": true
+ },
+ "project_id": {
+ "name": "project_id",
+ "type": "integer",
+ "primaryKey": false,
"notNull": true
},
"description": {
@@ -3186,8 +3581,30 @@
}
},
"indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
+ "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": {},
@@ -3384,80 +3801,6 @@
"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": "",
@@ -3954,6 +4297,76 @@
"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": "",
@@ -4038,6 +4451,162 @@
"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": "",
@@ -4245,6 +4814,88 @@
"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": {
@@ -4451,6 +5102,131 @@
"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\"",
@@ -4515,6 +5291,90 @@
"isExisting": false,
"materialized": false
},
+ "public.view_tag_subfields": {
+ "columns": {
+ "tag_type_code": {
+ "name": "tag_type_code",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_id": {
+ "name": "attributes_id",
+ "type": "varchar(50)",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "attributes_description": {
+ "name": "attributes_description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true
+ },
+ "expression": {
+ "name": "expression",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "delimiter": {
+ "name": "delimiter",
+ "type": "varchar(10)",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "sort_order": {
+ "name": "sort_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "default": 0
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp with time zone",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "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
+ }
+ },
+ "definition": "select \"tag_subfields\".\"tag_type_code\", \"tag_types\".\"description\", \"tag_subfields\".\"attributes_id\", \"tag_subfields\".\"attributes_description\", \"tag_subfields\".\"expression\", \"tag_subfields\".\"delimiter\", \"tag_subfields\".\"sort_order\", \"tag_subfields\".\"created_at\", \"tag_subfields\".\"updated_at\", \"projects\".\"id\", \"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": {
@@ -4695,6 +5555,253 @@
"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": {
diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json
index 36896522..f8e294e5 100644
--- a/db/migrations/meta/_journal.json
+++ b/db/migrations/meta/_journal.json
@@ -5,673 +5,22 @@
{
"idx": 0,
"version": "7",
- "when": 1736156207023,
- "tag": "0000_dusty_skaar",
+ "when": 1743654474299,
+ "tag": "0000_shiny_wiccan",
"breakpoints": true
},
{
"idx": 1,
"version": "7",
- "when": 1736243645330,
- "tag": "0001_robust_landau",
+ "when": 1743664946525,
+ "tag": "0001_fast_cassandra_nova",
"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",
+ "when": 1743665177495,
+ "tag": "0002_amusing_squirrel_girl",
"breakpoints": true
}
]