diff --git a/.gitignore b/.gitignore index efaa0a6..e204e9c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ /dist /node_modules /.next -**/migrations/ # Logs logs diff --git a/prisma/migrations/20230211152053_init/migration.sql b/prisma/migrations/20230211152053_init/migration.sql new file mode 100644 index 0000000..22d9117 --- /dev/null +++ b/prisma/migrations/20230211152053_init/migration.sql @@ -0,0 +1,25 @@ +-- CreateTable +CREATE TABLE "User" ( + "id" SERIAL NOT NULL, + "email" TEXT NOT NULL, + "name" TEXT, + + CONSTRAINT "User_pkey" PRIMARY KEY ("id") +); + +-- CreateTable +CREATE TABLE "Post" ( + "id" SERIAL NOT NULL, + "title" TEXT NOT NULL, + "content" TEXT, + "published" BOOLEAN NOT NULL DEFAULT false, + "authorId" INTEGER NOT NULL, + + CONSTRAINT "Post_pkey" PRIMARY KEY ("id") +); + +-- CreateIndex +CREATE UNIQUE INDEX "User_email_key" ON "User"("email"); + +-- AddForeignKey +ALTER TABLE "Post" ADD CONSTRAINT "Post_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "User"("id") ON DELETE RESTRICT ON UPDATE CASCADE; diff --git a/prisma/migrations/20230211162927_init/migration.sql b/prisma/migrations/20230211162927_init/migration.sql new file mode 100644 index 0000000..7fdee47 --- /dev/null +++ b/prisma/migrations/20230211162927_init/migration.sql @@ -0,0 +1,12 @@ +/* + Warnings: + + - Added the required column `password` to the `User` table without a default value. This is not possible if the table is not empty. + +*/ +-- AlterTable +ALTER TABLE "Post" ADD COLUMN "createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, +ADD COLUMN "tags" TEXT[]; + +-- AlterTable +ALTER TABLE "User" ADD COLUMN "password" TEXT NOT NULL; 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