Bug description
After adding a NON NULLABLE column with a default value to an existing table with records in the database, I get the following error:
Added the required column `x` to the `y` table without a default value. There are `z` rows in this table, it is not possible to execute this migration.
The model looks like the following:
model MyModel {
id String @default(cuid()) @id
x String @default("Some value")
// And some other columns...
}
The column causing the error is the x column.
How to reproduce
- Create a migration with a model and some columns.
- Add a NON NULLABLE column to that model.
- Save the changes and run the migration.
- See error.
Expected behavior
Migration to be successfully applied.
Environment & setup
- OS: Windows 10 2004 (Running on WSL 2)
- Database: PostgreSQL
- Node.js version: 12.18.2
- Prisma version: 2.1.3
Bug description
After adding a NON NULLABLE column with a default value to an existing table with records in the database, I get the following error:
The model looks like the following:
The column causing the error is the
xcolumn.How to reproduce
Expected behavior
Migration to be successfully applied.
Environment & setup