Giter Site home page Giter Site logo

doctrine / doctrinemigrationsbundle Goto Github PK

View Code? Open in Web Editor NEW
4.2K 26.0 213.0 701 KB

Symfony integration for the doctrine/migrations library

License: MIT License

PHP 84.99% Twig 15.01%
php symfony-bundle bundle symfony doctrine doctrine-migrations

doctrinemigrationsbundle's Introduction

doctrinemigrationsbundle's People

Contributors

alcaeus avatar andrew-demb avatar beberlei avatar carusogabriel avatar chr-hertel avatar craigmarvelley avatar dant89 avatar derrabus avatar fabpot avatar gajdaw avatar goetas avatar greg0ire avatar guilhermeblanco avatar javiereguiluz avatar jwage avatar lcobucci avatar lsmith77 avatar lucchese avatar mikesimonson avatar nicolas-grekas avatar odino avatar peter-gribanov avatar peterrehm avatar petk avatar pyatnitsev avatar senseexception avatar stof avatar vicb avatar weaverryan avatar xabbuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

doctrinemigrationsbundle's Issues

Namespace is wrong

Solved

Composer is instaling the bundle to this path: vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/DoctrineMigrationsBundle/

But in that file, I see this namespace: namespace Doctrine\Bundle\MigrationsBundle;

So when I add this to AppKernel.php in Symfony2.3: new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),

And run this: $ app/console, I get this: PHP Fatal error: Class 'Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle' not found in /srv/www/dev/public/pixfeed/app/AppKernel.php on line 24

I don't know if it matters, but I had to install it by adding this to composer.json, because there is no stable release or something:

        "doctrine/migrations": "dev-master",
        "doctrine/doctrine-migrations-bundle": "dev-master",

migrations directory not getting changed

If i give configuration file path in the command, and give the migrations directory in that file, its not getting changed.

steps:
created a file : migrations.yml
and typed:
migrations_dir: /path/to/migrations

and given its path in doctrine:migrations:status --configuration="/path/to/migrations.yml"

now, the path given in migrations.yml is not used for generating migration scripts [version*]


The problem is in /DoctrineMigrationsBundle/Command/DoctrineCommand.php

$dir = $container->getParameter('doctrine_migrations.dir_name');
$configuration->setMigrationsDirectory($dir);

The above setting gives problem when we pass the configuration in command line arguments such as:

php console doctrine:migrations:status --configuration=/path/to/configuration.yml

the configuration path is overwritten by above mentioned lines.

Doctrine\ORM\Mapping\Column class dont have 'default' property

it is expected to be here as it could be used in doctrine migration.
Other parts already implemented: in Doctrine\ORM\Tools\ShemaTool::_gatherColumn it is fetch from metadata and in Doctrine\DBAL\Schema\Comparator::diffColumn it is already checking if it is the same

Migration class is empty, but still it tries to remove foreign keys

I can't get rid of some random sql queries in my migration class. I tried to recreate migration class, but still those sql queries will appear.

This is how my migration look like (just created with doctrine:migrations:generate):

<?php

namespace Application\Migrations;

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

/**
 * Auto-generated Migration: Please modify to your needs!
 */
class Version20140325125839 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");
    }

    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'.");

    }
}

And this is what doctrine:migrations:status returns

== Configuration

    >> Name:                                               Application Migrations
    >> Database Driver:                                    pdo_mysql
    >> Database Name:                                      database_name
    >> Configuration Source:                               manually configured
    >> Version Table Name:                                 migration_versions
    >> Migrations Namespace:                               Application\Migrations
    >> Migrations Directory:                               /var/www/symfony/app/DoctrineMigrations
    >> Current Version:                                    2014-03-25 12:30:12 (20140325123012)
    >> Latest Version:                                     2014-03-25 12:58:39 (20140325125839)
    >> Executed Migrations:                                1
    >> Executed Unavailable Migrations:                    0
    >> Available Migrations:                               2
    >> New Migrations:                                     1

And when I use doctrine:migrations:migrate --dry-run (or without flag --dry-run)

 ++ migrating 20140325125839

     -> ALTER TABLE appointments DROP FOREIGN KEY fk_account_idx
     -> ALTER TABLE appointments DROP FOREIGN KEY fk_appointments_in_wage
     -> ALTER TABLE appointments DROP FOREIGN KEY fk_customer_charge
     -> ALTER TABLE customer_recipients DROP FOREIGN KEY FK_E9AF36469395C3F3
     -> ALTER TABLE customer_recipients DROP FOREIGN KEY fk_user_idx
     -> ALTER TABLE customers DROP FOREIGN KEY fk_company
     -> ALTER TABLE prescriptions DROP FOREIGN KEY fk_prescriptions_customer
     -> ALTER TABLE prescriptions DROP FOREIGN KEY fk_prescriptions_user
     -> ALTER TABLE statements DROP FOREIGN KEY fk_statements_in_wage

Any ideas? I have reinstalled vendors and cleared caches but still can't get it working. And if I try make new migration class, it will still appear.

Member properties of parameter $configuration of class Configuraiton are overwritten in method configureMigrations in class DoctrineCommand

If one explicitly uses the command line option --configuration along the doctrine:migrations:generate or doctrine:migrations:migrate commands to set a separate configuration file (e.g. a yaml-file with entries: name, migrations_namespace, table_name, migrations_directory), then it is correctly loaded by method load of class AbstractFileConfiguration and in turn read e.g. by the method doLoad of class YamlConfiguration from the yaml-file.

In method configureMigrations(ContainerInterface $container, Configuration $configuration) in class DoctrineCommand, however, these loaded configuration setting stored in the member properties of the parameter $configuration of class Configuration are set anew with the configuration settings in the app/config/config.yml file (with entries: dir_name, namespace, name, table_name).

The overwriting happens because there is no check whether the parameter $configuration already has set the member properties with a separate configuration file.

To me this appears to be a false implementation and should be fixed.

My personal fix, which is not very nice, but works fine for me, is the following (see image in attachments):

public static function configureMigrations(ContainerInterface $container, Configuration $configuration)
{
if ($configuration->getMigrationsDirectory() == null) {
$dir = $container->getParameter('doctrine_migrations.dir_name');
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
$configuration->setMigrationsNamespace($container->getParameter('doctrine_migrations.namespace'));
$configuration->setMigrationsDirectory($dir);
$configuration->registerMigrationsFromDirectory($dir);
$configuration->setName($container->getParameter('doctrine_migrations.name'));
$configuration->setMigrationsTableName($container->getParameter('doctrine_migrations.table_name'));
} else {
$dir = str_replace('%kernel.root_dir%', $container->getParameter('kernel.root_dir'), $configuration->getMigrationsDirectory());
$configuration->setMigrationsDirectory($dir);
$configuration->registerMigrationsFromDirectory($dir);
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
}
}
self::injectContainerToMigrations($container, $configuration->getMigrations());
}

classdoctrinecommand

Problems installing the bundle

Hello,

I'm having trouble installing the migrations bundle (some weeks ago it worked like a charm). I think it corresponds with the changed namespace/git url. (Symfony 2.0.12)

php bin/vendors install --reinstall gives me:

fatal: ambiguous argument '2.0': unknown revision or path not in the working tree.

origin/2.0 gives me the same message.

Any help would be great. Thanks!!

deps:

[DoctrineMigrationsBundle]
git=http://github.com/doctrine/DoctrineMigrationsBundle.git
target=/bundles/Symfony/Bundle/DoctrineMigrationsBundle
version=2.0

AppKernel.php:

new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(),
new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
new Wuw\SearchBundle\WuwSearchBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new Bazinga\ExposeTranslationBundle\BazingaExposeTranslationBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new Sonata\UserBundle\SonataUserBundle(),
new FOS\UserBundle\FOSUserBundle(),
new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\CacheBundle\SonataCacheBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),

autoload.php:

'Symfony' => array(DIR.'/../vendor/symfony/src', DIR.'/../vendor/bundles'),
'Sensio' => DIR.'/../vendor/bundles',
'JMS' => DIR.'/../vendor/bundles',
'Doctrine\Common' => DIR.'/../vendor/doctrine-common/lib',
'Doctrine\DBAL' => DIR.'/../vendor/doctrine-dbal/lib',
'Doctrine' => DIR.'/../vendor/doctrine/lib',
'Monolog' => DIR.'/../vendor/monolog/src',
'Assetic' => DIR.'/../vendor/assetic/src',
'Metadata' => DIR.'/../vendor/metadata/src',
'Doctrine\DBAL\Migrations' => DIR.'/../vendor/doctrine-migrations/lib',
'Doctrine\DBAL' => DIR.'/../vendor/doctrine-dbal/lib',
'FOS' => DIR.'/../vendor/bundles',
'Bazinga' => DIR.'/../vendor/bundles',
'Sonata' => DIR.'/../vendor/bundles',
'Exporter' => DIR.'/../vendor/exporter/lib',
'Knp\Bundle' => DIR.'/../vendor/bundles',
'Knp\Menu' => DIR.'/../vendor/knp/menu/src',

LatestCommand Issue

Since this commit - bf9bcb3

I now get this error:-

PHP Fatal error: Class 'Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand' not found in /...../vendor/doctrine/doctrine-migrations-bundle/Doctrine/Bundle/MigrationsBundle/Command/MigrationsLatestDoctrineCommand.php on line 30

Is there a dependancy required to make sure Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand exists?

add new doctrine repo

Problem 1
- Installation request for doctrine/doctrine-migrations-bundle dev-master -> satisfiable by doctrine/doctrine-migrations-bundle dev-master.
- doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations * -> no matching package found.

can you please fix the correct path?

Cannot install DoctrineMigrationsBundle into Symfony 2.3.0 via Composer

Symfony Documentation recommends installation using dev-master, but current "minimum-stability": "stable" disallows installing DoctrineMigrationsBundle from dev-master:

php composer.phar require "doctrine/doctrine-migrations-bundle=dev-master"
composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for doctrine/doctrine-migrations-bundle dev-master -> satisfiable by doctrine/doctrine-migrations-bundle[dev-master].
    - doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations * -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting composer.json to its original content.

If php composer.phar require "doctrine/doctrine-migrations-bundle=@dev" is used instead then version doctrine/doctrine-migrations-bundle (v1.0.0-beta1) is installed instead.

Is there ability to keep "minimum-stability": "stable", but install the latest doctrine/doctrine-migrations-bundle?

DoctrineMigrationsBundle for Symfony 2.0.17?

I was on Symfony 2.0.17, and install DoctrineMigrationsBundle as suggested by the Symfony page, However, when I ran doctrine:migrations:diff, an erroe message occured:

Fatal error: Call to undefined method Doctrine\DBAL\Configuration::getFilterSchemaAssetsExpression() in /Applications/MAMP/htdocs/oopsFrogs/vendor/doctrine-migrations/lib/Doctrine/DBAL/Migrations/Tools/Console/Command/DiffCommand.php on line 85

It seems that the getFilterSchemaAssesExpression() function appeared in the 2.2.1? version of Doctrine\DBAL but Symfony 2.0.17 used Doctrine\DBAL 2.1.7.

So is it a discrepancy amoung DoctrineMigrationsBuncle origin/2.0 and Symfony2.0.17, can somebody tell me how to fix it? Thanks a lot!

using date() for migration numbers can cause problems across timezones; use gmdate() instead?

at work, we FINALLY moved to using migrations, instead of relying on schema:update... but then a co-worker noticed something: shorty after checking out and making a new migration, he noticed his migration was numbered BEFORE mine. the reason: he works from CA, and I work from VA.

the possibility of collision does seem small: two people, within a 3 hour window, would need to write two migrations that operate on the same table, or even row of table... but we have a fear: that as developers, keeping in pretty regular sync, we would not encounter any errors, but then at deploy time, something might go wrong.

the solution was fortunately simple: we wrote a custom class to override the doctrine:migrations:diff command and use gmdate() to generate the version number, instead of date(), but it did make us wonder: "shouldn't this be how the DoctrineMigrationsBundle operates by default?"

Migrations don't keep track of the entity manager they were created with

The problem arises when an application deals with two (or more) databases with different schemas.

If you run doctrine:migrations:diff --em=db1 and then doctrine:migrations:migrate --em=db2 the migrations generated from db1 will be ran on db2.

I don't think this is intended behaviour?
Of course you can manually modify the migrations and put $this->skipIf($this->connection->getDatabase() !== 'db1') at the moment but not the best way i think :).

[critical] Budle installs in wrong way

Installed bundle has four additional spaces in name:
[Bundle]$ cd DoctrineMigrationsBundle\ \ \ \ /

This causes fatal error when loading application, at least on Mac.

stable release

Please consider creating a tag for a stable release version.

app/console doctrine:migrations:migrate fails on no migrations

We are using :migrate in a deploy script, and after a transition to a new project structure all of the existing migrations have been deleted.

Problem: app/console doctrine:migrations:migrate fails with an exit code 4 when there are no migrations.

A solve could be either a command line switch --skip-on-zero or similar, or maybe just exit with 0 in this case. I'm uncertain on wether or not this should be the case. On one hand, if a migrate command has been called with no migrations, this is an error case. On the other hand, if there is simply nothing to do, just do nothing.

Multiple entity managers support

How can we have DoctrineMigrations specific to Entity Manager i.e.

      default:
            connection:                   default
            mappings:
                NamshiSharedEntityBundle: ~
        auth:
            connection:                   default
            mappings:
                NamshiJerryBundle:        ~

But when we generate diff it doesn't takes into account of 2nd bundle and drops all entities other than mappings of 'default'. If we generate EM specific diff i.e.
migrations:diff --em=auth
It excludes default entities and create migration to drop all entities related to default entities .

To overcome this, We duplicate mapping in default i.e.

        default:
            connection:                   default
            mappings:
                NamshiSharedEntityBundle: ~
                NamshiJerryBundle:        ~
        auth:
            connection:                   default
            mappings:
                NamshiJerryBundle:        ~

Now Migration diff works fine but it throws error for ManytoOne association i.e.

  • @Orm\ManyToOne(targetEntity="Language")
    • @Orm\JoinColumns({
    • @Orm\JoinColumn(name="fk_language", referencedColumnName="id_language")
    • })
      *

error is;

"A new entity was found through the relationship 'Namshi\JerryBundle\Entity\Customer#fkLanguage' that was not configured to cascade persist operations for entity: Namshi\JerryBundle\Entity\Language@000000006b1673b00000000011509915. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @manytoone(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Namshi\JerryBundle\Entity\Language#__toString()' to get a clue."

It works fine if we don't duplicate mapping in default manager as in first case.

get connection name in migration file

we have to use different databases for some entities, depending on some factors. and to not migrate some entities to some databases, we use the following (manually added) in the migration files:

$this->skipIf($this->connection->getDatabase() != "foobar");

but this is suboptiomal as that "foobar" is defined in parameters.yml, that the user is supposed to create (like on local devel system).

what would be nicer if we could do:

$this->skipIf($this->connection->getName() != "barfoo");

where "barfoo" is defined in config.yml, that user is not supposed to edit, like:

doctrine:
    dbal:
        default_connection: default
        connections:
            default:
                dbname: "%database_name%"
                ...
            barfoo:
                dbname: "%database_name%_barfoo"
                ...

was not sure if i should report this to "dbal" or "migrations" repo, so i reported it to the closest from user perspective.

ps. or if there is an easier way to define "this entity should go only to these connections" or "this entity should never go to these connections", i would love to hear about that!

Charset on create mysql table

Charset in configs set in UTF-8, but doctrine:migrations:diff generate code
") ENGINE = InnoDB" and table charset set to default "CHARSET=latin1"

Support for Symfony > 2.1

Is there any intent to update this for symfony releases > than 2.1?

For instance 2.3 is the latest LTS release, and the next LTS release (2.7) is on its way shortly.

A lot of Doctrine migrations generated in the same minute (not by me I think...)

Look at this list of migrations below. As you can see there is a "strange" list of migrations files generated in the same minute. Someone with the same problem, or maybe was my fault (doubtly) ?

-rw-rw-r-- 1 tirengarfio tirengarfio 1041 dic 29 15:26 Version20141229152659.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1041 dic 29 15:27 Version20141229152745.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2199 ene  7 09:56 Version20150107095638.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1329 ene  7 12:24 Version20150107122403.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1021 ene  7 23:18 Version20150107231839.php
-rw-rw-r-- 1 tirengarfio tirengarfio  993 ene  8 09:50 Version20150108095038.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1126 ene  8 11:56 Version20150108115621.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1138 ene  9 14:34 Version20150109143423.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1002 ene 12 12:28 Version20150112122809.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2076 ene 13 10:09 Version20150113100908.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1121 ene 13 15:39 Version20150113153943.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1014 ene 13 17:49 Version20150113174920.php
-rw-rw-r-- 1 tirengarfio tirengarfio  986 ene 13 18:13 Version20150113181314.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1075 ene 13 18:18 Version20150113181819.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1087 ene 13 18:32 Version20150113183253.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1083 ene 13 19:29 Version20150113192917.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1051 ene 14 13:10 Version20150114131011.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1041 ene 14 13:45 Version20150114134531.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1123 ene 14 20:53 Version20150114205306.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2101 ene 20 12:11 Version20150120121129.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1293 ene 22 09:55 Version20150122095508.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1418 ene 25 21:56 Version20150125215641.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1167 ene 30 13:43 Version20150130134302.php
-rw-rw-r-- 1 tirengarfio tirengarfio  946 feb  2 11:09 Version20150202110903.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1211 feb  2 21:41 Version20150202214103.php
//they start here
-rw-rw-r-- 1 tirengarfio tirengarfio  962 feb  5 14:36 Version20141229133422.php
-rw-rw-r-- 1 tirengarfio tirengarfio  976 feb  5 14:36 Version20141229132726.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1385 feb  5 14:36 Version20141229003212.php
-rw-rw-r-- 1 tirengarfio tirengarfio  955 feb  5 14:36 Version20141227180412.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1066 feb  5 14:36 Version20141227145451.php
-rw-rw-r-- 1 tirengarfio tirengarfio  993 feb  5 14:36 Version20141227130659.php
-rw-rw-r-- 1 tirengarfio tirengarfio  969 feb  5 14:36 Version20141227115351.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1111 feb  5 14:36 Version20141227110224.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1111 feb  5 14:36 Version20141227102820.php
-rw-rw-r-- 1 tirengarfio tirengarfio  952 feb  5 14:36 Version20141227100541.php
-rw-rw-r-- 1 tirengarfio tirengarfio  952 feb  5 14:36 Version20141227100508.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1077 feb  5 14:36 Version20141226140725.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1117 feb  5 14:36 Version20141226125353.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2049 feb  5 14:36 Version20141226125136.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1713 feb  5 14:36 Version20141226123307.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1055 feb  5 14:36 Version20141226121100.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1215 feb  5 14:36 Version20141226113609.php
-rw-rw-r-- 1 tirengarfio tirengarfio  981 feb  5 14:36 Version20141226112140.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1003 feb  5 14:36 Version20141222184836.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1389 feb  5 14:36 Version20141222173619.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1226 feb  5 14:36 Version20141222141702.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2091 feb  5 14:36 Version20141222135002.php
-rw-rw-r-- 1 tirengarfio tirengarfio 2091 feb  5 14:36 Version20141222112216.php
-rw-rw-r-- 1 tirengarfio tirengarfio  972 feb  5 14:36 Version20141219180227.php
-rw-rw-r-- 1 tirengarfio tirengarfio  954 feb  5 14:36 Version20141219175218.php
-rw-rw-r-- 1 tirengarfio tirengarfio 1053 feb  5 14:36 Version20141219174611.php
//they finish here
drwxrwxr-x 7 tirengarfio tirengarfio 4096 feb  5 14:36 ..
-rw-rw-r-- 1 tirengarfio tirengarfio 1071 feb 16 16:01 Version20150216160152.php

Add new tag

Hi,

There are no new tag for this bundle since 1 year.

Can you please add a new tag because for now we have to use "1.0.*@beta"

Best regard.

Migration execution remove foreign keys from nowhere

Same problem as #93.

My last migration class:

/**
 * Add registeredAt and lastActivity on User.
 * Columns rearrangement.
 */
class Version20141122115408 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE fos_user ADD registered_at DATETIME NOT NULL AFTER password, ADD last_activity DATETIME DEFAULT NULL AFTER last_login');
        $this->addSql('ALTER TABLE fos_user CHANGE COLUMN firstname firstname VARCHAR(128) NOT NULL AFTER id;');
        $this->addSql('ALTER TABLE fos_user CHANGE COLUMN lastname lastname VARCHAR(128) NOT NULL AFTER firstname;');
        $this->addSql('UPDATE fos_user SET registered_at = NOW()');
    }

    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE fos_user DROP registered_at, DROP last_activity');
    }
}

My migration status before executing:

 == Configuration

    >> Name:                                               Application Migrations
    >> Database Driver:                                    pdo_mysql
    >> Database Name:                                      ddn_news-connect
    >> Configuration Source:                               manually configured
    >> Version Table Name:                                 migration_versions
    >> Migrations Namespace:                               Application\Migrations
    >> Migrations Directory:                               /home/sullivan/projects/ddn/news-connect/app/DoctrineMSame problem for me:

My last migration class:

/**
 * Add registeredAt and lastActivity on User.
 * Columns rearrangement.
 */
class Version20141122115408 extends AbstractMigration
{
    public function up(Schema $schema)
    {
        // this up() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE fos_user ADD registered_at DATETIME NOT NULL AFTER password, ADD last_activity DATETIME DEFAULT NULL AFTER last_login');
        $this->addSql('ALTER TABLE fos_user CHANGE COLUMN firstname firstname VARCHAR(128) NOT NULL AFTER id;');
        $this->addSql('ALTER TABLE fos_user CHANGE COLUMN lastname lastname VARCHAR(128) NOT NULL AFTER firstname;');
        $this->addSql('UPDATE fos_user SET registered_at = NOW()');
    }

    public function down(Schema $schema)
    {
        // this down() migration is auto-generated, please modify it to your needs
        $this->abortIf($this->connection->getDatabasePlatform()->getName() != 'mysql', 'Migration can only be executed safely on \'mysql\'.');

        $this->addSql('ALTER TABLE fos_user DROP registered_at, DROP last_activity');
    }
}

My migration status before executing:

 == Configuration

    >> Name:                                               Application Migrations
    >> Database Driver:                                    pdo_mysql
    >> Database Name:                                      ddn_news-connect
    >> Configuration Source:                               manually configured
    >> Version Table Name:                                 migration_versions
    >> Migrations Namespace:                               Application\Migrations
    >> Migrations Directory:                               /home/sullivan/projects/ddn/news-connect/app/DoctrineMigrations
    >> Current Version:                                    2014-11-16 22:57:21 (20141116225721)
    >> Latest Version:                                     2014-11-22 11:54:08 (20141122115408)
    >> Executed Migrations:                                19
    >> Executed Unavailable Migrations:                    0
    >> Available Migrations:                               20
    >> New Migrations:                                     1

When I migrate:

Migrating up to 20141122115408 from 20141116225721

  ++ migrating 20141122115408

     -> ALTER TABLE fos_user ADD registered_at DATETIME NOT NULL AFTER password, ADD last_activity DATETIME DEFAULT NULL AFTER last_login
     -> ALTER TABLE fos_user CHANGE COLUMN firstname firstname VARCHAR(128) NOT NULL AFTER id;
     -> ALTER TABLE fos_user CHANGE COLUMN lastname lastname VARCHAR(128) NOT NULL AFTER firstname;
     -> UPDATE fos_user SET registered_at = NOW()
     -> ALTER TABLE access_token DROP FOREIGN KEY FK_B6A2DD6819EB6921
     -> ALTER TABLE access_token DROP FOREIGN KEY FK_B6A2DD68A76ED395
     -> ALTER TABLE auth_code DROP FOREIGN KEY FK_5933D02C19EB6921
     -> ALTER TABLE auth_code DROP FOREIGN KEY FK_5933D02CA76ED395
     -> ALTER TABLE invoice DROP FOREIGN KEY FK_906517449395C3F3
     -> ALTER TABLE invoice_element DROP FOREIGN KEY FK_B39968EA2989F1FD
     -> ALTER TABLE payment_method DROP FOREIGN KEY FK_7B61A1F6A76ED395
     -> ALTER TABLE plan DROP FOREIGN KEY FK_DD5A5B7D3506A35B
     -> ALTER TABLE plan DROP FOREIGN KEY FK_DD5A5B7D9393F8FE
     -> ALTER TABLE refresh_token DROP FOREIGN KEY FK_C74F219519EB6921
     -> ALTER TABLE refresh_token DROP FOREIGN KEY FK_C74F2195A76ED395
     -> ALTER TABLE subscription DROP FOREIGN KEY FK_A3C664D3A76ED395
     -> ALTER TABLE subscription_plan DROP FOREIGN KEY FK_EA664B639A1887DC
     -> ALTER TABLE subscription_plan DROP FOREIGN KEY FK_EA664B63E899029B
     -> ALTER TABLE tax_value DROP FOREIGN KEY FK_AE0DAD153506A35B
     -> ALTER TABLE transaction DROP FOREIGN KEY FK_723705D12989F1FD
     -> ALTER TABLE transaction DROP FOREIGN KEY FK_723705D1A76ED395

  ++ migrated (0.78s)

  ------------------------

  ++ finished in 0.78
  ++ 1 migrations executed
  ++ 21 sql queries

And the must weird is I can see another foreign key name like access_token_ibfk_1 on my database. But I can't find it out on my migrations classes...

Any idea?

symfony/symfony: v2.6.0-BETA1
doctrine/orm: v2.4.6
doctrine/doctrine-bundle: v1.2.0
doctrine/migrations: dev-master/f4fe9d9cc21a711d89d91d29c4a4e7945289cdd0
doctrine/doctrine-migrations-bundle: dev-master/81575a4316951125ce408c70f30547c77d98f78a

Thanks.

Include notification of unexecuted migrations when a database exception occurs

Something rails does is notify you when you have un-executed migrations. It might be nice to catch doctrine exceptions that might be due to this (or perhaps all doctrine exceptions) and add a note about executing migrations (if there are non-executed migrations). This would just be a helpful reminder to devs when they see an obscure SQL error about a missing db field to run migrations. Is there a way this bundle could hook into doctrine exceptions in the symfony debug component if it was installed so it could provide more information such as the suggestion to execute migrations?

Fatal error

Hello.
Can't find how to overcome this error:

Fatal error: Class 'Symfony\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper' not found in /var/www/solid/vendor/symfony/src/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.php on line 41

Could someone help me, please?

Migration fails due wrong sort index

To reproduce the issue:
Create one migration version with numeric and the 17 versions with alphanumeric names for example:

Version1.php
Version2_a.php
Version3_b.php
...
Version9_a.php
VersionA_f.php

start migration.
Add a new migration with VersionX_x.php and start migration again. The migration command starts a rollback to Version1.php.
The problem is in file:
/var/www/projects/hcontent/vendor/doctrine/migrations/lib/Doctrine/DBAL/Migrations/Configuration/Configuration.php is the ksort function in method registerMigration. The ksort seems to handle the value "1" from Version1 as a numeric value and put it to the end of the sorted array. The solution of the problem is to add the optional parameter SORT_STRING to the ksort function.

Wrap migration in a transaction?

Is there any reason why migrations (up, down) aren't wrapped in a transaction by default? This would seem like a nice feature to have.

Multiple entity managers support

Inside our ERP system we have calls to multiple database storages. To use them with Symfony2, we've defined them as different connections each one attached to a different entity manager.

If we make some change to the database structure there is no way to specify on which entity manager this change is going to be performed.

This can be controlled via the command line, but doing so is not reliable, unless we cherry-pick the doctrine migrations on deployment and specify different "--em" argument depending on the current migration.

Symfony2 doctrine:migrations:diff always generates update when using enum

I am trying to use enum type field (defined as string in config) but doctrine:migrations:diff is always generating update with enum values.

Entity field configured via annotations:

* @ORM\Column(type="string", columnDefinition="ENUM('bottom', 'top', 'left', 'right')")

Generated migration file:

$this->addSql("ALTER TABLE JoyrideSetting CHANGE position position ENUM('bottom', 'top', 'left', 'right')");

So now I have to choose if I want: 1) use enum and don't use migrations, 2) use enum but every time delete lines from migration script (what if I had 100 enum fields?) 3) do not use enum

But I would definitely want to use both.

Use Schema methods instead of SQL

I've noticed the generated migrations are using SQL instead of the Schema class methods. I think the most logic thing to do is to use those methods. Right now it generates a SQL command for the RDBM in use (in my case, mysql), but if i want to change to Postgres for example, i have to rebuild all my migrations.

[2.0] Bad namespaces

Hi,

If we are using the MigrationsBundle with Symfony 2.0, having the DoctrineBundle into the Symfony namespace rather than Doctrine, the 2.0 branch is not compatible... It is indeed calling Doctrine\Bundle\DoctrineBundle\, instead of expected Symfony\Bundle\DoctrineBundle (as of 2.0).

Cheers.

continuing issue no. 7

yes. configuration is done through config.yml files, but there is an option to provide configuration at runtime in the command.
which is not working properly, and the issue is for that.

Composer.json problem

Your requirements could not be resolved to an installable set of packages.

Problem 1
- doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations ~1.0@dev -> satisfiable by doctrine/migrations[1.0.x-dev].
- doctrine/doctrine-migrations-bundle dev-master requires doctrine/migrations ~1.0@dev -> satisfiable by doctrine/migrations[1.0.x-dev].
- Removal request for doctrine/migrations == 1.0.9999999.9999999-dev
- Installation request for doctrine/doctrine-migrations-bundle dev-master -> satisfiable by doctrine/doctrine-migrations-bundle[dev-master].

I have this problem since I upgraded to Sf2.4.2
https://gist.github.com/grifx/8994701

I have to put :
"minimum-stability": "dev",
for the bundle to work.

bad casing of table name when creating the down migration

In my orm file I use the 'table' key to specify an all lowercase name of the table.

But when the migration is created, the expressions in the down migration are camel cased (like the entity name). In the up migration the name (and the casing) is correct.

Release of 1.0.0

A quick update for everyone (after a quick discussion with @beberlei),

I'm going to take care of this bundle as long as it will live :) since there are plans to switch over other tools with a bit more stability and maturity.

In the next weeks we will be releasing some updates in order to reach a 1.0.0: you already have a second beta version (1.0.0-BETA2).

If no major bug is open over the next weeks we shall see a stable release and, subsequently, will discuss merging new features and PRs -- unfortunately there are no tests at the moment so it might be that things go into master just to be tested by whoever wants to take the risk of a dev-master :)

Any feedback is appreciated!

namespace not found

i have followed the installation instruction , and the installation goes successed
i use symfony 2.1.7

Loading composer repositories with package information
Updating dependencies

  • Installing doctrine/migrations (dev-master e1f6efc)
    Cloning e1f6efcd94993b493de5c6a413cbc327ea9c0caa
  • Installing doctrine/doctrine-migrations-bundle (dev-master 99c0192)
    Cloning 99c0192

but , after that...
if i run the commandline
php app/console doctrine:migrations

there are any error message like this
Fatal error: Class 'Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle' n
ot found in F:\XXX\AppName\app\AppKernel.php on line 24

and on the line 24 is

new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),

how can i fix that?
Thanks
Best Regard

Hendar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.