Skip to content

Commit

Permalink
feat(deployment): creates deployment settings table
Browse files Browse the repository at this point in the history
refs #714
  • Loading branch information
ygrishajev committed Jan 28, 2025
1 parent 75915f5 commit b976288
Show file tree
Hide file tree
Showing 6 changed files with 418 additions and 1 deletion.
2 changes: 1 addition & 1 deletion apps/api/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { defineConfig } from "drizzle-kit";
import { config } from "./src/core/config";

export default defineConfig({
schema: ["./src/billing/model-schemas", "./src/user/model-schemas"],
schema: ["billing", "user", "deployment"].map(schema => `./src/${schema}/model-schemas`),
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
Expand Down
15 changes: 15 additions & 0 deletions apps/api/drizzle/0008_dapper_roulette.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CREATE TABLE IF NOT EXISTS "deployment_settings" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" uuid,
"dseq" varchar,
"auto_top_up_enabled" boolean DEFAULT false,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
CONSTRAINT "user_id_dseq_idx" UNIQUE("user_id","dseq")
);
--> statement-breakpoint
DO $$ BEGIN
ALTER TABLE "deployment_settings" ADD CONSTRAINT "deployment_settings_user_id_userSetting_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."userSetting"("id") ON DELETE cascade ON UPDATE no action;
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
Loading

0 comments on commit b976288

Please sign in to comment.