If you have enum defaults in your schema, any subsequent migrations will add an alter table statement in the "database steps" section of the migration readme, despite those steps not existing in steps.json.
1) Create the following datamodel:
enum WorkerRole {
ADMIN
OWNER
}
model Worker {
role WorkerRole @default(ADMIN)
}
2) Run prisma migrate save and up
3) Add a new field to Worker (or any other model in the schema):
model Worker {
role WorkerRole @default(ADMIN)
test String
}
4) Look at the migration files - the README contains the following database step, despite that already existing in the DB, and no corresponding step existing in steps.json:
ALTER TABLE "default$default"."Worker" ALTER COLUMN "role" SET DEFAULT E'ADMIN';
Avoid these steps appearing in the README when they aren't actually being executed.
Looks like a bug in our diffing logic, thanks for reporting this!
I can't reproduce this issue locally. Can you confirm it still happens for you with a fresh database?
Seems to be fine as of v2.2! Thanks