Hi all,
It seems the CREATE INDEX refactoring has a serious omission - it’s not possible set the index column order (ASC/DESC per column.)
Or am I missing something?
Hi all,
It seems the CREATE INDEX refactoring has a serious omission - it’s not possible set the index column order (ASC/DESC per column.)
Or am I missing something?
Currently not, unfortunately. https://liquibase.jira.com/browse/CORE-1232 is logged for it.
For now, you can either use the tag and specify the entire index creation yourself, or use to add the asc/desc text to the generated SQL.
Nathan
Thanks for the tip, but ASC/DESC is per column. How can I use modifySql to modify each column in the create index refactoring?
modifySql just does a simple string search/replace, so you can do something like:
Nathan
I’ve submitted a pull request that will make it possible to specify descending key columns not only for indexes, but also for primary keys and unique constraints. This will even work on databases with quoted column names like Microsoft SQL Server. If it’s accepted, it could make it into Liquibase 3.4.0.
Here is an example of how it could work:
<column name="col1"/></div>
<column name="col2" descending="true"/></div>