Generating and running a migration for the following change:
const status = pgEnum('status', ['ONE', 'TWO', 'THREE']);
export const clients = pgTable('clients', {
// ...
status: status('status').notNull().default('ONE'),
});
to:
const status = pgEnum('status', ['FOUR']);
export const clients = pgTable('clients', {
// ...
status: status('status').notNull().default('FOUR'),
});
fails with:
PostgresError: unsafe use of new value "FOUR" of enum type status
...
hint: New enum values must be committed before they can be used.
I split the changes out into separate migrations (one to add the new value and another to use it), and I still receive the error. Is it possible to run each migration in an individual transaction to ensure the changes are committed before running the next one?
Generating and running a migration for the following change:
to:
fails with:
I split the changes out into separate migrations (one to add the new value and another to use it), and I still receive the error. Is it possible to run each migration in an individual transaction to ensure the changes are committed before running the next one?