PHPackages                             swouters/sql-migrations-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. swouters/sql-migrations-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

swouters/sql-migrations-bundle
==============================

Allow symfony database versioning using SQL plain files.

2.1(1mo ago)53.1k↓16.2%PHPPHP &gt;=8.4

Since Apr 9Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/Doelia/sql-migrations-bundle)[ Packagist](https://packagist.org/packages/swouters/sql-migrations-bundle)[ RSS](/packages/swouters-sql-migrations-bundle/feed)WikiDiscussions develop Synced yesterday

READMEChangelog (10)Dependencies (19)Versions (18)Used By (0)

SQL Migrations Bundle
=====================

[](#sql-migrations-bundle)

A Symfony bundle for database versioning, using only plain SQL files.

Allows maintaining a database schema without using the Doctrine ORM entities system.

Installation
------------

[](#installation)

Prerequisites:

- PHP &gt;= 8.4
- Symfony 7.4.\*
- PostgreSQL using the public schema (not compatible with other databases for now)

### Step 1: Prepare your project

[](#step-1-prepare-your-project)

If you start with a fresh Symfony skeleton, you will need Doctrine to install the bundle.

Install the ORM-pack (it's the only way to have \\Connection services properly configured):

```
composer require orm
composer remove doctrine/doctrine-migrations-bundle

```

We don't need the ORM parts; you can clean up your project:

- remove `src/Entity` and `src/Repository` folders
- in the `config/packages/doctrine.yaml`, keep only the `doctrine.dbal` parts

### Step 2: Download the Bundle

[](#step-2-download-the-bundle)

Open a command console, enter your project directory, and execute the following command to download the latest stable version of this bundle:

```
composer require swouters/sql-migrations-bundle:~2.1
```

### Usage

[](#usage)

#### Step 1: Put your .sql migration files in a `migrations` directory at the root of your project

[](#step-1-put-your-sql-migration-files-in-a-migrations-directory-at-the-root-of-your-project)

The order of the files is important, the bundle will execute them in the order of their names. I recommend adding the date in the filename, like `YYYYMMDD_[feature].sql`, to keep track of the order.

There is no down migration system.

#### Step 2: Run the command to apply the migrations

[](#step-2-run-the-command-to-apply-the-migrations)

That command will execute all the SQL files in the `migrations` directory that have not been executed yet.

```
php bin/console sql-migrations:execute --dry-run
```

The `--dry-run` option will only display the SQL queries that will be executed. Remove the option to execute the queries.

You can add the `--drop-database` option to drop the database (the public schema) before applying the migrations (useful for local/dev environment).

That command will use an internal table `_migrations` in the database to keep track of the applied migrations. You can change the name of the table by setting the `SQL_MIGRATIONS_TABLE` environment variable.

#### Other commands

[](#other-commands)

Mark a migration as applied without executing it:

```
php bin/console sql-migrations:mark-applied ./migrations/

```

Reset the `_migration` table and mark all migrations as applied without executing them:

```
php bin/console sql-migrations:mark-applied --all

```

Development
-----------

[](#development)

Clone the repository :

```
git clone https://github.com/Doelia/sql-migrations-bundle.git

```

### Run tests locally

[](#run-tests-locally)

#### With Docker

[](#with-docker)

The docker stack includes the PHP runtime and the PostgreSQL database.

```
.cloud/test.sh
```

#### Without Docker

[](#without-docker)

Prequisites:

- Php 8.4 / Composer
- A running PostgreSQL database
- A dedicated database for tests

Create a `.env.test.local` file and adapt the `DATABASE_URL` variable to your configuration:

```
DATABASE_URL=pgsql://user:password@host:port/database
```

Run tests:

```
composer update
vendor/bin/phpunit
```

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance94

Actively maintained with recent releases

Popularity25

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~52 days

Recently: every ~45 days

Total

16

Last Release

30d ago

Major Versions

0.4.0 → 1.0.02024-04-09

1.2.1 → 7.4.x-dev2026-03-17

PHP version history (2 changes)0.1.0PHP &gt;=8.3

1.1.0PHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4354254?v=4)[Stéphane Wouters](/maintainers/Doelia)[@Doelia](https://github.com/Doelia)

---

Top Contributors

[![Doelia](https://avatars.githubusercontent.com/u/4354254?v=4)](https://github.com/Doelia "Doelia (21 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/swouters-sql-migrations-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/swouters-sql-migrations-bundle/health.svg)](https://phpackages.com/packages/swouters-sql-migrations-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
