Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

addColumn ignores deleteCascade #1671

Closed
rsaccoccio opened this issue Feb 6, 2021 · 2 comments · Fixed by #1970
Closed

addColumn ignores deleteCascade #1671

rsaccoccio opened this issue Feb 6, 2021 · 2 comments · Fixed by #1970

Comments

@rsaccoccio
Copy link

rsaccoccio commented Feb 6, 2021

addColumn ignores deleteCascade:

  • addColumn:
    tableName: run_data
    columns:
    • column:
      name: PARENT_RUN_ID
      type: VARCHAR(36)
      constraints:
      foreignKeyName: RUN_DATA_FK02
      references: RUN_DATA(RUN_ID)
      deleteCascade: true

generates:

"ALTER TABLE x.run_data ADD PARENT_RUN_ID VARCHAR(36)"
"ALTER TABLE x.run_data ADD CONSTRAINT RUN_DATA_FK02 FOREIGN KEY (PARENT_RUN_ID) REFERENCES x.RUN_DATA (RUN_ID)"

deleteCascade from inside addTable and addForeignKeyConstraint generate the correct SQL, e.g.:

  • addForeignKeyConstraint:
    baseColumnNames: parent_run_id
    baseTableName: run_data
    constraintName: run_data_fk02
    onDelete: CASCADE
    referencedColumnNames: run_id
    referencedTableName: run_data

generates:

"ALTER TABLE x.RUN_DATA ADD CONSTRAINT RUN_DATA_FK02 FOREIGN KEY (PARENT_RUN_ID) REFERENCES x.RUN_DATA (RUN_ID) ON DELETE CASCADE"

@molivasdat
Copy link
Contributor

Hi @rsaccoccio Thanks for writing up this issue. There is not attribute deleteCascade on a column type in liquibase.
https://docs.liquibase.com/change-types/community/add-column.html?Highlight=add%20column#Informa

@nvoxland
Copy link
Contributor

nvoxland commented Jul 7, 2021

I have a fix in #1970 for this

@nvoxland nvoxland added this to To Do in Conditioning++ via automation Jul 7, 2021
@nvoxland nvoxland moved this from To Do to Code Review in Conditioning++ Jul 7, 2021
@suryaaki2 suryaaki2 moved this from Code Review to Ready for Handoff (In JIRA) in Conditioning++ Jul 27, 2021
Conditioning++ automation moved this from Ready for Handoff (In JIRA) to Done Nov 9, 2021
@nvoxland nvoxland removed this from Done in Conditioning++ Dec 1, 2021
@nvoxland nvoxland added this to the v4.6.2 milestone Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants