What is the right way to remove a stored procedure in liquibase

Viewed 342

I have a spring boot app with liquibase folder structure as below.

db/
├─ changes/
│  ├─ sql/
│  │  ├─ prc_existing_to_be_deleted.sql
│  │  ├─ prc_newly_added.sql
│  ├─ stored-procs-changelog.xml
├─ changelog.xml
  • changelog.xml for storing all the changes in liquibase
  • stored-procs-changelog.xml for storing the stored procedure changelogs
  • prc_existing_to_be_deleted.sql stored procedure that is already existing
  • prc_newly_added.sql stored procedure that is going to be added newly.

My question here is - will liquibase automatically delete the stored procedure in prc_existing_to_be_deleted.sql and update its tables once I delete the file and rerun the app and everything is good? If not what is the right way to delete the stored procedure in that file.

1 Answers

No, Liquibase will not drop anything if you just remove the file with changeSets.

If you want to alter your DB somehow, you need to write a corresponding changeSet for it.

If we're talking about procedures, there's a dropProcedure change. Check out the docs and examples here

Related