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.0(2mo ago)52.6k↓33.3%PHPPHP &gt;=8.4

Since Apr 9Pushed 2mo 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 1mo ago

READMEChangelog (10)Dependencies (12)Versions (17)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 8.4
- Symfony 7.4
- PostgreSQL using the public schema (not compatible with other databases for now)

### Step 0: Prepare your project

[](#step-0-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 1: Download the Bundle

[](#step-1-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.0
```

### Step 2: Enable the Bundle

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

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    SWouters\SqlMigrationsBundle\SqlMigrationsBundle::class => ['all' => true],
];
```

### 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

51

—

FairBetter than 96% of packages

Maintenance88

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 ~50 days

Recently: every ~66 days

Total

15

Last Release

62d 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 (19 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

[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[hautelook/alice-bundle

Symfony bundle to manage fixtures with Alice and Faker.

19519.4M34](/packages/hautelook-alice-bundle)[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.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

813.1k](/packages/ahmed-bhs-doctrine-doctor)[heymoon/doctrine-psql-enum

Store PHP native enums as PostgeSQL custom enum types

254.9k](/packages/heymoon-doctrine-psql-enum)

PHPackages © 2026

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