PHPackages                             gatherdigital/pimcore-migrations - 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. gatherdigital/pimcore-migrations

AbandonedArchivedPimcore-plugin

gatherdigital/pimcore-migrations
================================

Pimcore database migrations plugin

0.3.3(8y ago)27.2k↓100%1proprietaryPHPPHP &gt;=5.6.0

Since Nov 22Pushed 8y ago2 watchersCompare

[ Source](https://github.com/gatherdigitaluk/pimcore-migrations)[ Packagist](https://packagist.org/packages/gatherdigital/pimcore-migrations)[ Docs](https://www.gatherdigital.co.uk/agency)[ RSS](/packages/gatherdigital-pimcore-migrations/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

\#Pimcore Migrations Plugin

Introduction
------------

[](#introduction)

Pimcore already does a lot of migration work for developers, all class definition changes and database schema changes can be easily ported between development, staging and production environments. However, the following use-cases for database changes are not easily portable between Pimcore environments:

- Custom persistant model schemas.
- The addition of new class definitions does not happen automatically happen in deployment.
- Changes to website settings (stored in the database) do not happen in any deployment helpers.
- Alterations to document editables, i.e. changing a textarea to wysiwyg creates invalid references to editables.
- A rename of a ClassDefinition field removes the old column, then adds a new one, rather than actually renaming.

### What this plugin provides

[](#what-this-plugin-provides)

This plugin provides a simple mechanism for implementing version controllable database changes between pimcore environments, in a lightweight convention similar to packages such as Phinx or Doctrine Migrations.

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

[](#installation)

Install using composer:

```
composer require gatherdigitaluk/pimcore-migrations

```

Configuration
-------------

[](#configuration)

Configuration is intended to be as simple as possible.

1. After install ensure that the extensionis listed as follows in your extensions.php file

```

```

2. Migrations should be placed in your /website/var/plugins/PimcoreMigrations/migrations folder.
3. The plugin will automatically install a new table into the pimcore environment upon detecting a migrations folder when the console app is executed.

Usage
-----

[](#usage)

### Extend the AbstractMigration Class

[](#extend-the-abstractmigration-class)

1. Each migration should extend the class PimcoreMigrations\\Model\\AbstractMigration.
2. It can be named however you wish, although the last part of the name should be a numeric value separated by an underscore (\_). For example:
    - some\_table\_changes\_1000.php
    - new\_custom\_persistent\_class\_1001.php
    - anotherdifferentlynamedclass\_1002.php
3. Each migration class should have a similarly named classname following the same pattern as Pimcore, example:
    - SomeTableChanges1000
    - NewCustomPersistentClass1001
    - Anotherdifferentlynamedclass1002
4. If we created the classes above we would have the following versions (represented by an integer)
    - 1000
    - 1001
    - 1002

### Implement the required class methods

[](#implement-the-required-class-methods)

Each Migration should contain both an up() and down() method. UP being the default operation, and DOWN being to roll back changes. Here is an example:

```
