🚧 wip: update media bulk insert for new schema

This commit is contained in:
2026-05-30 21:00:00 +07:00
parent 2faaeabf92
commit 1694035dc4
9 changed files with 157 additions and 72 deletions

View File

@ -252,8 +252,6 @@ Table medias {
age_rating_id String
country_id String
related_media media_relations [not null]
approver_id String
created_by_id String
updated_by_id String
deleted_by_id String
home_media_banners home_media_banners [not null]
@ -296,7 +294,7 @@ Table media_collections {
Table media_trailers {
media_id String [pk]
url String
embed_url String
embed_url String [unique]
small_image_url String
large_image_url String
maximum_image_url String
@ -661,7 +659,7 @@ Table countries {
id String [pk]
name String [not null]
slug String [not null]
code String [not null]
code String [unique, not null]
flag String
banner String
UserCountry users [not null]

View File

@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[embed_url]` on the table `media_trailers` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "media_trailers_embed_url_key" ON "media_trailers"("embed_url");

View File

@ -0,0 +1,8 @@
/*
Warnings:
- A unique constraint covering the columns `[code]` on the table `countries` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "countries_code_key" ON "countries"("code");

View File

@ -0,0 +1,10 @@
/*
Warnings:
- You are about to drop the column `approver_id` on the `medias` table. All the data in the column will be lost.
- You are about to drop the column `created_by_id` on the `medias` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "medias" DROP COLUMN "approver_id",
DROP COLUMN "created_by_id";

View File

@ -366,8 +366,6 @@ model Media {
age_rating_id String? @db.Uuid
country_id String? @db.Uuid
related_media MediaRelation[] @relation("MediaRelationRelatedMedia")
approver_id String? @db.Uuid
created_by_id String? @db.Uuid
updated_by_id String? @db.Uuid
deleted_by_id String? @db.Uuid
home_media_banners HomeMediaBanner[]
@ -407,7 +405,7 @@ model MediaCollection {
model MediaTrailer {
media_id String @id @db.Uuid
url String? @db.VarChar(255)
embed_url String? @db.VarChar(255)
embed_url String? @db.VarChar(255) @unique
small_image_url String? @db.VarChar(255)
large_image_url String? @db.VarChar(255)
maximum_image_url String? @db.VarChar(255)
@ -802,7 +800,7 @@ model Country {
id String @id @db.Uuid @default(uuid(7))
name String @db.VarChar(155)
slug String @db.VarChar(165)
code String @db.VarChar(3)
code String @db.VarChar(3) @unique
flag String? @db.VarChar(255)
banner String? @db.VarChar(255)