PHP code example of studioemma / migrations

1. Go to this page and download the library: Download studioemma/migrations library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

studioemma / migrations example snippets



use Migrations\Migration\AbstractMigration;

class PMigration_FirstMigration extends AbstractMigration
{
    public function up()
    {
        // do something
    }

    public function down()
    {
        // do the reverse
    }


use Migrations\Migration\AbstractMigration;

class PMigration_PimcoreRevision3689 extends AbstractMigration
    implements \Migrations\SystemMigration
{
    public function getStartRevision()
    {
        return 3675;
    }

    public function getEndRevision()
    {
        return 3689;
    }

    public function up()
    {
        $this->db->query("ALTER TABLE `classificationstore_relations` ADD INDEX `groupId` (`groupId`);");

        $this->db->query("ALTER TABLE `classificationstore_collectionrelations` ADD INDEX `colId` (`colId`);");
    }

    public function down()
    {
        // down will not be executed but must exist
    }