From 2650b7c0bb0ea12b68a58c0439f72d61df04b2f1 Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Fri, 25 Jul 2025 07:51:15 +0000
Subject: (대표님) 정기평가 대상, 미들웨어 수정, nextauth 토큰 처리 개선, GTC
 등 (최겸) 기술영업
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 db/migrations/0232_overrated_phil_sheldon.sql | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 db/migrations/0232_overrated_phil_sheldon.sql

(limited to 'db/migrations/0232_overrated_phil_sheldon.sql')

diff --git a/db/migrations/0232_overrated_phil_sheldon.sql b/db/migrations/0232_overrated_phil_sheldon.sql
new file mode 100644
index 00000000..13eb9cbe
--- /dev/null
+++ b/db/migrations/0232_overrated_phil_sheldon.sql
@@ -0,0 +1,25 @@
+CREATE TYPE "public"."gtc_type" AS ENUM('standard', 'project');--> statement-breakpoint
+CREATE TABLE "gtc_documents" (
+	"id" serial PRIMARY KEY NOT NULL,
+	"type" "gtc_type" NOT NULL,
+	"project_id" integer,
+	"revision" integer DEFAULT 0 NOT NULL,
+	"file_name" varchar(255),
+	"file_path" varchar(500),
+	"file_size" integer,
+	"created_at" timestamp with time zone DEFAULT now() NOT NULL,
+	"created_by_id" integer NOT NULL,
+	"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
+	"updated_by_id" integer,
+	"edit_reason" text,
+	"is_active" boolean DEFAULT true NOT NULL
+);
+--> statement-breakpoint
+ALTER TABLE "gtc_documents" ADD CONSTRAINT "gtc_documents_project_id_projects_id_fk" FOREIGN KEY ("project_id") REFERENCES "public"."projects"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "gtc_documents" ADD CONSTRAINT "gtc_documents_created_by_id_users_id_fk" FOREIGN KEY ("created_by_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "gtc_documents" ADD CONSTRAINT "gtc_documents_updated_by_id_users_id_fk" FOREIGN KEY ("updated_by_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action;--> statement-breakpoint
+CREATE UNIQUE INDEX "gtc_project_revision_idx" ON "gtc_documents" USING btree ("project_id","revision","type");--> statement-breakpoint
+CREATE INDEX "gtc_type_idx" ON "gtc_documents" USING btree ("type");--> statement-breakpoint
+CREATE INDEX "gtc_project_idx" ON "gtc_documents" USING btree ("project_id");--> statement-breakpoint
+CREATE INDEX "gtc_created_at_idx" ON "gtc_documents" USING btree ("created_at");--> statement-breakpoint
+CREATE INDEX "gtc_updated_at_idx" ON "gtc_documents" USING btree ("updated_at");
\ No newline at end of file
-- 
cgit v1.2.3

