Add baseline migration and fix prisma deploy
All checks were successful
Build Docker Image / build (push) Successful in 3m44s
All checks were successful
Build Docker Image / build (push) Successful in 3m44s
This commit is contained in:
@@ -28,4 +28,4 @@ ENV INFISICAL_SECRET_PATHS="/billing,/shared"
|
|||||||
|
|
||||||
EXPOSE 8000
|
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"]
|
||||||
|
|||||||
48
prisma/migrations/0_init/migration.sql
Normal file
48
prisma/migrations/0_init/migration.sql
Normal 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;
|
||||||
|
|
||||||
Reference in New Issue
Block a user