PHPackages                             nowo-tech/migrations-kit-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. nowo-tech/migrations-kit-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

nowo-tech/migrations-kit-bundle
===============================

Symfony bundle providing migration helpers: schema checks (table/column/index exists) and array-based migration definitions. Use in Doctrine Migrations with Symfony 7|8.

v2.0.7(2mo ago)0293[1 PRs](https://github.com/nowo-tech/MigrationsKitBundle/pulls)MITPHPPHP &gt;=8.2 &lt;8.6CI passing

Since Feb 22Pushed 1mo agoCompare

[ Source](https://github.com/nowo-tech/MigrationsKitBundle)[ Packagist](https://packagist.org/packages/nowo-tech/migrations-kit-bundle)[ Docs](https://github.com/nowo-tech/migrations-kit-bundle)[ RSS](/packages/nowo-tech-migrations-kit-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (23)Versions (11)Used By (0)

Migrations Kit Bundle
=====================

[](#migrations-kit-bundle)

[![CI](https://github.com/nowo-tech/MigrationsKitBundle/actions/workflows/ci.yml/badge.svg)](https://github.com/nowo-tech/MigrationsKitBundle/actions/workflows/ci.yml) [![Packagist Version](https://camo.githubusercontent.com/b5a94ed5b98ac90efb068bc018b43befbfbce4f217aaed6085bb67a4cc9ca316/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f776f2d746563682f6d6967726174696f6e732d6b69742d62756e646c652e7376673f7374796c653d666c6174)](https://packagist.org/packages/nowo-tech/migrations-kit-bundle) [![Packagist Downloads](https://camo.githubusercontent.com/0184bbca1fb44001fcd173af5b821996dba9965750ad8dac81950c9e35e9701b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f776f2d746563682f6d6967726174696f6e732d6b69742d62756e646c652e737667)](https://packagist.org/packages/nowo-tech/migrations-kit-bundle) [![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE) [![PHP](https://camo.githubusercontent.com/8e58b490725ac49cc8e463c473173681b324c9d92d7854275a785db013ca3de7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d3737374242343f6c6f676f3d706870)](https://php.net) [![Symfony](https://camo.githubusercontent.com/8fe7de83f11ab7ca74742794be56f9291632c8351a9ae5baea0bc1e9c4eb5a35/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d3625323025374325323037253230253743253230382d3030303030303f6c6f676f3d73796d666f6e79)](https://symfony.com) [![GitHub stars](https://camo.githubusercontent.com/a4c4aa2494bf3b609bb330349cb2a05c68553d41205c14eaf2c554fb2fadf612/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e6f776f2d746563682f6d6967726174696f6e732d6b69742d62756e646c652e7376673f7374796c653d736f6369616c266c6162656c3d53746172)](https://github.com/nowo-tech/MigrationsKitBundle) [![Coverage](https://camo.githubusercontent.com/4e59a36f361de283cf344171d2f8086744428f50ccaa121712aad4c51ba9513a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d39392e33392532352d627269676874677265656e)](#tests-and-coverage)

**Symfony bundle that provides helpers for Doctrine Migrations**: schema checks (table/column/index exist) and array-based migration definitions, so you can write idempotent migrations without repeating SQL and with safe checks. For **Symfony 7 and 8** · PHP 8.2+ · **Doctrine DBAL** 2.x–4.x and **doctrine/migrations** 3.x–4.x.

> ⭐ **Found this useful?** [Install from Packagist](https://packagist.org/packages/nowo-tech/migrations-kit-bundle) · Give it a **star** on [GitHub](https://github.com/nowo-tech/MigrationsKitBundle) so more developers can find it.

Table of contents
-----------------

[](#table-of-contents)

- [Quick search terms](#quick-search-terms)
- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Documentation](#documentation)
- [Requirements](#requirements)
- [Demo](#demo)
- [Development](#development)
- [License &amp; author](#license--author)

Quick search terms
------------------

[](#quick-search-terms)

Looking for **Doctrine migrations helpers**, **table exists migration**, **column exists check**, **idempotent migrations**, **migration schema check**, **Symfony Doctrine Migrations**, **declarative schema migrations**? You're in the right place.

Features
--------

[](#features)

- ✅ **SchemaChecker** — `tableExists`, `columnExists`, `indexExists`, `hasPrimaryKey`, `foreignKeyExists`, `listTableColumns`; no container injection: `new SchemaChecker($this->connection)`
- ✅ **CreateTablesService** — apply declarative definition arrays (MDK format); create/drop tables, add/drop/rename/modify columns, add/drop indexes, foreign keys; call `apply($schema, $definition)` with introspected schema and add each returned SQL with `$this->addSql()`
- ✅ **MigrationDefinitionKeys (MDK)** — constants for definition keys (`tables`, `columns`, `primary_key`, `indexes`, `foreign_keys`, `drop_columns`, etc.); use alias **MDK** in code; see [DECLARATIVE\_SCHEMA.md](docs/DECLARATIVE_SCHEMA.md)
- ✅ **Array of associative arrays** — columns, indexes, FKs defined as arrays of items (each with `name`/`columns`, `type`, `drop`, `rename`, etc.); no raw SQL for schema changes
- ✅ **Recommended practice** — use separate migrations: first add column, then add index, then add foreign key; when dropping, first drop indexes then drop columns (see [docs/USAGE.md](docs/USAGE.md#recommended-independent-well-ordered-migrations)). The bundle **always applies operations in the correct order** (drops: FK → index → column; adds: columns → PK → indexes → FKs), but phased migrations are more stable
- ✅ Compatible with **Doctrine DBAL 2.x, 3.x, 4.x** and **doctrine/migrations 3.x, 4.x**
- ✅ **SQLite, MySQL and PostgreSQL** — schema checks and migrations work with all three
- ✅ **Symfony Flex** recipe (register bundle + config; see [docs/INSTALLATION.md](docs/INSTALLATION.md))
- ✅ **Demos** for Symfony 7 and 8 with example migrations (create table, add/rename/drop columns, indexes, FKs); Make targets to view migration SQL (`migrate-verbose`, `migrate-dry-run`, `migrate-write-sql`)

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

[](#installation)

```
composer require nowo-tech/migrations-kit-bundle
```

[![Install from Packagist](https://camo.githubusercontent.com/25ba1d8b573a14c09873ad1c973fe17a929432bcf6cf4ceca6fa0910e34c5d08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5061636b61676973742d696e7374616c6c2d3737374242343f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/nowo-tech/migrations-kit-bundle)

With **Symfony Flex**, the recipe (when enabled) registers the bundle and creates the config file automatically. Without Flex, see [docs/INSTALLATION.md](docs/INSTALLATION.md) for manual steps.

**Manual registration** in `config/bundles.php`:

```
