Export exist mysql schema with wrong context

Hello ,

I want to export mysql schema with liquibase, however the output context is not my except.
There are some constraint error in my context,

Here are my SQL schema, there some Chinese characters , but I wonder know , why my alter always shown is

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, issue, issue, issue, issue, issue, issue, methodid, methodid, methodid, methodid, m ethodid, methodid, methodid, code, code, code, code, code, code, code);

What I except is

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, methodid, code);

Could anyone help me ?

my schema is here GitHub - te87037/liquibase_conf
test8 is fail, but test9 is normal

Hi @Rex.lin

Could you please help us with below details:

  1. Liquibase version you are using
  2. The exact command you run to achieve the goal

This will help us to reproduce the issue and provide some inputs.

Thanks,
Rakhi Agrawal

Hi @rakhi

  1. The version I used is 4.4.0.
  2. just run mysqldump without data

mysqldump --no-data -u someuser -p mydatabase

  1. if you want to know how liquibase command was used to my database.

liquibase --changeLogFile=dbchangelog6.mysql.sql --includeSchema=true --schemas=qgame --includeObjects=lock_.* generateChangeLog

There are 2 file on my github , you can try it .
test8 with more table than test9, but they are almost same structure.
I have no idea ,why test9 is normal, but test8 is not.

Hi @Rex.lin

From your Schema, I see the different tables are having same structure.
Is this a test schema provided or an actual schema. Though regardless of the schema details, Liquibase should have worked.

As you mentioned, the test9 works, can you check once by stepwise adding one table at a time in the file. So let’s say on first run, your file has 1st table. On second run, your file have first table and newly added second table, and so on.

Here are my SQL schema, there some Chinese characters , but I wonder know , why my alter always shown is

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, issue, issue, issue, issue, issue, issue, methodid, methodid, methodid, methodid, m ethodid, methodid, methodid, code, code, code, code, code, code, code);

From this, I see the column names are getting populated that many times as of the number of tables you have in the changeset file. I’m unclear how your test9 works?

Hi @rakhi
This result is not my excepted.

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, issue, issue, issue, issue, issue, issue, methodid, methodid, methodid, methodid, m ethodid, methodid, methodid, code, code, code, code, code, code, code);

Maybe you can try the file I provided in github so that you’ll understand what I saying.
please… :pleading_face: :pleading_face:

I know. This is something you are getting.

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, issue, issue, issue, issue, issue, issue, methodid, methodid, methodid, methodid, m ethodid, methodid, methodid, code, code, code, code, code, code, code);

However, This is something you expect:

ALTER TABLE lock_24xsc_baijiale ADD CONSTRAINT idx_index UNIQUE (issue, methodid, code);

Unsure as how test9 file works proeprly then.