From 9ceed79cf32c896f8a998399bf1b296506b2cd4a Mon Sep 17 00:00:00 2001 From: dujinkim 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/0023_familiar_raza.sql | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 db/migrations_backup/0023_familiar_raza.sql (limited to 'db/migrations_backup/0023_familiar_raza.sql') diff --git a/db/migrations_backup/0023_familiar_raza.sql b/db/migrations_backup/0023_familiar_raza.sql new file mode 100644 index 00000000..1345d0bb --- /dev/null +++ b/db/migrations_backup/0023_familiar_raza.sql @@ -0,0 +1,56 @@ +CREATE TABLE "projects" ( + "id" serial PRIMARY KEY NOT NULL, + "code" varchar(50) NOT NULL, + "name" text NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +CREATE TABLE "contract_items" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contract_items_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_id" integer NOT NULL, + "item_id" integer NOT NULL, + "quantity" integer DEFAULT 1 NOT NULL, + "price" numeric(10, 2), + "remark" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "contract_items_item_id_unique" UNIQUE("item_id") +); +--> statement-breakpoint +CREATE TABLE "contracts" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "contracts_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "vendor_id" integer NOT NULL, + "contract_no" varchar(100) NOT NULL, + "status" varchar(50) DEFAULT 'ACTIVE' NOT NULL, + "start_date" date, + "end_date" date, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "contracts_contract_no_unique" UNIQUE("contract_no") +); +--> statement-breakpoint +CREATE TABLE "forms" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "forms_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "form_code" varchar(100) NOT NULL, + "form_name" varchar(255) NOT NULL, + "tag_type" varchar(50) NOT NULL, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL, + CONSTRAINT "forms_form_code_unique" UNIQUE("form_code") +); +--> statement-breakpoint +CREATE TABLE "tags" ( + "id" integer PRIMARY KEY GENERATED ALWAYS AS IDENTITY (sequence name "tags_id_seq" INCREMENT BY 1 MINVALUE 1 MAXVALUE 2147483647 START WITH 1 CACHE 1), + "contract_item_id" integer NOT NULL, + "tag_no" varchar(100) NOT NULL, + "tag_type" varchar(50) NOT NULL, + "description" text, + "created_at" timestamp DEFAULT now() NOT NULL, + "updated_at" timestamp DEFAULT now() NOT NULL +); +--> statement-breakpoint +ALTER TABLE "contract_items" ADD CONSTRAINT "contract_items_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_items" ADD CONSTRAINT "contract_items_item_id_items_id_fk" FOREIGN KEY ("item_id") REFERENCES "public"."items"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "contracts" ADD CONSTRAINT "contracts_vendor_id_vendors_id_fk" FOREIGN KEY ("vendor_id") REFERENCES "public"."vendors"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint +ALTER TABLE "tags" ADD CONSTRAINT "tags_contract_item_id_contract_items_id_fk" FOREIGN KEY ("contract_item_id") REFERENCES "public"."contract_items"("id") ON DELETE cascade ON UPDATE no action; \ No newline at end of file -- cgit v1.2.3