Flyway vs Liquibase vs Sqitch: database versioning for PHP/Laravel projects
By Kevin Marcondes · Published on · 7 min read
A practical comparison of Flyway, Liquibase and Sqitch for database versioning in PHP/Laravel projects. Find objective criteria, pragmatic pros and cons, and a side‑by‑side table to help Laravel teams decide how to version schemas and data safely and predictably.
Criteria that matter for PHP/Laravel teams
Before picking a tool, align the choice with your team's risks and workflow. Laravel migrations cover many cases, but they don’t always satisfy governance, formal rollbacks or multi‑repo needs.
Set clear goals: standardize SQL, enforce rollback procedures, detect drift, generate changelogs from diffs, or simplify audits. Avoid introducing two sources of truth.
Also consider how the tool runs in CI/CD, how it stores state, and how it integrates with your deployment practices.
- Change format: plain SQL or DSL (YAML/JSON/XML).
- Rollbacks: requirement for reversal scripts and automated tests.
- Ordering and dependencies: sequential versions, changelog, or dependency graph.
- Drift detection and diffs between environments.
- Coexistence with Laravel migrations.
- CI/CD execution and secrets management.
- Support for MySQL and PostgreSQL in the same repository.
How Flyway, Liquibase and Sqitch work (practical view)
All three create a control table in the database and apply changes in a reproducible order. The differences lie in the model and the surrounding workflow features.
- Flyway: focuses on plain SQL and simple conventions. Uses versioned (V__) and repeatable (R__) migrations. Validates checksums. The typical approach is forward-only, reverting via a new corrective change when necessary.
- Liquibase: uses a single changelog (YAML/JSON/XML or SQL). Supports preconditions, contexts/labels and can generate changelogs from diffs. Rollbacks can be defined per change.
- Sqitch: relies on explicit dependencies. Each change has deploy, revert and rework scripts. It doesn’t use sequential numbering but a dependency graph.
Integrating with Laravel: coexist or replace migrations?
You can keep only Laravel migrations, adopt one of these tools, or combine them carefully. The essential rule is a single source of truth per database or schema.
If you choose Flyway, Liquibase or Sqitch, run the changes before code deployment and avoid calling "artisan migrate" in the pipeline for the same target. This prevents duplicate application of changes.
For questions about native migrations, consult the official Laravel documentation. For agile versioning guidelines, see our internal guide.
- Strategy 1: Laravel only for smaller apps. See the agile database versioning guide.
- Strategy 2: external tool as the source of truth. Execute it in CI/CD before deploy; the app consumes the schema as‑is.
- Strategy 3: separate by domain. Use Laravel migrations for app-level changes; use an external tool for corporate DDL and integrations.
Comparison table by practical criteria
A quick side‑by‑side summary to speed up decisions. Use it as a checklist when defining your workflow.
| Criterion | Flyway | Liquibase | Sqitch |
|---|---|---|---|
| Language/formats | Plain SQL; V__ and R__ conventions | DSL YAML/JSON/XML or SQL; central changelog | Plain SQL with deploy/revert/rework per change |
| Organization and ordering | Incrementing versions; repeatables by checksum | Order in changelog; contexts/labels | Dependency graph; no sequential numbering |
| Rollback | Forward‑only preferred; revert via new corrective change | Rollback defined per change; can generate for supported ops | Native revert required and explicit |
| Drift detection | Validation via checksums; no built‑in schema diff | Diff and changelog from the DB; validations | Status and dependency reporting; no native schema diff |
| Baseline/Tags | Baseline and repeatable migrations | Tags and changelogSync | Tags and change catalog |
| Generate by diff | No | Yes (generateChangeLog/diffChangeLog) | No |
| CI/CD execution | Simple CLI; table flyway_schema_history | CLI/libs; table DATABASECHANGELOG | CLI; table sqitch_changes |
| Multi‑db (MySQL/PostgreSQL) | Broad support | Broad support | Solid support |
| Coexistence with Laravel | Run before deploy; avoid duplicating artisan migrate | Similar; release tags help | Separate repo/folder; run before deploy |
| Learning curve | Low with plain SQL and conventions | Medium; powerful DSL requires practice | Medium/high; requires discipline in dependencies |
When to choose each one (signals and scenarios)
There’s no silver bullet. Look at what your team prioritizes and the types of changes you make most often.
- Choose Flyway when the team wants plain SQL, simple conventions and checksum validation, and prefers roll‑forward workflows.
- Choose Liquibase when you need rollbacks defined per change, preconditions, contexts/labels and the ability to generate changelogs from diffs between environments.
- Choose Sqitch when explicit dependencies are critical and you want deploy/revert/rework to be a disciplined part of the workflow.
- Small projects can keep Laravel migrations. To organize rollbacks on PostgreSQL, see the migrations and rollbacks guide.
CI/CD, governance and security for migrations
A tool only helps if integrated into the pipeline. Standardize how to run, version and audit migrations in each environment.
Avoid running migrations directly from the application container. Prefer a pipeline job using least‑privilege credentials. Keep centralized logs and audit artifacts.
- Pipeline steps: build → apply migrations to target → smoke tests → deploy the app.
- Per‑environment configuration via secure variables. See our CI/CD security checklist.
- Auditing: record the version/tag applied per release. See the deployment audit and remediation plan.
- Multiple databases: isolate connections and run per target. For migrations across engines, plan carefully—see the assisted MySQL to PostgreSQL migration.
Best practices and common pitfalls
Regardless of choice, several practices reduce surprises in production and make safe rollbacks easier.
- Prefer idempotent scripts when possible. For non‑transactional DDL, increase testing.
- Backward compatibility: releases should work with both schema version X and X‑1.
- Perform large data migrations in batches and short maintenance windows.
- Use feature flags for changes that require two‑release steps.
- Avoid two sources of truth. If you adopt an external tool, standardize execution and disable automatic migrations on app deploy.
- Document internal patterns and review schema diffs between environments regularly. See the agile database versioning guide for practical techniques.
Frequently asked questions
Can I use Flyway, Liquibase or Sqitch together with Laravel migrations?
Yes, provided there’s a single source of truth per database. A common pattern is to run the external tool in the pipeline before deploy and avoid calling artisan migrate for the same target. Separate responsibilities by domain or disable automatic migrations on deploy.
Which is easiest for a PHP/Laravel team to start with?
It depends on the team profile. If the team prefers plain SQL and simple conventions, Flyway is straightforward. If you need defined rollbacks and preconditions, Liquibase helps. Sqitch requires discipline around dependencies but gives explicit deploy/revert/rework control.
How to handle large data migrations without disrupting production?
Use idempotent scripts, batch processing and short maintenance windows. For databases that don’t support transactional DDL, validate changes in staging. Combine with feature flags and releases that support two schema versions to reduce risk.
How to migrate the current Laravel schema to one of these tools?
Freeze new migrations, create a baseline in a reference environment and start recording future changes with the chosen tool. Plan team communication and adjust the pipeline so only one mechanism runs per target.
Do these tools detect drift between environments?
Liquibase provides diff and changelog generation from the database, which helps detect differences. Flyway validates applied migration checksums. Sqitch reports status and dependencies. For detailed schema diffs with Sqitch or Flyway, use external diff tools.
How can I learn about Laravel's native migrations?
The official Laravel migrations documentation covers syntax, commands and best practices. See https://laravel.com and align the docs with your pipeline and internal guidelines.
Need help choosing and implementing safely?
If you need to choose between Flyway, Liquibase or Sqitch and integrate it into your Laravel project's pipeline, let’s discuss criteria, risks and the execution plan.
Talk about your migrations strategySee also
- ZFS vs LVM+LUKS on VPS for Databases — snapshots, performance and post-failure recovery
- Practical comparison — Nginx Unit vs PHP‑FPM vs RoadRunner for PHP monoliths in containers — latency, throughput & memory
- ZFS vs Btrfs for Snapshots, Replication and Incremental Retention on VPS with Docker — Practical Pros and Cons
- nftables vs iptables on Ubuntu 22.04: which to use and practical examples