#How to run SQL query after each the migration

3 messages · Page 1 of 1 (latest)

lilac token
#

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

foggy hawkBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

lavish dust