Reputation: 7078
I have a table of users which was created with nullable: false
constraint. Now I need to remove this constraint, but it seems I can only remove one constraint at a time with something like this:
databaseChangeLog:
- changeSet:
id: 1024
author: thomas
dropNotNullConstraint:
tableName: sup_user
columnName: supplier_id
columnDataType: VARCHAR(255)
But I also want to remove the constraint for the column supplier_name
. Do I just need multiple changeSet
s or can I combine the changes within one set?
Upvotes: 1
Views: 1076
Reputation: 463
the best practice is to create a new changeset for your modification if the application is in production, but if the application is in test or in development, we can change the old changeset as long as you manually delete the table that has already been created by this changeset and delete its entry in the databasechangelog table to avoid the checksum error
Upvotes: 1
Reputation: 7330
I'm not very familiar with Liquibase 'SQL notation', but it's a good practice to make changeSets atomic. So yes, I'd say you should write a separate changeSet to drop another not null constraint.
Please note that it's also a good practice to write preConditions for the changeSets to make sure they will not fail during execution or to try to avoid that possible fail and make an appropriate action if the fail is imminent.
Upvotes: 1