P
Prisma2d ago
v28

renaming column names

Hello, In the past I've made some really bad naming decisions for my columns and I'm wanting to rename these now. current schema:
model CustomInstance {
id Int @id @default(autoincrement())
botStatusType BotStatusTypes
botStatusText String
}
model CustomInstance {
id Int @id @default(autoincrement())
botStatusType BotStatusTypes
botStatusText String
}
I would like to rename the botStatusType column to botActivityType. To do this I tried using the @map property, below is an example of how i tried this:
model CustomInstance {
id Int @id @default(autoincrement())
botStatusType BotStatusTypes @map(name: "botActivityType")
botStatusText String @map(name: "botActivityText")
}
model CustomInstance {
id Int @id @default(autoincrement())
botStatusType BotStatusTypes @map(name: "botActivityType")
botStatusText String @map(name: "botActivityText")
}
My database is populated full of data which cannot be removed, id like this schema change to be seemless, but when attempting to prisma db push I get the following error:
⚠️ We found changes that cannot be executed:
• Added the required column `botActivityText` to the `CustomInstance` table without a default value. There are 1 rows in this table, it is not possible to execute this step.
• Added the required column `botActivityType` to the `CustomInstance` table without a default value. There are 1 rows in this table, it is not possible to execute this step.
⚠️ We found changes that cannot be executed:
• Added the required column `botActivityText` to the `CustomInstance` table without a default value. There are 1 rows in this table, it is not possible to execute this step.
• Added the required column `botActivityType` to the `CustomInstance` table without a default value. There are 1 rows in this table, it is not possible to execute this step.
1 Reply
Prisma AI Help
You chose to debug with a human. They'll tinker with your query soon. If you get curious meanwhile, hop into #ask-ai for a quick spin!

Did you find this page helpful?