I followed the next steps:
1. Created with third-party tool a Database Schema in Postgres.
2. Used Liquibase to export it to an db-initial.xml (changelog) in order to have an start point.
3. Now deleted the entire database in Postgres.
4. Created again the database (just Create Database…) empty.
5. Used Liquibase updateSQL to rebuild it.
What I found:
1. The Update SQL is generating this SQL
ALTER TABLE public.aisle ADD CONSTRAINT fk_aisle_categories FOREIGN KEY (id) REFERENCES public.aisle_categories (aisle_id) ON UPDATE NO ACTION ON DELETE NO ACTION;
2. Before this SQL
ALTER TABLE public.aisle_categories ADD CONSTRAINT idx_aisle_categories_1 UNIQUE (aisle_id);
What we have, an ERROR about than there is not Unique restriction in the refered table.
Then I’m not able to persist again my db because the “update” fails when is trying to do this.
¿There is any chance to change it? I mean to force the updateSQL to generate the table his own unique constraints before the foreign keys?