summaryrefslogtreecommitdiff
path: root/db/migrations/0215_secret_old_lace.sql
diff options
context:
space:
mode:
authordujinkim <dujin.kim@dtsolution.co.kr>2025-07-21 07:19:52 +0000
committerdujinkim <dujin.kim@dtsolution.co.kr>2025-07-21 07:19:52 +0000
commit9da494b0e3bbe7b513521d0915510fe9ee376b8b (patch)
treef936f69626bf2808ac409ce7cad97433465b3672 /db/migrations/0215_secret_old_lace.sql
parente275618ff8a1ce6977d3e2567d943edb941897f9 (diff)
(대표님, 최겸) 작업사항 - 이메일 템플릿, 메일링, 기술영업 요구사항 반영
Diffstat (limited to 'db/migrations/0215_secret_old_lace.sql')
-rw-r--r--db/migrations/0215_secret_old_lace.sql42
1 files changed, 42 insertions, 0 deletions
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