Download the PHP package effiana/migration-bundle without Composer

On this page you can find all versions of the php package effiana/migration-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package migration-bundle

EffianaMigrationBundle

EffianaMigrationBundle extends DBAL (database abstraction layer) and provides the ability for developers to manage and deploy changes in the application database schema programmatically in a consistent, structured way using Migrations and Fixtures classes.

Database structure migrations

Each bundle can have migration files that allow to update database schema.

Migration files should be located in Migrations\Schema\version_number folder. A version number must be an PHP-standardized version number string, but with some limitations. This string must not contain "." and "+" characters as a version parts separator. More info about PHP-standardized version number string can be found in PHP manual.

Each migration class must implement Migration interface and must implement up method. This method receives a current database structure in schema parameter and queries parameter which can be used to add additional queries.

With schema parameter, you can create or update database structure without fear of compatibility between database engines. If you want to execute additional SQL queries before or after applying a schema modification, you can use queries parameter. This parameter represents a MigrationQuery interface. There are several ready to use implementations of this interface:

If you need to create own implementation of ParametrizedMigrationQuery class as a base class for your migration query.

If you have several migration classes within the same version and you need to make sure that they will be executed in a specified order you can use OrderedMigrationInterface interface.

Example of migration file:

Each bundle can have an installation file as well. This migration file replaces running multiple migration files. Install migration class must implement Installation interface and must implement up and getMigrationVersion methods. The getMigrationVersion method must return max migration version number that this installation file replaces.

During an install process (it means that you installs a system from a scratch), if install migration file was found, it will be loaded first and then migration files with versions greater then a version returned by getMigrationVersion method will be loaded.

For example. We have v1_0, v1_1, v1_2, v1_3 migrations. And additionally, we have install migration class. This class returns v1_2 as a migration version. So, during an install process the install migration file will be loaded and then only v1_3 migration file will be loaded. Migrations from v1_0 to v1_2 will not be loaded.

Example of install migration file:

To run migrations, there is effiana:migration:load command. This command collects migration files from bundles, sorts them by version number and applies changes.

This command supports some additional options:

Also there is effiana:migration:dump command to help in creation installation files. This command outputs current database structure as a plain sql or as Doctrine\DBAL\Schema\Schema queries.

This command supports some additional options:

Good practice for bundle is to have installation file for current version and migration files for migrating from previous versions to current.

Next algorithm may be used for new versions of your bundle:

Extensions for database structure migrations

Sometime you cannot use standard Doctrine methods for database structure modification. For example Schema::renameTable does not work because it drops existing table and then creates a new table. To help you to manage such case and allow to add some useful functionality to any migration a extensions mechanism was designed. The following example shows how RenameExtension can be used:

As you can see to use the RenameExtensionAwareInterface and setRenameExtension method. Also there is some additional useful interfaces you can use in your migration class:

Create own extensions for database structure migrations

To create your own extension you need too do the following simple steps:

If you need an access to the database platform or the name generator you extension class should implement NameGeneratorAwareInterface appropriately. Also if you need to use other extension in your extension the extension class should just implement *AwareInterface of the extension you need.

Data fixtures

Symfony allows to load data using data fixtures. But these fixtures are run each time when doctrine:fixtures:load command is executed.

To avoid loading the same fixture several time, effiana:migration:data:load command was created. This command guarantees that each data fixture will be loaded only once.

This command supports two types of migration files: main data fixtures and demo data fixtures. During an installation, user can select to load or not demo data.

Data fixtures for this command should be put in Migrations/Data/ORM or in Migrations/Data/Demo/ORM directory.

Fixtures order can be changed with standard Doctrine ordering or dependency functionality. More information about fixture ordering can be found in doctrine data fixtures manual.

Versioned fixtures

There are fixtures which need to be executed time after time. An example is a fixture which uploads countries data. Usually, if you add new countries list, you need to create new data fixture which will upload this data. To avoid this you can use versioned data fixtures.

To make fixture versioned, this fixture must implement VersionedFixtureInterface and getVersion method which returns a version of fixture data.

Example:

In this example, if the fixture was not loaded yet, it will be loaded and version 1.0 will be saved as current loaded version of this fixture.

To have possibility to load this fixture again, the fixture must return a version greater then 1.0, for example 1.0.1 or 1.1. A version number must be an PHP-standardized version number string. More info about PHP-standardized version number string can be found in PHP manual.

If a fixture need to know the last loaded version, it must implement LoadedFixtureVersionAwareInterface and setLoadedVersion method:


All versions of migration-bundle with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2 | ^7.4 | ^8.0
doctrine/common Version ^2.10 | ^3
doctrine/data-fixtures Version ^1.4
doctrine/dbal Version ^2 | ^3
doctrine/doctrine-bundle Version ^2 | ^3
doctrine/orm Version ^2 | dev-2.8.x-dev
psr/container Version ^1.0
symfony/config Version ^4.3 | ^5
symfony/console Version ^4.3 | ^5
symfony/dependency-injection Version ^4.3 | ^5
symfony/event-dispatcher Version ^4.3 | ^5
symfony/finder Version ^4.3 | ^5
symfony/framework-bundle Version ^4.2 | ^5
symfony/http-kernel Version ^4.3 | ^5
twig/twig Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package effiana/migration-bundle contains the following files

Loading the files please wait ....