diff --git a/prisma/migrations/20240408163644_neon_migration/migration.sql b/prisma/migrations/20240408163644_neon_migration/migration.sql new file mode 100644 index 0000000..c3d4555 --- /dev/null +++ b/prisma/migrations/20240408163644_neon_migration/migration.sql @@ -0,0 +1,60 @@ +-- CreateEnum +CREATE TYPE "ReminderType" AS ENUM ('DAILY', 'WEEKLY'); + +-- CreateTable +CREATE TABLE "users" ( + "id" TEXT NOT NULL, + "name" TEXT, + "email" TEXT, + "clerkId" TEXT NOT NULL, + "image" TEXT, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + "stripe_customer_id" TEXT, + "stripe_subscription_id" TEXT, + "stripe_price_id" TEXT, + "stripe_current_period_end" TIMESTAMP(3), + + CONSTRAINT "users_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "journal_entries" ( + "id" TEXT NOT NULL, + "title" TEXT NOT NULL, + "content" JSONB, + "created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updated_at" TIMESTAMP(3) NOT NULL, + "userId" TEXT NOT NULL, + + CONSTRAINT "journal_entries_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "reminders" ( + "id" TEXT NOT NULL, + "frequency" "ReminderType" DEFAULT 'DAILY', + "time" TIME(0) DEFAULT '09:00:00', + "active" BOOLEAN DEFAULT false, + "userId" TEXT NOT NULL, + + CONSTRAINT "reminders_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "users_email_key" ON "users"("email"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_clerkId_key" ON "users"("clerkId"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_stripe_customer_id_key" ON "users"("stripe_customer_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "users_stripe_subscription_id_key" ON "users"("stripe_subscription_id"); + +-- CreateIndex +CREATE UNIQUE INDEX "journal_entries_userId_id_key" ON "journal_entries"("userId", "id"); + +-- CreateIndex +CREATE UNIQUE INDEX "reminders_userId_key" ON "reminders"("userId"); diff --git a/prisma/migrations/migration_lock.toml b/prisma/migrations/migration_lock.toml new file mode 100644 index 0000000..fbffa92 --- /dev/null +++ b/prisma/migrations/migration_lock.toml @@ -0,0 +1,3 @@ +# Please do not edit this file manually +# It should be added in your version-control system (i.e. Git) +provider = "postgresql" \ No newline at end of file diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 84ab015..34884c0 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -2,11 +2,12 @@ // learn more about it in the docs: https://pris.ly/d/prisma-schema generator client { - provider = "prisma-client-js" + provider = "prisma-client-js" + previewFeatures = ["fullTextSearch", "fullTextIndex", "driverAdapters"] } datasource db { - provider = "mysql" + provider = "postgresql" url = env("DATABASE_URL") relationMode = "prisma" }