Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deployment): creates deployment settings table #738

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
17 changes: 17 additions & 0 deletions apps/api/drizzle/0008_amused_magdalene.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS "deployment_settings" (
"id" serial PRIMARY KEY NOT NULL,
"user_id" uuid NOT NULL,
"dseq" varchar NOT NULL,
"address" varchar NOT NULL,
"auto_top_up_enabled" boolean DEFAULT false NOT NULL,
"predicted_closed_height" bigint NOT NULL,
"created_at" timestamp DEFAULT now(),
"updated_at" timestamp DEFAULT now(),
CONSTRAINT "dseq_address_idx" UNIQUE("dseq","address")
);
--> 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
Loading