Skip to content

Commit 57f3381

Browse files
N-FIN-79: migrate database dropping lucia tables
1 parent ba71cbe commit 57f3381

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
Warnings:
3+
4+
- You are about to drop the `lucia_session` table. If the table is not empty, all the data it contains will be lost.
5+
- You are about to drop the `lucia_user` table. If the table is not empty, all the data it contains will be lost.
6+
7+
*/
8+
-- DropForeignKey
9+
ALTER TABLE "categories"
10+
DROP CONSTRAINT "categories_user_id_fkey";
11+
12+
-- DropForeignKey
13+
ALTER TABLE "entities"
14+
DROP CONSTRAINT "entities_user_id_fkey";
15+
16+
-- DropForeignKey
17+
ALTER TABLE "lucia_session"
18+
DROP CONSTRAINT "lucia_session_userId_fkey";
19+
20+
-- DropForeignKey
21+
ALTER TABLE "payments"
22+
DROP CONSTRAINT "payments_user_id_fkey";
23+
24+
-- DropTable
25+
DROP TABLE "lucia_session";
26+
27+
-- DropTable
28+
DROP TABLE "lucia_user";

prisma/schema.prisma

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,9 @@ datasource db {
77
url = env("DATABASE_URL")
88
}
99

10-
model User {
11-
// lucia internal fields
12-
id String @id
13-
sessions Session[]
14-
15-
// custom fields
16-
username String @unique
17-
password String
18-
19-
entities Entity[]
20-
payments Payment[]
21-
categories Category[]
22-
23-
@@map("lucia_user")
24-
}
25-
26-
model Session {
27-
// lucia internal fields
28-
id String @id
29-
userId String
30-
expiresAt DateTime
31-
user User @relation(references: [id], fields: [userId], onDelete: Cascade)
32-
33-
@@map("lucia_session")
34-
}
35-
3610
model Entity {
3711
id Int @id @default(autoincrement())
3812
userId String @map("user_id")
39-
user User @relation(fields: [userId], references: [id])
4013
name String
4114
type EntityType
4215
defaultCategory Category? @relation(fields: [defaultCategoryId], references: [id])
@@ -59,7 +32,6 @@ enum EntityType {
5932
model Payment {
6033
id Int @id @default(autoincrement())
6134
userId String @map("user_id")
62-
user User @relation(fields: [userId], references: [id])
6335
amount Int
6436
currency String @default("EUR")
6537
date DateTime @default(now())
@@ -79,7 +51,6 @@ model Payment {
7951
model Category {
8052
id Int @id @default(autoincrement())
8153
userId String @map("user_id")
82-
user User @relation(fields: [userId], references: [id])
8354
name String
8455
color String
8556
createdAt DateTime @default(now()) @map("created_at")

0 commit comments

Comments
 (0)