mirror of
https://github.com/t3xhno/nestjs-auth.git
synced 2024-11-22 18:33:41 +00:00
45 lines
1.2 KiB
SQL
45 lines
1.2 KiB
SQL
/*
|
|
Warnings:
|
|
|
|
- You are about to drop the `Bookmark` table. If the table is not empty, all the data it contains will be lost.
|
|
- You are about to drop the `User` table. If the table is not empty, all the data it contains will be lost.
|
|
|
|
*/
|
|
-- DropTable
|
|
DROP TABLE "Bookmark";
|
|
|
|
-- DropTable
|
|
DROP TABLE "User";
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "users" (
|
|
"id" SERIAL NOT NULL,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
"email" TEXT NOT NULL,
|
|
"hash" TEXT NOT NULL,
|
|
"firstName" TEXT,
|
|
"lastName" TEXT,
|
|
|
|
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateTable
|
|
CREATE TABLE "bookmarks" (
|
|
"id" SERIAL NOT NULL,
|
|
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
"updatedAt" TIMESTAMP(3) NOT NULL,
|
|
"title" TEXT NOT NULL,
|
|
"description" TEXT,
|
|
"link" TEXT NOT NULL,
|
|
"userId" INTEGER NOT NULL,
|
|
|
|
CONSTRAINT "bookmarks_pkey" PRIMARY KEY ("id")
|
|
);
|
|
|
|
-- CreateIndex
|
|
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
|
|
|
-- AddForeignKey
|
|
ALTER TABLE "bookmarks" ADD CONSTRAINT "bookmarks_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|