Detect usage of the strings for numeric/boolean types in Liquibase migrations
We should use valueBoolean in this case --https://www.liquibase.org/documentation/column.html
Another case that hasn't been spotted in #1107:
<column name="series_id" value="1" />
<column name="number_of_stamps" value="1" />
It seems like we can use git grep value="\d+" for finding valueNumeric candidates and git grep value="TRUE|true|FALSE|false" for valueBoolean
Another idea is to detect usage of old schema: http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd instead of 3.1
Yet another one: each <changeSet> must have context attribute with supported values.
One more gotcha -- MySQL doesn't support beforeColumn -- https://liquibase.jira.com/browse/CORE-2347
We can also force a foreign keys to have a name. Also we can check that date fields have names with suffix "_at" and fields that references users have suffix "_by".
- unique constraint naming:
uc_<table>_<field> - foreign constraint naming:
fk_<table>_<field> - always specify
uniqueConstraintNameattribute whenunique="true"is used to set a predictable name for the constraint
modifyDataType mustn't be used with NOT NULL fields as it loses this property (see #1266)
It has turned out that columnDataType is required for addNotNullConstraint on mysql
Yet another one: each <changeSet> must have context attribute with supported values.
Liquibase 4.5.0 has introduced quality checks and at least it has a rule to ensure that every changeset has a context attribute: https://docs.liquibase.com/concepts/advanced/configuring-quality-checks.html#Ensure2
It has turned out that columnDataType is required for setColumnRemarks on mysql
renameColumn also loses NOT NULL on MySQL. See for example: https://github.com/php-coder/mystamps/pull/1652/files#diff-ed5ff70f6771c05d79956c1adea7b7a53123b9163fa10bfdc85a9efb27e0f561