P
Prisma3mo ago
Rev

How to run SQL query after each the migration

I have an enum enum AssignmentsEnum { DASHBOARD_READ REAL_TIME_READ USER_READ USER_CREATE USER_UPDATE USER_RESEND_MAIL USER_CHANGE_STATUS USER_BLOCK } And a table model Assignment { id Int @id @default(autoincrement()) name AssignmentsEnum @unique description String? @db.VarChar(255) @@map("TB_ASSIGNMENT") @@schema("public") } Every time that i add new enum for AssignmentsEnum i need to run a sql to add in the Assignment table the relation: INSERT INTO "TB_ASSIGNMENT" (name, description) VALUES ('UNATTACH_DEMAND', 'Permissão para desvincular demanda'); file: 20230321001108_assignment_enum_insert_unattach_demand how could i do it automatized after run the migration: 20230321001108_assignment_enum_insert_unattach_demand
2 Replies
jonfanz
jonfanz3mo ago
That's not possible at the moment. What you could do is manually customize the migration in order to add anything you specifically need to do
Rev
Rev3mo ago
The problem is: migration generated is ran in an shadow database and it's not permitted to run DML queries in shadow database
Want results from more Discord servers?
Add your server