From 9ceed79cf32c896f8a998399bf1b296506b2cd4a Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Tue, 8 Apr 2025 03:08:19 +0000
Subject: 로그인 및 미들웨어 처리. 구조 변경
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 db/migrations_backup/0075_tough_epoch.sql | 46 +++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 db/migrations_backup/0075_tough_epoch.sql

(limited to 'db/migrations_backup/0075_tough_epoch.sql')

diff --git a/db/migrations_backup/0075_tough_epoch.sql b/db/migrations_backup/0075_tough_epoch.sql
new file mode 100644
index 00000000..0428f864
--- /dev/null
+++ b/db/migrations_backup/0075_tough_epoch.sql
@@ -0,0 +1,46 @@
+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
-- 
cgit v1.2.3

