Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public function registerBundles()
new AppBundle\AppBundle(),
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), // used for initial population of non-SQLite databases in production envs
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
];

// Some bundles are only used while developing the application or during
Expand Down
45 changes: 45 additions & 0 deletions app/DoctrineMigrations/Version20170321115347.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Application\Migrations;

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

/**
* Example of a database migration using the DoctrineMigrationsBundle.
* Here we add a new column to the symfony_demo_user table to match the fullName User property.
* Note that this migration has already been applied, use `php bin/console doctrine:migrations:status`
* to see this by yourself.
*
* @see http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
*
* @author Arnaud PETITPAS <[email protected]>
*/
class Version20170321115347 extends AbstractMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('ALTER TABLE symfony_demo_user ADD fullName VARCHAR(255) NOT NULL DEFAULT "Unknown"');
$this->addSql('UPDATE symfony_demo_user SET fullName = username');
}

/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('ALTER TABLE symfony_demo_user DROP fullName');
}
}
8 changes: 8 additions & 0 deletions app/config/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,11 @@ swiftmailer:
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }

# Doctrine Migrations Configuration (used to apply migrations to databases)
# http://symfony.com/doc/master/bundles/DoctrineMigrationsBundle/index.html
doctrine_migrations:
dir_name: "%kernel.root_dir%/DoctrineMigrations"
namespace: Application\Migrations
table_name: migration_versions
name: Application Migrations
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"doctrine/doctrine-bundle" : "^1.6",
"doctrine/doctrine-cache-bundle" : "^1.2",
"doctrine/doctrine-fixtures-bundle" : "^2.2",
"doctrine/doctrine-migrations-bundle" : "^1.0",
"doctrine/orm" : "^2.5",
"erusev/parsedown" : "^1.5",
"ezyang/htmlpurifier" : "^4.7",
Expand Down
Loading