Skip to content

Commit

Permalink
feat(database): add a column in the snippet table
Browse files Browse the repository at this point in the history
  • Loading branch information
tericcabrel committed Aug 13, 2022
1 parent 91872ac commit 05955d8
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 46 deletions.
4 changes: 2 additions & 2 deletions packages/database/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
"db:seed": "prisma db seed"
},
"dependencies": {
"@prisma/client": "^4.0.0",
"@prisma/client": "^4.1.1",
"cuid": "^2.1.8"
},
"devDependencies": {
"@types/jest": "^28.1.4",
"dotenv": "^16.0.1",
"jest": "^28.1.2",
"prisma": "^4.0.0",
"prisma": "^4.1.1",
"ts-jest": "^28.0.5",
"typescript": "^4.7.4"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE `snippets` ADD COLUMN `line_highlight` TEXT NULL;
27 changes: 14 additions & 13 deletions packages/database/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,20 @@ model Folder {
}

model Snippet {
id String @id @db.VarChar(50)
userId String @map("user_id") @db.VarChar(50)
folderId String @map("folder_id")
name String @db.VarChar(255)
content String @db.Text
language String @db.VarChar(20)
size Int @default(0) @db.Int
visibility SnippetVisibility @default(public)
description String? @db.Text
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
id String @id @db.VarChar(50)
userId String @map("user_id") @db.VarChar(50)
folderId String @map("folder_id")
name String @db.VarChar(255)
content String @db.Text
language String @db.VarChar(20)
size Int @default(0) @db.Int
visibility SnippetVisibility @default(public)
description String? @db.Text
lineHighlight String? @db.Text @map("line_highlight")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
@@index([name])
@@index([userId])
Expand Down
27 changes: 14 additions & 13 deletions packages/database/prisma/schema.test.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,20 @@ model Folder {
}

model Snippet {
id String @id @db.VarChar(50)
userId String @map("user_id") @db.VarChar(50)
folderId String @map("folder_id")
name String @db.VarChar(255)
content String @db.Text
language String @db.VarChar(20)
size Int @default(0) @db.Int
visibility SnippetVisibility @default(public)
description String? @db.Text
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
id String @id @db.VarChar(50)
userId String @map("user_id") @db.VarChar(50)
folderId String @map("folder_id")
name String @db.VarChar(255)
content String @db.Text
language String @db.VarChar(20)
size Int @default(0) @db.Int
visibility SnippetVisibility @default(public)
description String? @db.Text
lineHighlight String? @db.Text @map("line_highlight")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
user User @relation(fields: [userId], references: [id], onDelete: Restrict)
folder Folder @relation(fields: [folderId], references: [id], onDelete: Cascade)
@@index([name])
@@index([userId])
Expand Down
36 changes: 18 additions & 18 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2138,22 +2138,22 @@
tiny-glob "^0.2.9"
tslib "^2.4.0"

"@prisma/client@^4.0.0":
version "4.0.0"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.0.0.tgz#ed2f46930a1da0d8ae88d7965485973576b04270"
integrity sha512-g1h2OGoRo7anBVQ9Cw3gsbjwPtvf7i0pkGxKeZICtwkvE5CZXW+xZF4FZdmrViYkKaAShbISL0teNpu9ecpf4g==
"@prisma/client@^4.1.1":
version "4.1.1"
resolved "https://registry.yarnpkg.com/@prisma/client/-/client-4.1.1.tgz#dcb1118397deb8247fbe39a1f3eee5606648adf8"
integrity sha512-2pXuIUYxHv5H9o6QTa1VIsl4yMgsAjKQOitlo8WVTB+vo73rmMJITBPavdGUZSWUc7adMkFzEV3y5rVTUQr77Q==
dependencies:
"@prisma/engines-version" "3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11"
"@prisma/engines-version" "4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8"

"@prisma/engines-version@3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11":
version "3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11.tgz#4b5efe5eee2feef12910e4627a572cd96ed83236"
integrity sha512-PiZhdD624SrYEjyLboI0X7OugNbxUzDJx9v/6ldTKuqNDVUCmRH/Z00XwDi/dgM4FlqOSO+YiUsSiSKjxxG8cw==
"@prisma/engines-version@4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8":
version "4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8"
resolved "https://registry.yarnpkg.com/@prisma/engines-version/-/engines-version-4.1.0-48.8d8414deb360336e4698a65aa45a1fbaf1ce13d8.tgz#ce00e6377126e491a8b1e0e2039c97e2924bd6d9"
integrity sha512-cRRJwpHFGFJZvtHbY3GZjMffNBEjjZk68ztn+S2hDgPCGB4H66IK26roK94GJxBodSehwRJ0wGyebC2GoIH1JQ==

"@prisma/engines@3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11":
version "3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11.tgz#82f0018153cffa05d61422f9c0c7b0479b180f75"
integrity sha512-u/rG4lDHALolWBLr3yebZ+N2qImp3SDMcu7bHNJuRDaYvYEXy/MqfNRNEgd9GoPsXL3gofYf0VzJf2AmCG3YVw==
"@prisma/engines@4.1.1":
version "4.1.1"
resolved "https://registry.yarnpkg.com/@prisma/engines/-/engines-4.1.1.tgz#a6a75870618bbd19ff734c51af7dbe9f362c3265"
integrity sha512-DCw8L/SS0IXqmj5IW/fMxOXiifnsfjBzDfRhf0j3NFWqvMCh9OtfjmXQZxVgI2mwvJLc/5jzXhkiWT39qS09dA==

"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2"
Expand Down Expand Up @@ -8415,12 +8415,12 @@ pretty-format@^28.0.0, pretty-format@^28.1.1:
ansi-styles "^5.0.0"
react-is "^18.0.0"

prisma@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.0.0.tgz#4ddb8fcd4f64d33aff8c198a6986dcce66dc8152"
integrity sha512-Dtsar03XpCBkcEb2ooGWO/WcgblDTLzGhPcustbehwlFXuTMliMDRzXsfygsgYwQoZnAUKRd1rhpvBNEUziOVw==
prisma@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/prisma/-/prisma-4.1.1.tgz#41c2e19896357f484ef21567165d762908376fca"
integrity sha512-yw50J8If2dKP4wYIi695zthsCASQFHiogGvUHHWd3falx/rpsD6Sb1LMLRV9nO3iGG3lozxNJ2PSINxK7xwdpg==
dependencies:
"@prisma/engines" "3.16.0-49.da41d2bb3406da22087b849f0e911199ba4fbf11"
"@prisma/engines" "4.1.1"

process-nextick-args@~2.0.0:
version "2.0.1"
Expand Down

0 comments on commit 05955d8

Please sign in to comment.