PHP code example of phphleb / migration

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

    

phphleb / migration example snippets




class Migration_XXX_example_name extends \Phphleb\Migration\Src\StandardMigration
{
   public function up(PDO $db)
   {
      $this->addSql("CREATE TABLE table_name (cell_id int)");
   }

   public function down()
   {
      $this->addSql("DROP TABLE table_name");
   }

}



use Hleb\Static\DB;
use Phphleb\Migration\Src\Migration;

(new Migration(DB::getPdoInstance(), 'migrations', '/path/to/migrations/'))->run();

bash
php console phphleb/migration add
bash
php console migration/rollback 2
bash
composer update phphleb/migration

php console phphleb/migration add

composer dump-autoload