Added UserID on Tag

This commit is contained in:
Florian Sylvain
2023-01-30 10:47:01 +01:00
parent 34c5aa0e37
commit 44b842d66c
4 changed files with 33 additions and 18 deletions
@@ -0,0 +1,11 @@
/*
Warnings:
- Added the required column `user_id` to the `Tag` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `Tag` ADD COLUMN `user_id` INTEGER NOT NULL;
-- AddForeignKey
ALTER TABLE `Tag` ADD CONSTRAINT `Tag_user_id_fkey` FOREIGN KEY (`user_id`) REFERENCES `User`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
+3
View File
@@ -17,6 +17,7 @@ model User {
updated_at DateTime @updatedAt
Snippet Snippet[]
Category Category[]
Tag Tag[]
}
model Snippet {
@@ -61,5 +62,7 @@ model Snippet_tag {
model Tag {
id Int @id @default(autoincrement())
name String
user_id Int
user User @relation(fields: [user_id], references: [id])
Snippet_tag Snippet_tag[]
}