From 9da494b0e3bbe7b513521d0915510fe9ee376b8b Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 21 Jul 2025 07:19:52 +0000
Subject: (대표님, 최겸) 작업사항 - 이메일 템플릿, 메일링, 기술영업 요구사항
 반영
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 db/migrations/0215_secret_old_lace.sql | 42 ++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 db/migrations/0215_secret_old_lace.sql

(limited to 'db/migrations/0215_secret_old_lace.sql')

diff --git a/db/migrations/0215_secret_old_lace.sql b/db/migrations/0215_secret_old_lace.sql
new file mode 100644
index 00000000..1069ab62
--- /dev/null
+++ b/db/migrations/0215_secret_old_lace.sql
@@ -0,0 +1,42 @@
+CREATE TABLE "template_history" (
+	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+	"template_id" uuid NOT NULL,
+	"version" integer NOT NULL,
+	"content" text NOT NULL,
+	"change_description" text,
+	"changed_by" uuid NOT NULL,
+	"created_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "template_variables" (
+	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+	"template_id" uuid NOT NULL,
+	"variable_name" text NOT NULL,
+	"variable_type" text NOT NULL,
+	"default_value" text,
+	"is_required" boolean DEFAULT false,
+	"description" text,
+	"validation_rule" jsonb,
+	"display_order" integer DEFAULT 0,
+	"created_at" timestamp DEFAULT now() NOT NULL,
+	"updated_at" timestamp DEFAULT now() NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE "templates" (
+	"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
+	"name" text NOT NULL,
+	"slug" text NOT NULL,
+	"content" text NOT NULL,
+	"description" text,
+	"category" text,
+	"sample_data" jsonb DEFAULT '{}'::jsonb,
+	"is_active" boolean DEFAULT true,
+	"version" integer DEFAULT 1,
+	"created_by" uuid NOT NULL,
+	"created_at" timestamp DEFAULT now() NOT NULL,
+	"updated_at" timestamp DEFAULT now() NOT NULL,
+	CONSTRAINT "templates_slug_unique" UNIQUE("slug")
+);
+--> statement-breakpoint
+ALTER TABLE "template_history" ADD CONSTRAINT "template_history_template_id_templates_id_fk" FOREIGN KEY ("template_id") REFERENCES "public"."templates"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
+ALTER TABLE "template_variables" ADD CONSTRAINT "template_variables_template_id_templates_id_fk" FOREIGN KEY ("template_id") REFERENCES "public"."templates"("id") ON DELETE cascade ON UPDATE no action;
\ No newline at end of file
-- 
cgit v1.2.3

