Evolution of Top Database Schema Change Tools
Database schema migration has come a long way from CLI to GUI, and to GitOps and Database-as-Code. Let's take a look at the evolution of database schema migration tools.
Join the DZone community and get the full member experience.Join For Free
Database schema migration may be the riskiest area in application development - it's tough, risky, and painful. Database schema migration tools exist to alleviate pain and have come a long way: from the basic CLI tools to GUI tools, from simple SQL GUI clients to the all-in-one collaboration database platform.
Command-Line Clients (CLI) - MySQL / PSQL
MySQL and psql are the native CLI for MySQL and PostgreSQL respectively. You can send commands or queries directly to MySQL or PostgreSQL servers from the command line.
Although the CLI interface is simple, sometimes it's intimidating to beginners. However, according to Timescale's State of PostgreSQL 2022 survey results, PSQL is the most popular tool for interacting with PostgreSQL, surpassing GUI tools like pgAdmin and DBeaver.
phpMyAdmin and pgAdmin are classic SQL clients. phpMyAdmin is already an established tool for managing MySQL and MySQL-compatible databases (e.g. MariaDB), while pgAdmin is the PostgreSQL counterpart, which has now evolved to pgAdmin 4. Compared with CLI tools, phpMyAdmin and pgAdmin provide a UI for running and executing SQL queries, making them user-friendly.
DBeaver's initial release came in 2010, this open-source SQL client supports a whole range of databases (SQL, NoSQL, and cloud DBs), and keeps up with the latest trends in the AI realm by incorporating OpenAI's GPT capabilities, allowing natural language to be converted into SQL.
Navicat was first released back in 2001. It only supported MySQL back then, but later added more databases. Although Navicat's UI looks a bit outdated, it has complete functionality and provides a smooth overall experience when operating databases.
GUI-based SQL client is a good complement to CLI-based SQL client. Fundamentally, they work in the same way. You connect to the database and execute some SQL. Quick and convenient, on the flip side, lack of control, both in terms of database change management and data security. This post goes into more detail using Navicat as an example.
Gitops / Database-As-Code
To better manage and source control database schema changes, several tools have introduced the code change process into database changes, known as Database-as-Code.
Liquibase started in 2006 as an open-source library for tracking, managing, and applying database changes. Fun fact: Liquibase was acquired by a company called Datical in 2012 and rebranded to Datical, but then changed their name back to Liquibase in 2020 (wise move, have you seen anyone mention Datical on a forum?).
Liquibase's main product is a Java-based CLI that allows developer teams to integrate database schema migration into their CI/CD workflows through the CLI.
Flyway shares similarities with Liquibase in many ways: they are long-established, have a customer base, and are open-source projects. Its core product is a CLI and a Java library.
The commercial entity behind Flyway is Redgate (acquired in 2019). It's got 3 editions: community, team, and enterprise. You can tell that they have marked a clear boundary between the open-source and commercial offerings: Flyway's website feels more casual overall, while Redgate's way more professional.
Liquibase and Flyway are neck and neck. The main difference lies in their respective positioning: Liquibase is more enterprise-oriented, while Flyway is more developer-oriented.
Sqitch is a purely open-source project with no commercial offerings that's been on the market since 2012. It is pure CLI and does not have a UI.
Unlike Java-based Liquibase and Flyway, Sqitch is developed using Perl. In addition, Sqitch has its philosophy on how to manage database schema changes: Liquibase and Flyway both use file naming conventions to order schema migrations (convention over configuration).
While Sqitch adopts an explicit approach to allow users to specify the order in the Sqitch plan.
Atlas is an open-source tool built by Ariga, and promotes the term "database schema-as-code".
You can tell that they have drawn lots of inspo from HashiCorp and dubbed itself "Terraform for Database Migrations" upon its first appearance on Hacker News. They also invented Atlas HCL based on HCL (HashiCorp Configuration Language).
Atlas uses the modern programming language Go (unlike Liquibase/Flyway, which uses Java) and centres around CLI (similar to Liquibase/Flyway/Sqitch), but it also has a lightweight UI. Atlas Cloud is a commercial offering of the open-source version.
All in One: GUI + Gitops / Database-As-Code + Collaboration
ORMs like Prisma target the domain of how code interacts with data. Although this is more of a backend topic, Prisma is an ORM with front-end roots. Front-end engineers are probably not the most proficient in SQL. To lower the barrier to managing database schemas, Prisma invents its DSL to define data models.
DSL is state-based (declarative), which describes the end state of the database schema instead of incremental changes, which is different from Liquibase/Flyway/Sqitch. This way, Prisma can provide a more comprehensive view of database management throughout the entire application development cycle.
Prisma ORM is open source and free to use, and their Data Platform offers a cloud-based collaborative platform with some advanced features (it's clear that their ambition goes beyond just an ORM and schema migration tool).
Bytebase is an open-source database DevOps tool, covering database management scenarios from changes, queries, and security, to governance with a visual web-based collaboration workspace.
Visual change workflow
Bytebase provides a web-based UI where developers and DBAs can collaborate to work on database changes through the same interface.
To better accommodate the working habits of developers, Bytebase has integrated capabilities into code repositories such as GitLab and GitHub. With the GitOps workflow-enabled, developers can submit database change files to familiar code repositories, and once the review is completed and committed to the repo, the deployment will be automatically triggered by Bytebase. No need to switch between multiple tools!
Team Collaboration & Management
You can define different roles for members at two levels: Workspace and Project. You can assign different roles to your team members so that they have different permissions for different projects; or configure approval workflows for each project, such as specifying specific DBAs or QA responsible for this specific project.
The difference between Prisma and Bytebase lies in the target audience. Prisma is mainly aimed at front-end/full-stack developers, while Bytebase is more focused on back-end and DBAs. Both products provide collaboration capabilities, with Prisma focusing on the collaboration between developers in a single project, while Bytebase targets the entire engineering organization, i.e. developers and DBAs / Platform Engineering / Ops teams.
To Sum Up
If you are operating the database as an individual, the classic CLI or GUI SQL clients like Navicat will suffice. If you prefer integration with code repos, there are solutions like Liquibase and Flyway. However, for a GUI and project collaboration capabilities similar to Jira or GitLab, your options are Prisma and Bytebase. Bytebase is the only tool that offers organization-wide management capabilities to ensure data security and governance, in addition to making database changes more efficient and safer.
Published at DZone with permission of Mila Wu. See the original article here.
Opinions expressed by DZone contributors are their own.