diff --git a/.gitignore b/.gitignore index 834903d..cbf6a49 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,5 @@ Thumbs.db vite.config.js.timestamp-* vite.config.ts.timestamp-* -*storybook.log - -# Prisma -dev.db \ No newline at end of file +*/dev.db +*/dev.db-journal \ No newline at end of file diff --git a/prisma/dev.db b/prisma/dev.db deleted file mode 100644 index 86ecbef..0000000 Binary files a/prisma/dev.db and /dev/null differ diff --git a/prisma/migrations/20241215222709_removed_issue/migration.sql b/prisma/migrations/20241215222709_removed_issue/migration.sql deleted file mode 100644 index 1aada7c..0000000 --- a/prisma/migrations/20241215222709_removed_issue/migration.sql +++ /dev/null @@ -1,24 +0,0 @@ -/* - Warnings: - - - The primary key for the `Post` table will be changed. If it partially fails, the table could be left without primary key constraint. - -*/ --- RedefineTables -PRAGMA defer_foreign_keys=ON; -PRAGMA foreign_keys=OFF; -CREATE TABLE "new_Post" ( - "id" TEXT NOT NULL PRIMARY KEY, - "title" TEXT NOT NULL, - "content" TEXT NOT NULL, - "published" BOOLEAN DEFAULT false, - "authorId" TEXT NOT NULL, - "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, - CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE -); -INSERT INTO "new_Post" ("authorId", "content", "createdAt", "id", "published", "title", "updatedAt") SELECT "authorId", "content", "createdAt", "id", "published", "title", "updatedAt" FROM "Post"; -DROP TABLE "Post"; -ALTER TABLE "new_Post" RENAME TO "Post"; -PRAGMA foreign_keys=ON; -PRAGMA defer_foreign_keys=OFF; diff --git a/prisma/migrations/20241220011159_init/migration.sql b/prisma/migrations/20241220011159_init/migration.sql new file mode 100644 index 0000000..bbed9b9 --- /dev/null +++ b/prisma/migrations/20241220011159_init/migration.sql @@ -0,0 +1,34 @@ +-- CreateTable +CREATE TABLE "User" ( + "id" TEXT NOT NULL PRIMARY KEY, + "email" TEXT, + "name" TEXT NOT NULL, + "password" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP +); + +-- CreateTable +CREATE TABLE "Session" ( + "id" TEXT NOT NULL PRIMARY KEY, + "expiresAt" DATETIME NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "userId" TEXT NOT NULL, + CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); + +-- CreateTable +CREATE TABLE "Post" ( + "id" TEXT NOT NULL PRIMARY KEY, + "title" TEXT NOT NULL, + "content" TEXT NOT NULL, + "published" BOOLEAN DEFAULT false, + "authorId" TEXT NOT NULL, + "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updatedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, + CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User" ("id") ON DELETE RESTRICT ON UPDATE CASCADE +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email");