From 688d9884ca98b50d04ac78fc1f6e28e034a519c0 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Wed, 3 Sep 2025 12:44:32 +0000
Subject: (대표님) rfq-last 작업, vendorDocu 스키마 변경, 벤더 문서 관련 변경
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 db/migrations/0316_even_famine.sql | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'db/migrations/0316_even_famine.sql')

diff --git a/db/migrations/0316_even_famine.sql b/db/migrations/0316_even_famine.sql
index 1a34eac1..9b6a0e91 100644
--- a/db/migrations/0316_even_famine.sql
+++ b/db/migrations/0316_even_famine.sql
@@ -247,7 +247,10 @@ ALTER TABLE "rfq_last_vendor_responses" ADD CONSTRAINT "rfq_last_vendor_response
 ALTER TABLE "rfq_last_vendor_responses" ADD CONSTRAINT "rfq_last_vendor_responses_vendor_incoterms_code_incoterms_code_fk" FOREIGN KEY ("vendor_incoterms_code") REFERENCES "public"."incoterms"("code") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
 ALTER TABLE "rfq_last_vendor_responses" ADD CONSTRAINT "rfq_last_vendor_responses_created_by_users_id_fk" FOREIGN KEY ("created_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
 ALTER TABLE "rfq_last_vendor_responses" ADD CONSTRAINT "rfq_last_vendor_responses_updated_by_users_id_fk" FOREIGN KEY ("updated_by") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
-CREATE UNIQUE INDEX "rfq_last_latest_revision_idx" ON "rfq_last_attachment_revisions" USING btree ("attachment_id","is_latest") WHERE "rfq_last_attachment_revisions"."is_latest" = $1;--> statement-breakpoint
+-- drizzle-kit generate 시 버그난 쿼리를 주석 처리
+-- CREATE UNIQUE INDEX "rfq_last_latest_revision_idx" ON "rfq_last_attachment_revisions" USING btree ("attachment_id","is_latest") WHERE "rfq_last_attachment_revisions"."is_latest" = $1;--> statement-breakpoint
+-- 수동 수정 처리
+CREATE UNIQUE INDEX "rfq_last_latest_revision_idx" ON "rfq_last_attachment_revisions" USING btree ("attachment_id","is_latest") WHERE "rfq_last_attachment_revisions"."is_latest" = true;--> statement-breakpoint
 CREATE UNIQUE INDEX "rfq_last_attachment_revision_idx" ON "rfq_last_attachment_revisions" USING btree ("attachment_id","revision_no");--> statement-breakpoint
 CREATE VIEW "public"."pr_items_last_view" AS (select "rfq_pr_items"."id", "rfq_pr_items"."rfqs_last_id", "rfq_pr_items"."rfq_item", "rfq_pr_items"."pr_item", "rfq_pr_items"."pr_no", "rfq_pr_items"."material_code", "rfq_pr_items"."material_category", "rfq_pr_items"."acc", "rfq_pr_items"."material_description", "rfq_pr_items"."size", "rfq_pr_items"."delivery_date", "rfq_pr_items"."quantity", "rfq_pr_items"."uom", "rfq_pr_items"."gross_weight", "rfq_pr_items"."gw_uom", "rfq_pr_items"."spec_no", "rfq_pr_items"."spec_url", "rfq_pr_items"."tracking_no", "rfq_pr_items"."major_yn", "rfq_pr_items"."project_def", "rfq_pr_items"."project_sc", "rfq_pr_items"."project_kl", "rfq_pr_items"."project_lc", "rfq_pr_items"."project_dl", "rfq_pr_items"."remark", "rfqs_last"."rfq_code", "rfqs_last"."rfq_type", "rfqs_last"."rfq_title", "rfqs_last"."item_code", "rfqs_last"."item_name", "rfqs_last"."pr_number", "rfqs_last"."pr_issue_date", "rfqs_last"."series", "rfqs_last"."status", "rfqs_last"."project_company", "rfqs_last"."project_flag", "rfqs_last"."project_site", "rfqs_last"."sm_code", "rfqs_last"."package_no", "rfqs_last"."package_name", "projects"."code", "projects"."name" from "rfq_pr_items" left join "rfqs_last" on "rfq_pr_items"."rfqs_last_id" = "rfqs_last"."id" left join "projects" on "rfqs_last"."project_id" = "projects"."id");--> statement-breakpoint
 CREATE VIEW "public"."rfq_attachments_with_latest_revision" AS (
-- 
cgit v1.2.3

