From 4200361bc3e4ae68f4c8e9ea805f2748376897cd Mon Sep 17 00:00:00 2001 From: Eduardo Santos Date: Wed, 23 Apr 2014 02:51:36 -0300 Subject: [PATCH] Pequena atualização para corrigir o upgrade. --- app/AppKernel.php | 3 ++- app/config/config.yml | 6 ++++++ composer.json | 4 +++- composer.lock | 330 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------- src/Cacic/CommonBundle/DoctrineMigrations/Version20140422230625.php | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 387 insertions(+), 97 deletions(-) create mode 100644 src/Cacic/CommonBundle/DoctrineMigrations/Version20140422230625.php create mode 100644 src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql diff --git a/app/AppKernel.php b/app/AppKernel.php index ff92ffb..4572cda 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -30,7 +30,8 @@ class AppKernel extends Kernel new FM\ElfinderBundle\FMElfinderBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Swpb\Bundle\CocarBundle\CocarBundle(), - new Ddeboer\DataImportBundle\DdeboerDataImportBundle() + new Ddeboer\DataImportBundle\DdeboerDataImportBundle(), + new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), ); if (in_array($this->getEnvironment(), array('dev', 'test'))) { diff --git a/app/config/config.yml b/app/config/config.yml index 5faead9..eade0e4 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -161,6 +161,12 @@ jms_translation: excluded_dirs: [Common, Entity, Form] #extractors: [alias_of_the_extractor] +doctrine_migrations: + dir_name: %kernel.root_dir%/../src/Cacic/CommonBundle/DoctrineMigrations + namespace: Cacic\CommonBundle\Migrations + table_name: migration_versions + name: Cacic Migrations + services: twig.text_extension: class: Twig_Extensions_Extension_Text diff --git a/composer.json b/composer.json index b9fb427..59efd43 100644 --- a/composer.json +++ b/composer.json @@ -57,7 +57,9 @@ "jms/serializer-bundle": "0.13.*@dev", "lightbase/cocar": "dev-master", "ddeboer/data-import-bundle": "dev-master", - "twbs/bootstrap": "3.0.*" + "twbs/bootstrap": "3.0.*", + "doctrine/migrations": "dev-master", + "doctrine/doctrine-migrations-bundle": "dev-master" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index 7fb915d..ab4b2a8 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "2374f22cb735f9931567e2668cf40380", + "hash": "2fe980152192889d593d2faedb57d239", "packages": [ { "name": "braincrafted/bootstrap-bundle", @@ -217,9 +217,10 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -291,7 +292,7 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -433,7 +434,8 @@ { "name": "Jonathan Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -528,12 +530,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "2.3.4" + "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/2.3.4", - "reference": "2.3.4", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/2a37b007dda8e21bdbb8fa445be8fa0064199e13", + "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13", "shasum": "" }, "require": { @@ -559,7 +561,8 @@ { "name": "Jonathan Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -592,25 +595,25 @@ "source": { "type": "git", "url": "https://github.com/doctrine/DoctrineBundle.git", - "reference": "v1.2.0" + "reference": "765b0d87fcc3e839c74817b7211258cbef3a4fb9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/v1.2.0", - "reference": "v1.2.0", + "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/765b0d87fcc3e839c74817b7211258cbef3a4fb9", + "reference": "765b0d87fcc3e839c74817b7211258cbef3a4fb9", "shasum": "" }, "require": { "doctrine/dbal": ">=2.2,<2.5-dev", - "jdorn/sql-formatter": ">=1.1,<2.0", + "jdorn/sql-formatter": "~1.1", "php": ">=5.3.2", - "symfony/doctrine-bridge": ">=2.2,<3.0", - "symfony/framework-bundle": ">=2.2,<3.0" + "symfony/doctrine-bridge": "~2.2", + "symfony/framework-bundle": "~2.2" }, "require-dev": { "doctrine/orm": ">=2.2,<2.5-dev", - "symfony/validator": ">=2.2,<3.0", - "symfony/yaml": ">=2.2,<3.0" + "symfony/validator": "~2.2", + "symfony/yaml": "~2.2" }, "suggest": { "doctrine/orm": "The Doctrine ORM integration is optional in the bundle.", @@ -634,7 +637,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -716,6 +721,67 @@ "time": "2014-03-05 01:11:31" }, { + "name": "doctrine/doctrine-migrations-bundle", + "version": "dev-master", + "target-dir": "Doctrine/Bundle/MigrationsBundle", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineMigrationsBundle.git", + "reference": "f7138381aa884c0f679da4de41e369b94ead9cd3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineMigrationsBundle/zipball/f7138381aa884c0f679da4de41e369b94ead9cd3", + "reference": "f7138381aa884c0f679da4de41e369b94ead9cd3", + "shasum": "" + }, + "require": { + "doctrine/doctrine-bundle": "~1.0", + "doctrine/migrations": "~1.0@dev", + "php": ">=5.3.2", + "symfony/framework-bundle": "~2.1" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Bundle\\MigrationsBundle": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Doctrine Project", + "homepage": "http://www.doctrine-project.org" + } + ], + "description": "Symfony DoctrineMigrationsBundle", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "dbal", + "migrations", + "schema" + ], + "time": "2014-03-20 14:48:55" + }, + { "name": "doctrine/inflector", "version": "v1.0", "source": { @@ -746,7 +812,8 @@ { "name": "Jonathan Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -762,7 +829,7 @@ "email": "kontakt@beberlei.de" }, { - "name": "Johannes M. Schmitt", + "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com", "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" @@ -831,6 +898,66 @@ "time": "2013-01-12 18:59:04" }, { + "name": "doctrine/migrations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/migrations.git", + "reference": "46a031ddaea47d0685200027cfe8c83b02aee6f6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/46a031ddaea47d0685200027cfe8c83b02aee6f6", + "reference": "46a031ddaea47d0685200027cfe8c83b02aee6f6", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.0", + "php": ">=5.3.2" + }, + "require-dev": { + "symfony/console": "2.*", + "symfony/yaml": "2.*" + }, + "suggest": { + "symfony/console": "to run the migration from the console" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\Migrations": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + } + ], + "description": "Database Schema migrations using Doctrine DBAL", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "migrations" + ], + "time": "2014-03-16 19:02:43" + }, + { "name": "doctrine/orm", "version": "2.3.5", "source": { @@ -908,12 +1035,12 @@ "source": { "type": "git", "url": "https://github.com/FriendsOfSymfony/FOSRestBundle.git", - "reference": "890829effff016b53f392d45702107a09e71edcf" + "reference": "6e5017a66437fdf54c88db75edeec25e4354b4f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/890829effff016b53f392d45702107a09e71edcf", - "reference": "890829effff016b53f392d45702107a09e71edcf", + "url": "https://api.github.com/repos/FriendsOfSymfony/FOSRestBundle/zipball/6e5017a66437fdf54c88db75edeec25e4354b4f6", + "reference": "6e5017a66437fdf54c88db75edeec25e4354b4f6", "shasum": "" }, "require": { @@ -940,7 +1067,8 @@ "suggest": { "jms/serializer-bundle": "Add support for advanced serialization capabilities, recommended, requires 0.12.*", "sensio/framework-extra-bundle": "Add support for route annotations and the view response listener", - "symfony/serializer": "Add support for basic serialization capabilities and xml decoding, requires ~2.2" + "symfony/serializer": "Add support for basic serialization capabilities and xml decoding, requires ~2.2", + "symfony/validator": "Add support for validation capabilities in the ParamFetcher, requires ~2.2" }, "type": "symfony-bundle", "extra": { @@ -977,7 +1105,7 @@ "keywords": [ "rest" ], - "time": "2014-04-03 21:10:08" + "time": "2014-04-21 08:26:51" }, { "name": "helios-ag/fm-elfinder-bundle", @@ -1263,7 +1391,7 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" @@ -1281,13 +1409,13 @@ "version": "1.0.0", "source": { "type": "git", - "url": "git://github.com/schmittjoh/cg-library.git", - "reference": "1.0.0" + "url": "https://github.com/schmittjoh/cg-library.git", + "reference": "ce8ef43dd6bfe6ce54e5e9844ab71be2343bf2fc" }, "dist": { "type": "zip", - "url": "https://github.com/schmittjoh/cg-library/zipball/1.0.0", - "reference": "1.0.0", + "url": "https://api.github.com/repos/schmittjoh/cg-library/zipball/ce8ef43dd6bfe6ce54e5e9844ab71be2343bf2fc", + "reference": "ce8ef43dd6bfe6ce54e5e9844ab71be2343bf2fc", "shasum": "" }, "require": { @@ -1315,7 +1443,7 @@ "keywords": [ "code generation" ], - "time": "2012-01-02 12:40:52" + "time": "2012-01-02 20:40:52" }, { "name": "jms/di-extra-bundle", @@ -1324,20 +1452,20 @@ "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSDiExtraBundle.git", - "reference": "1.4.0" + "reference": "7fffdb6c96fb922a131af06d773e1e6c5301d070" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/JMSDiExtraBundle/zipball/1.4.0", - "reference": "1.4.0", + "url": "https://api.github.com/repos/schmittjoh/JMSDiExtraBundle/zipball/7fffdb6c96fb922a131af06d773e1e6c5301d070", + "reference": "7fffdb6c96fb922a131af06d773e1e6c5301d070", "shasum": "" }, "require": { "jms/aop-bundle": ">=1.0.0,<1.2-dev", "jms/metadata": "1.*", - "symfony/finder": ">=2.1,<3.0", - "symfony/framework-bundle": ">=2.1,<3.0", - "symfony/process": ">=2.1,<3.0" + "symfony/finder": "~2.1", + "symfony/framework-bundle": "~2.1", + "symfony/process": "~2.1" }, "require-dev": { "doctrine/doctrine-bundle": "*", @@ -1421,7 +1549,7 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" @@ -1441,13 +1569,13 @@ "version": "1.0.0", "source": { "type": "git", - "url": "git://github.com/schmittjoh/parser-lib", - "reference": "1.0.0" + "url": "https://github.com/schmittjoh/parser-lib.git", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d" }, "dist": { "type": "zip", - "url": "https://github.com/schmittjoh/parser-lib/archive/1.0.0.zip", - "reference": "1.0.0", + "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d", + "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d", "shasum": "" }, "require": { @@ -1478,20 +1606,20 @@ "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSSecurityExtraBundle.git", - "reference": "1.5.1" + "reference": "f5f6c6df69ceae8b709e57b49fcc2a42d9280bcc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/JMSSecurityExtraBundle/zipball/1.5.1", - "reference": "1.5.1", + "url": "https://api.github.com/repos/schmittjoh/JMSSecurityExtraBundle/zipball/f5f6c6df69ceae8b709e57b49fcc2a42d9280bcc", + "reference": "f5f6c6df69ceae8b709e57b49fcc2a42d9280bcc", "shasum": "" }, "require": { - "jms/aop-bundle": ">=1.0,<2.0", - "jms/di-extra-bundle": ">=1.3,<2.0", - "jms/metadata": ">=1.0,<2.0", - "jms/parser-lib": ">=1.0,<2.0", - "symfony/framework-bundle": ">=2.1,<3.0", + "jms/aop-bundle": "~1.0", + "jms/di-extra-bundle": "~1.3", + "jms/metadata": "~1.0", + "jms/parser-lib": "~1.0", + "symfony/framework-bundle": "~2.1", "symfony/security-bundle": "*" }, "require-dev": { @@ -1738,7 +1866,7 @@ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", - "homepage": "http://jmsyst.com", + "homepage": "https://github.com/schmittjoh", "role": "Developer of wrapped JMSSerializerBundle" } ], @@ -2051,17 +2179,17 @@ "source": { "type": "git", "url": "https://github.com/kriswallsmith/assetic.git", - "reference": "v1.1.1" + "reference": "a826e4b96f5c607ff47ef61caf3826b2b1e840ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/v1.1.1", - "reference": "v1.1.1", + "url": "https://api.github.com/repos/kriswallsmith/assetic/zipball/a826e4b96f5c607ff47ef61caf3826b2b1e840ec", + "reference": "a826e4b96f5c607ff47ef61caf3826b2b1e840ec", "shasum": "" }, "require": { "php": ">=5.3.1", - "symfony/process": ">=2.1,<3.0" + "symfony/process": "~2.1" }, "require-dev": { "cssmin/cssmin": "*", @@ -2071,9 +2199,9 @@ "leafo/scssphp": "*", "leafo/scssphp-compass": "*", "mrclay/minify": "*", - "phpunit/phpunit": ">=3.7,<4.0", + "phpunit/phpunit": "~3.7", "ptachoire/cssembed": "*", - "twig/twig": ">=1.6,<2.0" + "twig/twig": "~1.6" }, "suggest": { "leafo/lessphp": "Assetic provides the integration with the lessphp LESS compiler", @@ -2204,16 +2332,16 @@ }, { "name": "monolog/monolog", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "392ef35fd470638e08d0160d6b1cbab63cb23174" + "reference": "1afc39690e7414412face1f8cbf67b73db34485c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/392ef35fd470638e08d0160d6b1cbab63cb23174", - "reference": "392ef35fd470638e08d0160d6b1cbab63cb23174", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1afc39690e7414412face1f8cbf67b73db34485c", + "reference": "1afc39690e7414412face1f8cbf67b73db34485c", "shasum": "" }, "require": { @@ -2241,7 +2369,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.9.x-dev" } }, "autoload": { @@ -2268,7 +2396,7 @@ "logging", "psr-3" ], - "time": "2014-03-23 19:50:26" + "time": "2014-04-20 16:41:26" }, { "name": "nikic/php-parser", @@ -2398,7 +2526,7 @@ ], "authors": [ { - "name": "Johannes Schmitt", + "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com", "homepage": "http://jmsyst.com", "role": "Developer of wrapped JMSSerializerBundle" @@ -2418,13 +2546,13 @@ "version": "1.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log", - "reference": "1.0.0" + "url": "https://github.com/php-fig/log.git", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" }, "dist": { "type": "zip", - "url": "https://github.com/php-fig/log/archive/1.0.0.zip", - "reference": "1.0.0", + "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", + "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", "shasum": "" }, "type": "library", @@ -2487,7 +2615,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "The base bundle for the Symfony Distributions", @@ -2534,7 +2664,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "This bundle provides a way to configure your controllers with annotations", @@ -2586,7 +2718,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "This bundle generates code for you", @@ -2650,27 +2784,27 @@ "source": { "type": "git", "url": "https://github.com/symfony/AsseticBundle.git", - "reference": "v2.3.0" + "reference": "146dd3cb46b302bd471560471c6aaa930483dac1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/v2.3.0", - "reference": "v2.3.0", + "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/146dd3cb46b302bd471560471c6aaa930483dac1", + "reference": "146dd3cb46b302bd471560471c6aaa930483dac1", "shasum": "" }, "require": { - "kriswallsmith/assetic": ">=1.1,<2.0", + "kriswallsmith/assetic": "~1.1", "php": ">=5.3.0", - "symfony/framework-bundle": ">=2.1,<3.0" + "symfony/framework-bundle": "~2.1" }, "require-dev": { - "symfony/class-loader": ">=2.1,<3.0", - "symfony/console": ">=2.1,<3.0", - "symfony/css-selector": ">=2.1,<3.0", - "symfony/dom-crawler": ">=2.1,<3.0", - "symfony/form": ">=2.1,<3.0", - "symfony/twig-bundle": ">=2.1,<3.0", - "symfony/yaml": ">=2.1,<3.0" + "symfony/class-loader": "~2.1", + "symfony/console": "~2.1", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1", + "symfony/form": "~2.1", + "symfony/twig-bundle": "~2.1", + "symfony/yaml": "~2.1" }, "suggest": { "symfony/twig-bundle": "~2.1" @@ -2813,23 +2947,23 @@ "source": { "type": "git", "url": "https://github.com/symfony/MonologBundle.git", - "reference": "v2.3.0" + "reference": "03ed73bc11367b3156cc21f22ac37c7f70fcd10a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/v2.3.0", - "reference": "v2.3.0", + "url": "https://api.github.com/repos/symfony/MonologBundle/zipball/03ed73bc11367b3156cc21f22ac37c7f70fcd10a", + "reference": "03ed73bc11367b3156cc21f22ac37c7f70fcd10a", "shasum": "" }, "require": { - "monolog/monolog": ">=1.3,<2.0", + "monolog/monolog": "~1.3", "php": ">=5.3.2", - "symfony/config": ">=2.2-beta2,<3.0", - "symfony/dependency-injection": ">=2.2-beta2,<3.0", - "symfony/monolog-bridge": ">=2.2-beta2,<3.0" + "symfony/config": "~2.2-beta2", + "symfony/dependency-injection": "~2.2-beta2", + "symfony/monolog-bridge": "~2.2-beta2" }, "require-dev": { - "symfony/yaml": ">=2.2-beta2,<3.0" + "symfony/yaml": "~2.2-beta2" }, "type": "symfony-bundle", "extra": { @@ -2849,7 +2983,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { "name": "Symfony Community", @@ -3108,7 +3244,9 @@ "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" } ], "description": "Common additional features for Twig that do not directly belong in core", @@ -3160,7 +3298,7 @@ "role": "Lead Developer" }, { - "name": "Armin Ronacher2", + "name": "Armin Ronacher", "email": "armin.ronacher@active-4.com", "role": "Project Founder" }, @@ -3287,7 +3425,9 @@ "jms/serializer": 20, "jms/serializer-bundle": 20, "lightbase/cocar": 20, - "ddeboer/data-import-bundle": 20 + "ddeboer/data-import-bundle": 20, + "doctrine/migrations": 20, + "doctrine/doctrine-migrations-bundle": 20 }, "platform": { "php": ">=5.3.3" diff --git a/src/Cacic/CommonBundle/DoctrineMigrations/Version20140422230625.php b/src/Cacic/CommonBundle/DoctrineMigrations/Version20140422230625.php new file mode 100644 index 0000000..7e56465 --- /dev/null +++ b/src/Cacic/CommonBundle/DoctrineMigrations/Version20140422230625.php @@ -0,0 +1,60 @@ +container = $container; + } + + + public function up(Schema $schema) + { + // this up() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql", "Migration can only be executed safely on 'postgresql'."); + + $logger = $this->container->get('logger'); + $rootDir = $this->container->get('kernel')->getRootDir(); + $upgrade = $rootDir."/../src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql"; + $upgradeSQL = file_get_contents($upgrade); + + $logger->debug("Arquivo de atualização: $upgrade"); + + // Chama o container para executar o arquivo de atualização + // FIXME: Só funciona no PostgreSQL + $this->addSql($upgradeSQL); + $this->addSql("SELECT upgrade()"); + + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + + } + + public function postUp(Schema $schema) + { + $em = $this->container->get('doctrine.orm.entity_manager'); + // ... update the entities + } + + public function postDown(Schema $schema) + { + $em = $this->container->get('doctrine.orm.entity_manager'); + // ... update the entities + } +} diff --git a/src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql b/src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql new file mode 100644 index 0000000..4faaadd --- /dev/null +++ b/src/Cacic/CommonBundle/Resources/data/upgrade-3.0b3.sql @@ -0,0 +1,81 @@ +CREATE OR REPLACE FUNCTION upgrade() RETURNS VOID AS $$ + DECLARE + + soft record; + nm integer; + atualiza record; + comp integer; + + BEGIN + + FOR soft IN select sw.nm_software, count(distinct prop.id_software) as n_repeticoes + from software sw + inner join proriedade_software prop on sw.id_software = prop.id_software + group by sw.nm_software + having count(distinct prop.id_software) > 1 + order by count(distinct prop.id_software) desc LOOP + + RAISE NOTICE 'O seguinte software possui entradas repetidas: %',soft.nm_software; + + -- Escolhe um software para colocar em todos + SELECT DISTINCT id_software INTO nm + FROM software + WHERE nm_software = soft.nm_software + ORDER BY id_software asc + LIMIT 1; + + -- Atualiza o valor de todas as entradas na tabela para o primeiro valor + FOR atualiza IN select distinct pr.id_propriedade_software + from software st + inner join proriedade_software pr on st.id_software = pr.id_software + where st.nm_software = soft.nm_software LOOP + + + RAISE NOTICE 'Atualizando o valor da propriedade = % com o software = %',atualiza.id_propriedade_software,nm; + + BEGIN + + UPDATE proriedade_software + SET id_software = nm + WHERE id_propriedade_software = atualiza.id_propriedade_software; + + EXCEPTION WHEN OTHERS THEN + + RAISE NOTICE 'ERRO!!!! Provavelmente a coleta estava repetida'; + + END; + + END LOOP ; + + END LOOP; + + -- Finalmente limpa todos os softwares sem coleta + + FOR soft IN select distinct sw.id_software + from software sw + left join proriedade_software prop on sw.id_software = prop.id_software + left join aquisicao_item aq on sw.id_software = aq.id_software + where prop.id_software is null + and aq.id_software is null LOOP + + RAISE NOTICE 'Removendo software = %',soft.id_software; + + BEGIN + + DELETE FROM software + WHERE id_software = soft.id_software; + + EXCEPTION WHEN OTHERS THEN + + RAISE NOTICE 'Erro na exclusão do software %',soft.id_software; + + END ; + + END LOOP ; + + + RETURN; + + END; + +$$ LANGUAGE 'plpgsql'; \ No newline at end of file -- libgit2 0.21.2