PHP code example of dtforce / fornettey-doctrine-migrations

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

    

dtforce / fornettey-doctrine-migrations example snippets


namespace Migrations;

use Doctrine\DBAL\Migrations\AbstractMigration;
use Doctrine\DBAL\Schema\Schema;


/**
 * New role "superadmin" added.
 */
final class Version20151015000003 extends AbstractMigration
{

	/**
	 * {@inheritdoc}
	 */
	public function up(Schema $schema)
	{
		$this->addSql("INSERT INTO 'user_role' (id, value, name) VALUES (3, 'superadmin', 'Super Admin')");
	}
	

	/**
	 * {@inheritdoc}
	 */
	public function down(Schema $schema)
	{
		$this->addSql("DELETE FROM 'user_role' WHERE ('id' = 3);");
	}

}

namespace Migrations;


final class Version20140801152432 extends AbstractMigration
{

	/**
	 * @inject
	 * @var Doctrine\ORM\EntityManagerInterface
	 */
	public $entityManager;


	public function up(Schema $schema)
	{
		// ...
	}

	// ...

}

 /migrations/
    - VersionZZZ.php
 /migrations/2015/
    - VersionYYY.php
 /migrations/basic-data
    - VersionXXXX.php