mystamps icon indicating copy to clipboard operation
mystamps copied to clipboard

Detect usage of the strings for numeric/boolean types in Liquibase migrations

Open php-coder opened this issue 6 years ago • 12 comments

We should use valueBoolean in this case --https://www.liquibase.org/documentation/column.html

php-coder avatar Aug 16 '19 16:08 php-coder

Another case that hasn't been spotted in #1107:

<column name="series_id" value="1" />
<column name="number_of_stamps" value="1" />

php-coder avatar Aug 16 '19 16:08 php-coder

It seems like we can use git grep value="\d+" for finding valueNumeric candidates and git grep value="TRUE|true|FALSE|false" for valueBoolean

php-coder avatar Sep 02 '19 19:09 php-coder

Another idea is to detect usage of old schema: http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd instead of 3.1

php-coder avatar Nov 27 '19 17:11 php-coder

Yet another one: each <changeSet> must have context attribute with supported values.

php-coder avatar Nov 27 '19 17:11 php-coder

One more gotcha -- MySQL doesn't support beforeColumn -- https://liquibase.jira.com/browse/CORE-2347

php-coder avatar Dec 02 '19 22:12 php-coder

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".

php-coder avatar Jan 07 '20 13:01 php-coder

  • unique constraint naming: uc_<table>_<field>
  • foreign constraint naming: fk_<table>_<field>
  • always specify uniqueConstraintName attribute when unique="true" is used to set a predictable name for the constraint

php-coder avatar Jan 09 '20 13:01 php-coder

modifyDataType mustn't be used with NOT NULL fields as it loses this property (see #1266)

php-coder avatar Mar 11 '20 17:03 php-coder

It has turned out that columnDataType is required for addNotNullConstraint on mysql

php-coder avatar Mar 11 '20 21:03 php-coder

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

php-coder avatar Oct 25 '21 10:10 php-coder

It has turned out that columnDataType is required for setColumnRemarks on mysql

php-coder avatar Oct 25 '21 10:10 php-coder

renameColumn also loses NOT NULL on MySQL. See for example: https://github.com/php-coder/mystamps/pull/1652/files#diff-ed5ff70f6771c05d79956c1adea7b7a53123b9163fa10bfdc85a9efb27e0f561

php-coder avatar Jan 27 '24 06:01 php-coder