aboutsummaryrefslogtreecommitdiffstats
path: root/db/prisma
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-02-08 15:14:23 +0000
committerMohamedBassem <me@mbassem.com>2024-02-08 15:15:21 +0000
commit80bb8a108f29331cdb2f2695f6801beee104dc89 (patch)
treeb1ae2a512963a9c916c4bfed71f7633f508de131 /db/prisma
parent333429adbaaa592cc96b480a5228f0e3f1de4cc2 (diff)
downloadkarakeep-80bb8a108f29331cdb2f2695f6801beee104dc89.tar.zst
[refactor] Move the different packages to the package subdir
Diffstat (limited to 'db/prisma')
-rw-r--r--db/prisma/migrations/20240205153748_add_users/migration.sql56
-rw-r--r--db/prisma/migrations/20240206000813_add_links/migration.sql43
-rw-r--r--db/prisma/migrations/20240206192241_add_favicon/migration.sql16
-rw-r--r--db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql21
-rw-r--r--db/prisma/migrations/migration_lock.toml3
-rw-r--r--db/prisma/schema.prisma105
6 files changed, 0 insertions, 244 deletions
diff --git a/db/prisma/migrations/20240205153748_add_users/migration.sql b/db/prisma/migrations/20240205153748_add_users/migration.sql
deleted file mode 100644
index cbf47073..00000000
--- a/db/prisma/migrations/20240205153748_add_users/migration.sql
+++ /dev/null
@@ -1,56 +0,0 @@
--- CreateTable
-CREATE TABLE "Account" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "userId" TEXT NOT NULL,
- "type" TEXT NOT NULL,
- "provider" TEXT NOT NULL,
- "providerAccountId" TEXT NOT NULL,
- "refresh_token" TEXT,
- "access_token" TEXT,
- "expires_at" INTEGER,
- "token_type" TEXT,
- "scope" TEXT,
- "id_token" TEXT,
- "session_state" TEXT,
- CONSTRAINT "Account_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateTable
-CREATE TABLE "Session" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "sessionToken" TEXT NOT NULL,
- "userId" TEXT NOT NULL,
- "expires" DATETIME NOT NULL,
- CONSTRAINT "Session_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateTable
-CREATE TABLE "User" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "name" TEXT,
- "email" TEXT,
- "emailVerified" DATETIME,
- "image" TEXT
-);
-
--- CreateTable
-CREATE TABLE "VerificationToken" (
- "identifier" TEXT NOT NULL,
- "token" TEXT NOT NULL,
- "expires" DATETIME NOT NULL
-);
-
--- CreateIndex
-CREATE UNIQUE INDEX "Account_provider_providerAccountId_key" ON "Account"("provider", "providerAccountId");
-
--- CreateIndex
-CREATE UNIQUE INDEX "Session_sessionToken_key" ON "Session"("sessionToken");
-
--- CreateIndex
-CREATE UNIQUE INDEX "User_email_key" ON "User"("email");
-
--- CreateIndex
-CREATE UNIQUE INDEX "VerificationToken_token_key" ON "VerificationToken"("token");
-
--- CreateIndex
-CREATE UNIQUE INDEX "VerificationToken_identifier_token_key" ON "VerificationToken"("identifier", "token");
diff --git a/db/prisma/migrations/20240206000813_add_links/migration.sql b/db/prisma/migrations/20240206000813_add_links/migration.sql
deleted file mode 100644
index 38c8d938..00000000
--- a/db/prisma/migrations/20240206000813_add_links/migration.sql
+++ /dev/null
@@ -1,43 +0,0 @@
--- CreateTable
-CREATE TABLE "BookmarkedLink" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "url" TEXT NOT NULL,
- "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "userId" TEXT NOT NULL,
- CONSTRAINT "BookmarkedLink_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateTable
-CREATE TABLE "BookmarkedLinkDetails" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "title" TEXT NOT NULL,
- "description" TEXT NOT NULL,
- "imageUrl" TEXT NOT NULL,
- "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- CONSTRAINT "BookmarkedLinkDetails_id_fkey" FOREIGN KEY ("id") REFERENCES "BookmarkedLink" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateTable
-CREATE TABLE "BookmarkTags" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "name" TEXT NOT NULL,
- "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "userId" TEXT NOT NULL,
- CONSTRAINT "BookmarkTags_userId_fkey" FOREIGN KEY ("userId") REFERENCES "User" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateTable
-CREATE TABLE "TagsOnLinks" (
- "linkId" TEXT NOT NULL,
- "tagId" TEXT NOT NULL,
- "attachedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "bookmarkTagsId" TEXT NOT NULL,
- CONSTRAINT "TagsOnLinks_linkId_fkey" FOREIGN KEY ("linkId") REFERENCES "BookmarkedLink" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT "TagsOnLinks_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "BookmarkTags" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-
--- CreateIndex
-CREATE UNIQUE INDEX "BookmarkTags_name_key" ON "BookmarkTags"("name");
-
--- CreateIndex
-CREATE UNIQUE INDEX "TagsOnLinks_linkId_tagId_key" ON "TagsOnLinks"("linkId", "tagId");
diff --git a/db/prisma/migrations/20240206192241_add_favicon/migration.sql b/db/prisma/migrations/20240206192241_add_favicon/migration.sql
deleted file mode 100644
index 330575e9..00000000
--- a/db/prisma/migrations/20240206192241_add_favicon/migration.sql
+++ /dev/null
@@ -1,16 +0,0 @@
--- RedefineTables
-PRAGMA foreign_keys=OFF;
-CREATE TABLE "new_BookmarkedLinkDetails" (
- "id" TEXT NOT NULL PRIMARY KEY,
- "title" TEXT,
- "description" TEXT,
- "imageUrl" TEXT,
- "favicon" TEXT,
- "createdAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- CONSTRAINT "BookmarkedLinkDetails_id_fkey" FOREIGN KEY ("id") REFERENCES "BookmarkedLink" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-INSERT INTO "new_BookmarkedLinkDetails" ("createdAt", "description", "id", "imageUrl", "title") SELECT "createdAt", "description", "id", "imageUrl", "title" FROM "BookmarkedLinkDetails";
-DROP TABLE "BookmarkedLinkDetails";
-ALTER TABLE "new_BookmarkedLinkDetails" RENAME TO "BookmarkedLinkDetails";
-PRAGMA foreign_key_check;
-PRAGMA foreign_keys=ON;
diff --git a/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql b/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql
deleted file mode 100644
index 78184041..00000000
--- a/db/prisma/migrations/20240207204211_drop_extra_field_in_tags_links/migration.sql
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- Warnings:
-
- - You are about to drop the column `bookmarkTagsId` on the `TagsOnLinks` table. All the data in the column will be lost.
-
-*/
--- RedefineTables
-PRAGMA foreign_keys=OFF;
-CREATE TABLE "new_TagsOnLinks" (
- "linkId" TEXT NOT NULL,
- "tagId" TEXT NOT NULL,
- "attachedAt" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
- CONSTRAINT "TagsOnLinks_linkId_fkey" FOREIGN KEY ("linkId") REFERENCES "BookmarkedLink" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT "TagsOnLinks_tagId_fkey" FOREIGN KEY ("tagId") REFERENCES "BookmarkTags" ("id") ON DELETE CASCADE ON UPDATE CASCADE
-);
-INSERT INTO "new_TagsOnLinks" ("attachedAt", "linkId", "tagId") SELECT "attachedAt", "linkId", "tagId" FROM "TagsOnLinks";
-DROP TABLE "TagsOnLinks";
-ALTER TABLE "new_TagsOnLinks" RENAME TO "TagsOnLinks";
-CREATE UNIQUE INDEX "TagsOnLinks_linkId_tagId_key" ON "TagsOnLinks"("linkId", "tagId");
-PRAGMA foreign_key_check;
-PRAGMA foreign_keys=ON;
diff --git a/db/prisma/migrations/migration_lock.toml b/db/prisma/migrations/migration_lock.toml
deleted file mode 100644
index e5e5c470..00000000
--- a/db/prisma/migrations/migration_lock.toml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Please do not edit this file manually
-# It should be added in your version-control system (i.e. Git)
-provider = "sqlite" \ No newline at end of file
diff --git a/db/prisma/schema.prisma b/db/prisma/schema.prisma
deleted file mode 100644
index 0e6d080c..00000000
--- a/db/prisma/schema.prisma
+++ /dev/null
@@ -1,105 +0,0 @@
-// This is your Prisma schema file,
-// learn more about it in the docs: https://pris.ly/d/prisma-schema
-
-generator client {
- provider = "prisma-client-js"
-}
-
-datasource db {
- provider = "sqlite"
- url = env("DATABASE_URL")
-}
-
-model Account {
- id String @id @default(cuid())
- userId String
- type String
- provider String
- providerAccountId String
- refresh_token String?
- access_token String?
- expires_at Int?
- token_type String?
- scope String?
- id_token String?
- session_state String?
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-
- @@unique([provider, providerAccountId])
-}
-
-model Session {
- id String @id @default(cuid())
- sessionToken String @unique
- userId String
- expires DateTime
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
-}
-
-model User {
- id String @id @default(cuid())
- name String?
- email String? @unique
- emailVerified DateTime?
- image String?
- accounts Account[]
- sessions Session[]
- links BookmarkedLink[]
- tags BookmarkTags[]
-}
-
-model VerificationToken {
- identifier String
- token String @unique
- expires DateTime
-
- @@unique([identifier, token])
-}
-
-model BookmarkedLink {
- id String @id @default(cuid())
- url String
- createdAt DateTime @default(now())
-
- userId String
-
- details BookmarkedLinkDetails?
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- tags TagsOnLinks[]
-}
-
-model BookmarkedLinkDetails {
- id String @id
- title String?
- description String?
- imageUrl String?
- favicon String?
- createdAt DateTime @default(now())
-
- link BookmarkedLink @relation(fields: [id], references: [id], onDelete: Cascade)
-}
-
-model BookmarkTags {
- id String @id @default(cuid())
- name String @unique
- createdAt DateTime @default(now())
-
- userId String
-
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
- attachedLinks TagsOnLinks[]
-}
-
-model TagsOnLinks {
- link BookmarkedLink @relation(fields: [linkId], references: [id], onDelete: Cascade)
- linkId String
-
- tag BookmarkTags @relation(fields: [tagId], references: [id], onDelete: Cascade)
- tagId String
-
- attachedAt DateTime @default(now())
-
- @@unique([linkId, tagId])
-}