Hello, I think liquibase decided for wrong change sets when running “liquibase generate-changelog” on a sqlite database.
I have a very simple sqlite db.
I run “liquibase generate-changelog”
then I run “liquibase changelog-sync-sql” on that db so that liquibase can create its tables and know about the state of the db.
However, I get several lines of error that state “addForeignKeyConstraint is not supported on sqlite”.
I figured out, that is because liquibase generated the addForeignKeyConstraint change.
“- changeSet:
id: 1728909987381-22
author: me (generated)
changes:
- addForeignKeyConstraint:”
which makes no sense, since sqlite does not support adding constraints when altering tables.
https://www.sqlite.org/omitted.html
Instead, liquibase should have added those foreign key constraints inside a createTable change like so:
…
- column:
constraints:
nullable: false
foreignKeyName: fk_creditbucket_organization
referencedTableName: organization
referencedColumnNames: id
validateForeignKey: true
name: organization_id
type: BIGINT(2000000000)
Am I understanding something wrong?
How can I make it so that liquibase generate-changelog adds foreign key constrains on creating the table , so I don’t have to fix half of the changelog manually?
Cheers