From 61fbdd4cb6be3f6306f55c91e272702797514800 Mon Sep 17 00:00:00 2001 From: Thomas <4159106+dtslvr@users.noreply.github.com> Date: Sun, 23 Jul 2023 12:43:54 +0200 Subject: [PATCH] Add schema migration --- .../migration.sql | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 prisma/migrations/20230723104112_added_account_balances_to_account/migration.sql diff --git a/prisma/migrations/20230723104112_added_account_balances_to_account/migration.sql b/prisma/migrations/20230723104112_added_account_balances_to_account/migration.sql new file mode 100644 index 000000000..5afdeb4b5 --- /dev/null +++ b/prisma/migrations/20230723104112_added_account_balances_to_account/migration.sql @@ -0,0 +1,15 @@ +-- CreateTable +CREATE TABLE "AccountBalance" ( + "accountId" TEXT NOT NULL, + "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "date" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "id" TEXT NOT NULL, + "updatedAt" TIMESTAMP(3) NOT NULL, + "userId" TEXT NOT NULL, + "value" DOUBLE PRECISION NOT NULL, + + CONSTRAINT "AccountBalance_pkey" PRIMARY KEY ("id") +); + +-- AddForeignKey +ALTER TABLE "AccountBalance" ADD CONSTRAINT "AccountBalance_accountId_userId_fkey" FOREIGN KEY ("accountId", "userId") REFERENCES "Account"("id", "userId") ON DELETE CASCADE ON UPDATE CASCADE;