Source control for your database in five steps
Hello! I am Deon Taljaard Application Developer
Agenda ◉ Source control for databases? ◉ What is Liquibase? ◉ What are the benefits of using Liquibase? ◉ Demo ◉ Questions?
Source control for 1 databases?
Source control for databases? We have all used source control software for our code What about our databases? ◉ Manual approach ◉ Version SQL scripts ◉ Homegrown tool
Source control for databases? Consider the following scenarios: ◉ A client has logged a defect and you need to restore your database to a state that matches a specific version of the code base the defect resides in ◉ What happens to the data in the database if the schema changes
Source control for databases? Problems with manually addressing scenarios: ◉ Inconsistent application of changes ◉ Ineffective mechanisms for managing changes ◉ Changes may not have been communicated to the team ◉ Out of sync database between environments
Source control for databases?
Source control for databases? There are tools available to cater for scenarios like these and many more And more...
Source control for databases? Liquibase is NOT the only tool for doing this ◉ If anything, I hope that at the end of the presentation all of us may realise the value and importance of employing such a technology in our software projects - and that you consider which tool will work for you and your projects.
What is Liquibase and 2 what is it used for?
What is Liquibase? ◉ Liquibase is an open source database-independent library for tracking, managing and applying database schema changes ◉ It has an extensive feature set, yet it’s simple enough to get started with
What is Liquibase? Core concepts for working with Liquibase: ◉ Changeset ◉ Changelog ◉ Databasechangelog ◉ Databasechangeloglock
What are the benefits of 3 using Liquibase?
What are the benefits of using Liquibase? From the Liquibase site: ◉ Supports code branching and merging ◉ Supports multiple developers ◉ Supports multiple database types ◉ Supports XML, YAML, JSON and SQL formats ◉ Generate Database "diffs"
What are the benefits of using Liquibase? Personal additions: ◉ It keeps all the changes to the db in one place ◉ It abstracts schema changes into a model, which is easily understandable ◉ All the changes do not have to be kept in one change log file - use sub changelogs and include in master changelog
What are the benefits of using Liquibase? Personal additions: ◉ Makes applying DB changes quick, easy and safe ◉ We can integrate Liquibase into our build management to deal with database changes. So applying LiquiBase is just a click or two. ◉ The learning curve is steep, however first results are achieved quick
4 Demo
Demo Two scenarios ◉ Employing Liquibase from the inception of a project ◉ Adding Liquibase to an existing/legacy project
Demo Employing Liquibase from the inception of a project Add Add Add Liquibase master Liquibase changeset update changelog Commit changelog
Demo 1. Add Liquibase
Demo 2. Add master changelog
Demo 3. Add changeset
Demo 4. Run Liquibase update 5. Commit changelog
Demo Adding Liquibase to an existing/legacy project Add Add Generate Commit master Liquibase changelog changelog changelog
Demo 1. Add Liquibase
Demo 2. Add master changelog
Demo 3. Run Liquibase generateChangeLog (with changelogSync) 4. Commit changelog(s)
Thanks! Any questions?
Credits Special thanks to all the people who made and released these awesome resources for free: ◉ Presentation template by SlidesCarnival
Recommend
More recommend