Discussion:
[Liquibase-user] New Topic: MySQL foreign keys not generating unique indexes as well when required
Liquibase Community Forum
2011-01-17 15:41:39 UTC
Permalink
A new topic, 'MySQL foreign keys not generating unique indexes as well when required', has been made on a board you are watching.

You can see it at
http://liquibase.org/forum/index.php?topic=944.new#new

The text of the topic is shown below:

I tried to generate a change log to match my existing database. Some of my foreign keys are also unique indexes and some have RESTRICT on the ondelete and onupdate. The generated change log did not also generate the unique index when required. I see an attribute that gets generated called referencesUniqueColumn and it is set to false. When I set it to true I get an error that the addForeignKeyConstraint is not supported on mysql but when I set it to false at least is tries to generate a foreign key.

Here is what is generated

<addForeignKeyConstraint baseColumnNames="creator_id" baseTableName="audience" constraintName="FK3A26EA04CE7B13AF" deferrable="false" initiallyDeferred="false" onDelete="NO ACTION" onUpdate="NO ACTION" referencedColumnNames="id" referencedTableName="app_user" referencesUniqueColumn="false"/>

I can supply more information if required or a work around would be appreciated.

Unsubscribe to new topics from this board by clicking here: http://liquibase.org/forum/index.php?action=notifyboard;board=1.0

Regards,
The Liquibase Community Forum Team.

Loading...