Tutorial - Delete and recreate database on new branch
Published 21 January 2025
One way to switch branches and have your database match the schema from that branch is to drop and recreate your database. This resets your environment so you can deploy from the new branch. To do this:
- Take a backup of your development database, in case you need to restore it later.
- Delete your development database.
- Create a new database with the same name and credentials.
- In the version control tab in Flyway Desktop, create or switch to the branch you're working on.
- Click Pull to make sure all the latest changes from the remote repository are on your local repository.
- In the schema model tab, make sure you're on the Apply to Database section.
- Select all the objects on the screen and click Apply to database. You will need to confirm this action since you're development database will be updated with all your selections.
Your database now matches the schema definition that is on that branch.