-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support createIndex with specifying index prefix length #148
Comments
Do I understand you correctly: You basically want that Just some docs:
I guess, this should then be supported not only for createIndex but basically for all change types. |
No I don't want modifySql to be applied for add Index. In liquibase also we don't have way to override the size of the column while creating index for tag createIndex. Because even if we mention type while creating index it gets ignored in liquibase as well as liquibase percona. <createIndex tableName="some_table" indexName="some_table_index">
<column name="column1" type="varchar(300)"/>
<column name="column2"/>
</createIndex> Please let me know accordingly. |
Ok, I understand now. Have you tried to create the index like this? <createIndex tableName="some_table" indexName="some_table_index">
<column name="column1(300)"/>
<column name="column2"/>
</createIndex> If that works, then all is fine - your use case is already supported. And it should work also with liquibase-percona. If not (it might be the liquibase properly escapes the column name and you'll see an error like "column column1(300) not found"), then I'd suggest that you bring this into attention for core liquibase. Just file a new feature request here: https://github.com/liquibase/liquibase/issues For me it makes only sense to implement this feature in liquibase-percona, if it is supported in liquibase-core (e.g. without percona) as well. The feature we are talking here about is called Column Prefix Key Parts. |
So using following code: <createIndex tableName="some_table" indexName="some_table_index">
<column name="column1(300)"/>
<column name="column2"/>
</createIndex> works with liquibase. But when we try to use this using liquibase percona we start getting error in Java as
I also tried to run this command on command line I get following error:
Error: |
Hi Team, Any update on this request ? |
I've created a fix for this, see #157. Would you mind testing this fix? |
@adangel My colleague @vaishakhikulkarni is out of office these days. I tested your update and it does indeed work now. However, our problem of not be able to change column size while updating index still remains. It seems like the 2 solutions to them would be to:
Do you think the 2nd option is something viable? |
@mahameed Thanks for testing. Regarding your follow-up question: You can specify the column size while creating the index like this: <createIndex tableName="some_table" indexName="some_table_index">
<column name="column1(300)"/>
<column name="column2"/>
</createIndex> Is there anything else, what should be supported by liquibase? If so, please comment on liquibase/liquibase#2191 So I don't think, modifySql is required at all (at least not for this use case). |
@adangel ok I missed that part. Yeah that seems to be working. Thanks. |
I've released now 4.6.1.1: https://github.com/liquibase/liquibase-percona/releases/tag/liquibase-percona-4.6.1.1 |
In SQL:
ALTER TABLE some_table MODIFY
column1
varchar(4096) CHARACTER SET utf8mb4 NOT NULL;ALTER TABLE some_table ADD INDEX
some_table_index
(column1 (300),column2);In Liquibase also we don't support override but have work around like follows:
First createIndex and use modifySql to replace column1 with column1(300) override size.
While we do not have any support or work around for liquibase percona. This would be very useful feature for us.
The text was updated successfully, but these errors were encountered: