Git Product home page Git Product logo

oxideshop-doctrine-migration-wrapper's Introduction

OXID eShop doctrine migration integration

https://travis-ci.org/OXID-eSales/oxideshop-doctrine-migration-wrapper.svg?branch=master

Document: https://docs.oxid-esales.com/developer/en/6.2/development/modules_components_themes/module/database_migration/index.html

Description

OXID eShop uses database migrations for:

  • eShop editions migration (CE, PE and EE)
  • Project specific migrations
  • Modules migrations

At the moment OXID eShop uses "Doctrine 2 Migrations" and it's integrated via OXID eShop migration components.

Doctrine Migrations runs migrations with a single configuration. But there was a need to run migration for one or all the projects and modules (CE, PE, EE, PR and a specific module). For this reason Doctrine Migration Wrapper was created.

Running migrations - CLI

Script to run migrations is installed within composer bin directory. It accepts two parameters:

  • Doctrine Command
  • Suite Type (CE, PE, EE, PR or a specific module_id)
vendor/bin/oe-eshop-db_migrate <Doctrine_Command> <Suite_Type>

To get comprehensive information about Doctrine 2 Migrations and available commands as well, please see official documentation.

Example:

vendor/bin/oe-eshop-db_migrate migrations:migrate

This command will run all the migrations which are in OXID eShop specific directories. For example if you have OXID eShop Enterprise edition, migration tool will run migrations in this order:

  • Community Edition migrations (executed always)
  • Professional Edition migrations (executed when eShop has PE or EE)
  • Enterprise Edition migrations (executed when eShop has EE)
  • Project specific migrations (executed always)
  • Module migrations (executed when eShop has at least one module with migration)

Suite Types (Generate migration for a single suite)

It is also possible to run migrations for specific suite by defining <Suite_Type> parameter in the command. This variable defines what type of migration it is. There are 5 suite types:

  • PR - For project specific migrations. It should be always used for project development.
  • CE - Generates migration file for OXID eShop Community Edition. It's used for product development only.
  • PE - Generates migration file for OXID eShop Professional Edition. It's used for product development only.
  • EE - Generates migration file for OXID eShop Enterprise Edition. It's used for product development only.
  • <module_id> - Generates migration file for OXID eShop specific module. It’s used for module development only.

Example 1:

vendor/bin/oe-eshop-db_migrate migrations:generate

This command generates migration versions for all the suite types.

Example 2:

vendor/bin/oe-eshop-db_migrate migrations:generate EE

In this case it will be generated only for Enterprise Edition in vendor/oxid-esales/oxideshop_ee/migration directory.

Use Migrations Wrapper without CLI

Doctrine Migration Wrapper is written in PHP and also could be used without command line interface. To do so:

  • Create Migrations object with MigrationsBuilder->build()
  • Call execute method with needed parameters

Installation

Development installation

Note

The following commands have to be executed in the php-container of your already installed eshop.

Register and update the migration wrapper repository with your branch in the composer.json of the eshop

composer config repositories.oxid-esales/oxideshop-doctrine-migration-wrapper git https://github.com/OXID-eSales/oxideshop-doctrine-migration-wrapper
composer require oxid-esales/oxideshop-doctrine-migration-wrapper:dev-b-6.4.x

Setup ce-shop for wrapper

cd vendor/oxid-esales/oxideshop-doctrine-migration-wrapper/
git clone --branch=b-6.4.x https://github.com/OXID-eSales/oxideshop_ce.git source_ce
composer config repositories.oxid-esales/oxideshop-ce path source_ce/
cd source_ce
composer require --no-update oxid-esales/oxideshop-doctrine-migration-wrapper:*
cd ..

Adjust cloned shop component requirements to fit our wrapper version and install wrapper development dependencies with --no-plugins

composer require --dev --no-plugins oxid-esales/oxideshop-ce:*
cp tests/testData/source/config.inc.php.dist tests/testData/source/config.inc.php

Adjust MySQL credentials in the tests specific config.inc.php to use an empty or non existing Database. The config.inc.php could look like this:

<?php

/**
 * Copyright © OXID eSales AG. All rights reserved.
 * See LICENSE file for license details.
 */

// Database connection information
$this->dbType = 'pdo_mysql';
$this->dbHost = 'mysql'; // database host name
$this->dbPort = '3306'; // database port
$this->dbName = 'example2'; // database name
$this->dbUser = 'root'; // database user name
$this->dbPwd = 'root'; // database user password

Now, while being in the wrapper directory, its possible to run the tests for wrapper

./vendor/bin/phpunit tests/

Note

Tests doesn't destroy your current shop installation if configured correctly (to use different database)!

Note

If you want to use the CLI in the eShop, you have to rename the vendor folder. Otherwise the CLI doesn't work.

Bugs and Issues

If you experience any bugs or issues, please report them in the section OXID eShop (all versions) of https://bugs.oxid-esales.com.

oxideshop-doctrine-migration-wrapper's People

Contributors

a-afsharfarnia avatar alfonsmartin avatar cenarius-io avatar godefroy-le-hardi avatar hkreuter avatar ivoba avatar kaluzki avatar leofonic avatar liulka-oxid avatar mantasvaitkunas avatar marceloxid avatar mohannadalturk avatar rezonanc-oxid avatar robertblank avatar sauliusstasiukaitis avatar sebbbbauer avatar sieg avatar tarique-iqbal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.