PHP code example of nsedenkov / sprint.migration

1. Go to this page and download the library: Download nsedenkov/sprint.migration 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/ */

    

nsedenkov / sprint.migration example snippets


#!/usr/bin/env php




namespace Sprint\Migration;

class Version20150520000001 extends Version {

    protected $description = "";

    public function up(){
        //
    }

    public function down(){
        //
    }
}

 return array (
  'title' => '',
  'migration_dir' => '',
  'migration_table' => '',
  'migration_extend_class' => '',
  'version_prefix' => '',
  'tracker_task_url' => '',
  'stop_on_errors' => false,
  'show_admin_interface' => true,
  'console_user' => 'admin',
  'version_builders' => array(),
  'version_filter' => array(),
);



$config = [
    'migration_dir' => '/migrations/',
];

if (\MyProject::IsDev()){
    $config['version_filter'] = [
        'env' => 'dev',
    ];
}

return $config;




namespace Sprint\Migration;


class Version20171219185225 extends Version
{

    protected $description = "";

    protected $versionFilter = [
        'env' => 'dev',
    ];

}




namespace Sprint\Migration;

class Version20171219185225 extends Version
{

    protected $description = "";

    public function isVersionEnabled()
    {
        return false;
    }

}


 return array (
  'version_builders' => array(
    'MyVersion' => '\MyNamespace\MyVersion',
  ),
);

 return array (
	'migration_extend_class' => '\Acme\MyVersion',
    //'migration_extend_class' => '\Acme\MyVersion as MyVersion',
);


namespace Acme;
use \Sprint\Migration\Version;

class MyVersion extends Version
{
    // ваш код
}



namespace Sprint\Migration;
use \Acme\MyVersion as MyVersion;

class Version20151113185212 extends MyVersion {

    protected $description = "";

    public function up(){
        //
    }

    public function down(){
        //
    }

}