Add baseline migration and fix prisma deploy
All checks were successful
Build Docker Image / build (push) Successful in 3m44s

This commit is contained in:
Ruslan Bakiev
2026-03-09 10:20:31 +07:00
parent 47f0921a55
commit 37a2d31ea7
2 changed files with 49 additions and 1 deletions

View File

@@ -28,4 +28,4 @@ ENV INFISICAL_SECRET_PATHS="/billing,/shared"
EXPOSE 8000
CMD ["sh", "-c", "node scripts/load-secrets.mjs && . ./.env.infisical && npx prisma migrate deploy && node dist/index.js"]
CMD ["sh", "-c", "node scripts/load-secrets.mjs && . ./.env.infisical && npx prisma migrate resolve --applied 0_init 2>/dev/null; npx prisma migrate deploy && node dist/index.js"]

View File

@@ -0,0 +1,48 @@
-- CreateSchema
CREATE SCHEMA IF NOT EXISTS "public";
-- CreateEnum
CREATE TYPE "AccountType" AS ENUM ('USER', 'SERVICE');
-- CreateTable
CREATE TABLE "billing_app_account" (
"uuid" UUID NOT NULL,
"name" VARCHAR(255) NOT NULL,
"account_type" "AccountType" NOT NULL DEFAULT 'USER',
"description" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "billing_app_account_pkey" PRIMARY KEY ("uuid")
);
-- CreateTable
CREATE TABLE "billing_app_operationcode" (
"id" SERIAL NOT NULL,
"code" INTEGER NOT NULL,
"name" VARCHAR(255) NOT NULL,
"description" TEXT,
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "billing_app_operationcode_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "billing_app_serviceaccount" (
"account_id" UUID NOT NULL,
"slug" VARCHAR(50) NOT NULL,
CONSTRAINT "billing_app_serviceaccount_pkey" PRIMARY KEY ("account_id")
);
-- CreateIndex
CREATE UNIQUE INDEX "billing_app_operationcode_code_key" ON "billing_app_operationcode"("code");
-- CreateIndex
CREATE UNIQUE INDEX "billing_app_operationcode_name_key" ON "billing_app_operationcode"("name");
-- CreateIndex
CREATE UNIQUE INDEX "billing_app_serviceaccount_slug_key" ON "billing_app_serviceaccount"("slug");
-- AddForeignKey
ALTER TABLE "billing_app_serviceaccount" ADD CONSTRAINT "billing_app_serviceaccount_account_id_fkey" FOREIGN KEY ("account_id") REFERENCES "billing_app_account"("uuid") ON DELETE CASCADE ON UPDATE CASCADE;