Liquibase update failed:Incorrect Index name"primary"

Hi Nathan


Thanks for your valuable response.


Am using Mysql Database.


Diffchangelog xml file


<?xml version="1.0" encoding="UTF-8" standalone="no"?>

   

       

           

           

           

           

       

   

   

       

   

   

       

   

   

       

   

   

       

   



when i try to update it gives error.

Command line :java -jar C:\Users\ASPL3\Desktop\liquibase-3.0.6/liquibase.jar --driver=com.mysql.jdbc.Driver  --classpath=C:\Users\ASPL3\Desktop\liquibase-3.0.6/mysql-connector-java-5.1.13-bin.jar  --changeLogFile=C:\Users\ASPL3\Desktop\liquibase-3.0.6/newchangelog.xml --url=“jdbc:mysql://localhost:3309/eRMSDatabase” --username=root  --password=“XXXX” update  



Error:Liquibase update Failed: Migration failed


 Reason: liquibase.exception.DatabaseException: Error executing SQL CREATE UNIQUE INDEX primary ON eRMSDatabase.accesseventlog(ControllerID, DoorID, EventDate, EventTime): Incorrect index name ‘primary’



Please look into above error give me some solution.


Can you tell from looking at the generated changelog what it wrong with what it is trying to execute? It may be that it is specifying the primary key name as “primary” in the changelog file because your database uses that for all the primary names.


What database are you using? Mysql?

Nathan

Hi all,

I am using new release liquibase 3.0.6 it works for diffchangelog perfectly.when try to update  same generate xml file gives 

Liquibase update failed:Incorrect Index name"primary" error.please help me how resolve problem.

It looks like it is running into problems handling the index and primary key. What is generated with diffChangeLog should be thought of as a starting point and should be edited if there are any problems. In your case, it is having problems detecting changes to the primary key and so you should pull out the drop/create index changeSets and the constraintName=“PRIMARY” attribute on the addPrimaryKey tag.


I’ll look into why it is generating the extra unneeded changeSets


Nathan

Hi Nathan,


Any solution for my problem.


Raghuveer A.R

I haven’t looked at the extra changeSets generated yet. Planning to this week, though.


Nathan

ok thanks Nathan