🗃️ db: update schema for new collection
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to alter the column `name` on the `collections` table. The data in that column could be lost. The data in that column will be cast from `VarChar(255)` to `VarChar(115)`.
|
||||
- A unique constraint covering the columns `[slug,ownerId]` on the table `collections` will be added. If there are existing duplicate values, this will fail.
|
||||
- Added the required column `slug` to the `collections` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "collections" ADD COLUMN "slug" VARCHAR(115) NOT NULL,
|
||||
ALTER COLUMN "name" SET DATA TYPE VARCHAR(115);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "collections_slug_ownerId_key" ON "collections"("slug", "ownerId");
|
||||
@ -418,7 +418,8 @@ model UserLog {
|
||||
|
||||
model Collection {
|
||||
id String @id @db.Uuid
|
||||
name String @db.VarChar(255)
|
||||
name String @db.VarChar(115)
|
||||
slug String @db.VarChar(115)
|
||||
medias Media[] @relation("MediaCollections")
|
||||
owner User @relation("UserCollections", fields: [ownerId], references: [id])
|
||||
ownerId String @db.Uuid
|
||||
@ -429,6 +430,8 @@ model Collection {
|
||||
deletedAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
|
||||
@@unique([slug, ownerId])
|
||||
@@map("collections")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user