From 9dda5e354c975e356e39c155d079d6420a7c4665 Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Sat, 30 Jul 2016 21:23:52 -0300 Subject: [PATCH 1/8] refs #272 adding an option to jump to certain migration, updating documentation, writing some unit tests to this feature. --- Console/Command/MigrationShell.php | 8 ++++-- Docs/Documentation/Examples.md | 13 ++++++++- Lib/MigrationVersion.php | 38 ++++++++++++++++++++++++-- Test/Case/Lib/MigrationVersionTest.php | 24 +++++++++++++++- 4 files changed, 77 insertions(+), 6 deletions(-) diff --git a/Console/Command/MigrationShell.php b/Console/Command/MigrationShell.php index eb019853..d4776e46 100644 --- a/Console/Command/MigrationShell.php +++ b/Console/Command/MigrationShell.php @@ -105,7 +105,8 @@ public function startup() { 'precheck' => $this->params['precheck'], 'autoinit' => !$this->params['no-auto-init'], 'dry' => $this->params['dry'], - 'skip' => isset($this->params['skip']) ? $this->params['skip'] : null); + 'skip' => isset($this->params['skip']) ? $this->params['skip'] : null, + 'jumpTo' => isset($this->params['jump-to']) ? $this->params['jump-to'] : null); if (!empty($this->connection)) { $options['connection'] = $this->connection; @@ -179,7 +180,10 @@ public function getOptionParser() { 'boolean' => true, 'help' => __d('migrations', 'Force \'generate\' to compare all tables.'))) ->addOption('skip', array( - 'help' => __('Skip to a certain migration.'))) + 'help' => __('Skip certain migration.'))) + ->addOption('jump-to', array( + 'short' => 'j', + 'help' => __('Will jump to the migration and mark the others as executed.'))) ->addOption('compare', array( 'short' => 'm', 'boolean' => true, diff --git a/Docs/Documentation/Examples.md b/Docs/Documentation/Examples.md index ccc5e9b3..c8b758c7 100644 --- a/Docs/Documentation/Examples.md +++ b/Docs/Documentation/Examples.md @@ -94,4 +94,15 @@ You can skip many migrations using comma to separate, for example. cake Migrations.migration run all --skip 1458963215_articles_table,1457412585_users_table ``` -Remember this migrations will be set as executed. \ No newline at end of file +Remember this migrations will be set as executed. + +Jumping to certain migrations +-------------------------------------------------- + +If you want to jump to certain migration, you can use ```--jump-to``` or ```-j``` + migration name as the example below. + +``` +cake Migrations.migration run all -j 1458963215_articles_table +``` + +Remember all migrations before this will be set as executed. \ No newline at end of file diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index 56c8b155..f823d179 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -75,6 +75,13 @@ class MigrationVersion { */ public $skip = array(); +/** + * Will jump to the migration. + * + * @var null|string + */ + public $jumpTo = null; + /** * Log of SQL queries generated * @@ -106,6 +113,10 @@ public function __construct($options = array()) { $this->skip = $options['skip']; } + if (!empty($options['jumpTo'])) { + $this->jumpTo = $options['jumpTo']; + } + if (!isset($options['dry'])) { $options['dry'] = false; } @@ -309,6 +320,7 @@ public function getMigration($name, $class, $type, $options = array()) { public function run($options) { $targetVersion = $latestVersion = $this->getVersion($options['type']); $mapping = $this->getMapping($options['type'], false); + $direction = 'up'; if (!empty($options['direction'])) { $direction = $options['direction']; @@ -337,12 +349,19 @@ public function run($options) { krsort($mapping); } + foreach ($mapping as $version => $info) { if (($direction === 'up' && $version > $targetVersion) || ($direction === 'down' && $version < $targetVersion)) { break; - } elseif (($direction === 'up' && $info['migrated'] === null) + } elseif (($direction === 'up' && $info['migrated'] === null) || ($direction === 'down' && $info['migrated'] !== null)) { + + $jumpVersion = $this->getVersionByName($mapping); + if ($version < $jumpVersion) { + $this->setVersion($version, $info['type']); + continue; + } if (in_array($mapping[$version]['name'], $this->skip)) { $this->setVersion($version, $info['type']); @@ -381,6 +400,22 @@ public function run($options) { return true; } +/** + * Will return a version based in the migration name + * + * @return bool|string + */ + public function getVersionByName($mapping) { + $version = false; + foreach ($mapping as $key => $info) { + if ($mapping[$key]['name'] == $this->jumpTo) { + $version = $key; + } + } + + return $version; + } + /** * Initialize the migrations schema and keep it up-to-date * @@ -504,7 +539,6 @@ protected function _enumerateOldMigrations($type) { } return $mapping; } - } /** diff --git a/Test/Case/Lib/MigrationVersionTest.php b/Test/Case/Lib/MigrationVersionTest.php index b2b093c2..01e63546 100644 --- a/Test/Case/Lib/MigrationVersionTest.php +++ b/Test/Case/Lib/MigrationVersionTest.php @@ -308,6 +308,27 @@ public function testRun() { $this->assertTrue($Version->run(array('version' => 0, 'type' => 'mocks'))); } +/** + * TestGetVersionByName method + * + * @return void + */ + public function testGetVersionByName() { + $Version = new MigrationVersion(array( + 'jumpTo' => '007_schema_dump' + )); + + $result = $Version->getVersionByName($this->_mapping()); + $this->assertEquals(7, $result); + + $Version = new MigrationVersion(array( + 'jumpTo' => '00_schema_dump' + )); + + $result = $Version->getVersionByName($this->_mapping()); + $this->assertFalse($result); + } + /** * _mapping method * @@ -319,7 +340,8 @@ protected function _mapping($start = 0, $end = 0) { $mapping = array(); for ($i = 1; $i <= 10; $i++) { $mapping[$i] = array( - 'version' => $i, 'name' => '001_schema_dump', + 'version' => $i, + 'name' => "00{$i}_schema_dump", 'class' => 'M4af9d151e1484b74ad9d007058157726', 'type' => 'mocks', 'migrated' => null ); From a2dd74ac62f2524fe1df32895bc62aa393fbbbd0 Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Mon, 1 Aug 2016 22:55:15 -0300 Subject: [PATCH 2/8] refs #272 adding more unit tests --- Lib/MigrationVersion.php | 20 +++++++++- Test/Case/Lib/MigrationVersionTest.php | 55 +++++++++++++++++++++++--- 2 files changed, 68 insertions(+), 7 deletions(-) diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index f823d179..1663bc94 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -185,7 +185,6 @@ public function setVersion($version, $type, $migrated = true) { $bc = ($this->Version->schema('class') === null); $field = $bc ? 'version' : 'class'; $value = $bc ? $version : $mapping[$version]['class']; - if ($migrated) { $this->Version->create(); $result = $this->Version->save(array( @@ -359,7 +358,13 @@ public function run($options) { $jumpVersion = $this->getVersionByName($mapping); if ($version < $jumpVersion) { - $this->setVersion($version, $info['type']); + $this->jump($version, $info['type']); + continue; + } + + $jumpVersion = $this->getVersionByName($mapping); + if ($version < $jumpVersion) { + $this->jump($version, $info['type']); continue; } @@ -400,6 +405,17 @@ public function run($options) { return true; } +/** + * jump method + * + * @param array $version version of a migration + * @param array $info migration info + * @return void + */ + public function jump($version, $type) { + $this->setVersion($version, $type); + } + /** * Will return a version based in the migration name * diff --git a/Test/Case/Lib/MigrationVersionTest.php b/Test/Case/Lib/MigrationVersionTest.php index 01e63546..b9793d45 100644 --- a/Test/Case/Lib/MigrationVersionTest.php +++ b/Test/Case/Lib/MigrationVersionTest.php @@ -119,11 +119,11 @@ public function testGetMapping() { 'migrated' => '2011-11-18 13:53:32' ), 3 => array( - 'version' => 3, - 'name' => '003_increase_class_name_length', - 'class' => 'IncreaseClassNameLength', - 'type' => 'Migrations', - 'migrated' => null + 'version' => 3, + 'name' => '003_increase_class_name_length', + 'class' => 'IncreaseClassNameLength', + 'type' => 'Migrations', + 'migrated' => null ) ); $this->assertEquals($result, $expected); @@ -308,6 +308,50 @@ public function testRun() { $this->assertTrue($Version->run(array('version' => 0, 'type' => 'mocks'))); } +/** + * TestRunWithJump method + * + * @return void + */ + public function testRunWithJump() { + $options = array( + 'connection' => 'test', + 'autoinit' => false, + 'jumpTo' => '003_schema_dump' + ); + + $Version = $this->getMock('MigrationVersion', + array('getMapping', 'getMigration', 'getVersion', 'jump'), + array($options), + 'TestMigrationVersionMockMigrationVersions' + ); + + $CakeMigration = new CakeMigration($options); + + $Version->expects($this->any()) + ->method('getMigration') + ->will($this->returnValue($CakeMigration)); + + $Version->Version = ClassRegistry::init(array( + 'class' => 'schema_migrations', + 'ds' => 'test' + )); + + $Version->expects($this->at(0))->method('getVersion')->will($this->returnValue(9)); + $Version->expects($this->exactly(2))->method('jump'); + $Version->expects($this->any())->method('getMapping')->will($this->returnValue($this->_mapping())); + + $this->assertTrue($Version->run(array('direction' => 'up', 'type' => 'mocks'))); + + $migrations = $Version->Version->find('count', array( + 'conditions' => array( + 'type' => 'mocks' + ) + )); + + $this->assertEquals(8, $migrations); + } + /** * TestGetVersionByName method * @@ -349,6 +393,7 @@ protected function _mapping($start = 0, $end = 0) { $mapping[$i]['migrated'] = CakeTime::nice(); } } + return $mapping; } } From 4fbdb9d799ae32d31109312f271000130c8da28c Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 00:08:03 -0300 Subject: [PATCH 3/8] refs #272 fixing unit tests in the migration shell command --- Test/Case/Console/Command/MigrationShellTest.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Test/Case/Console/Command/MigrationShellTest.php b/Test/Case/Console/Command/MigrationShellTest.php index ac12ecea..4dba0b63 100644 --- a/Test/Case/Console/Command/MigrationShellTest.php +++ b/Test/Case/Console/Command/MigrationShellTest.php @@ -205,7 +205,8 @@ public function testRun() { 'direction' => 'up', 'version' => 1, 'dry' => false, - 'precheck' => null))); + 'precheck' => null, + 'skip' => array()))); $this->Shell->args = array('up'); $this->assertTrue($this->Shell->run()); @@ -227,7 +228,8 @@ public function testRun() { 'direction' => 'down', 'version' => 1, 'dry' => false, - 'precheck' => null))); + 'precheck' => null, + 'skip' => array()))); $this->Shell->args = array('down'); $this->assertTrue($this->Shell->run()); @@ -239,7 +241,8 @@ public function testRun() { 'version' => 10, 'direction' => 'up', 'dry' => false, - 'precheck' => null))); + 'precheck' => null, + 'skip' => array()))); $this->Shell->args = array('all'); $this->assertTrue($this->Shell->run()); @@ -251,7 +254,8 @@ public function testRun() { 'version' => 0, 'direction' => 'down', 'dry' => false, - 'precheck' => null))); + 'precheck' => null, + 'skip' => array()))); $this->Shell->args = array('reset'); $this->assertTrue($this->Shell->run()); @@ -1081,5 +1085,4 @@ protected function _unlink($files) { } } -} - +} \ No newline at end of file From f6bb5c693081ad5e1cc904203e67d963ef3cf8b1 Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 15:03:27 -0300 Subject: [PATCH 4/8] refs #272 fixing unit tests and removing a unnecessary command --- .semver | 4 +- .travis.yml | 23 +- CHANGELOG.md | 70 ---- CONTRIBUTING.md | 2 +- Config/Migration/001_init_migrations.php | 4 +- .../002_convert_version_to_class_names.php | 4 +- .../003_increase_class_name_length.php | 4 +- Console/Command/MigrationShell.php | 364 +++--------------- Console/Command/Templates/migration.ctp | 4 +- Docs/Documentation/Examples.md | 3 +- Docs/Documentation/Installation.md | 6 +- Lib/CakeMigration.php | 40 +- Lib/Migration/PrecheckBase.php | 40 +- Lib/Migration/PrecheckCondition.php | 23 +- Lib/Migration/PrecheckException.php | 32 +- Lib/MigrationVersion.php | 35 +- Lib/Panel/MigrationsPanel.php | 3 +- Locale/deu/LC_MESSAGES/migrations.po | 135 ++++--- Locale/fre/LC_MESSAGES/migrations.po | 142 ++++--- Locale/ita/LC_MESSAGES/migrations.po | 131 +++---- Locale/migrations.pot | 101 +++-- Locale/por/LC_MESSAGES/migrations.po | 144 +++---- Locale/spa/LC_MESSAGES/migrations.po | 131 ++++--- Model/SchemaMigration.php | 4 +- README.md | 8 +- .../Console/Command/MigrationShellTest.php | 160 +++----- .../Lib/Migration/PrecheckConditionTest.php | 1 + Test/Case/Lib/MigrationVersionTest.php | 9 +- Test/Case/Lib/Model/CakeMigrationTest.php | 5 +- Test/Fixture/SchemaMigrationsFixture.php | 2 +- Test/Fixture/test_migration.txt | 34 +- .../Config/Migration/001_schema_dump.php | 4 +- ...nother_migration_plugin_test_migration.php | 4 +- .../Config/Schema/schema.php | 3 +- View/Elements/migrations_panel.ctp | 77 ++-- composer.json | 2 +- 36 files changed, 696 insertions(+), 1062 deletions(-) diff --git a/.semver b/.semver index d42d4c53..e88c8a2b 100644 --- a/.semver +++ b/.semver @@ -1,5 +1,5 @@ --- :major: 2 -:minor: 4 -:patch: 1 +:minor: 3 +:patch: 2 :special: '' diff --git a/.travis.yml b/.travis.yml index a4dee622..9746c3a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,10 @@ language: php php: + - 5.3 + - 5.4 - 5.5 - - 5.6 - - 7.0 + env: global: - PLUGIN_NAME=Migrations @@ -12,21 +13,22 @@ env: - REQUIRE="phpunit/phpunit:3.7.31" matrix: - - DB=mysql CAKE_VERSION=2.7 + - DB=mysql CAKE_VERSION=master matrix: include: - - php: 5.5 + - php: 5.3 env: - - CAKE_VERSION=2.7 - - php: 5.6 + - CAKE_VERSION=master + - php: 5.4 env: - - CAKE_VERSION=2.7 - - php: 7.0 + - CAKE_VERSION=master + - php: 5.5 env: - - CAKE_VERSION=2.8 + - CAKE_VERSION=master + before_script: - - git clone https://github.com/steinkel/travis.git --depth 1 ../travis + - git clone https://github.com/burzum/travis.git --depth 1 ../travis - ../travis/before_script.sh - if [ "$PHPCS" != 1 ]; then echo " @@ -42,4 +44,3 @@ after_success: notifications: email: false - diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4775fa..a93fd422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,76 +1,6 @@ Changelog ========= -Release 2.4.1 -------------- - -* Bugfix/Improvement release - -Release 2.4.0 -------------- - -* [43228df](https://github.com/cakedc/migrations/commit/43228df) Code standard fix -* [4352ed8](https://github.com/cakedc/migrations/commit/4352ed8) Changed method comment to a clearer comment -* [25d7181](https://github.com/cakedc/migrations/commit/25d7181) Changed uses of the ConnectionManager class to static -* [9a56814](https://github.com/cakedc/migrations/commit/9a56814) Fixed method comments -* [2ee4c1e](https://github.com/cakedc/migrations/commit/2ee4c1e) Changed call of enumConnectionObjects to static -* [caf1730](https://github.com/cakedc/migrations/commit/caf1730) Correct definition of the connection manager class uses -* [193ed70](https://github.com/cakedc/migrations/commit/193ed70) Fixed code formating -* [283590a](https://github.com/cakedc/migrations/commit/283590a) Fixed console input message that asks migrationConnection -* [1909320](https://github.com/cakedc/migrations/commit/1909320) Added test case to check migrationConnection shell parameter -* [b60fa05](https://github.com/cakedc/migrations/commit/b60fa05) Fixed array syntax in model uses -* [9237949](https://github.com/cakedc/migrations/commit/9237949) Validate migrateConnection argument when a custom connection is set -* [6374acc](https://github.com/cakedc/migrations/commit/6374acc) Added example to set a specific datasource on run - -Release 2.3.6 -------------- - -* [1489496](https://github.com/cakedc/migrations/commit/1489496) Revert "fixing unit tests" to pass tests in travis env -* [ebf6bc6](https://github.com/cakedc/migrations/commit/ebf6bc6) using minor for travis CakePHP -* [517a810](https://github.com/cakedc/migrations/commit/517a810) updating travis -* [180fe03](https://github.com/cakedc/migrations/commit/180fe03) fixed class condition after some changes done in Inflector::camelize in 2.6.6 -* [27d5afb](https://github.com/cakedc/migrations/commit/27d5afb) fixing unit tests - -Release 2.3.6 -------------- - -https://github.com/CakeDC/migrations/tree/2.3.6 - -* [ccac5a3](https://github.com/cakedc/migrations/commit/ccac5a3) Update translation files -* [bca17ea](https://github.com/cakedc/migrations/commit/bca17ea) Show prompt for marking as successful when failure -* [18aa020](https://github.com/cakedc/migrations/commit/18aa020) crlf to lf -* [db96c9e](https://github.com/cakedc/migrations/commit/db96c9e) Grammatical corrections for generate command -* [cc7b03a](https://github.com/cakedc/migrations/commit/cc7b03a) Fix CS issues -* [942eab0](https://github.com/cakedc/migrations/commit/942eab0) Fix grammar in console output -* [89ddfc1](https://github.com/cakedc/migrations/commit/89ddfc1) Tidy up unlinking in tests -* [894f736](https://github.com/cakedc/migrations/commit/894f736) Fix for incorrect naming of all plugin migrations - -Release 2.3.5 -------------- - -https://github.com/CakeDC/migrations/tree/2.3.5 - -* [69e6136](https://github.com/cakedc/migrations/commit/69e6136) Add translations for new/missing strings -* [c98ecdd](https://github.com/cakedc/migrations/commit/c98ecdd) Exit shell if comparing schema.php and nothing has changed - -Release 2.3.4 -------------- - -https://github.com/CakeDC/migrations/tree/2.3.4 - -* [94a7fe9](https://github.com/cakedc/migrations/commit/94a7fe9) Removed cakephp dependency from composer.json - -Release 2.3.3 -------------- - -https://github.com/CakeDC/migrations/tree/2.3.3 - -* [14a3cc4](https://github.com/cakedc/migrations/commit/14a3cc4) Bump minimum required CakePHP version to 2.5.4 (refs [#184](https://github.com/CakeDC/migrations/issues/184)) -* [f6f3490](https://github.com/cakedc/migrations/commit/f6f3490) CS: Changed doc block "boolean" to "bool" -* [b6c579c](https://github.com/cakedc/migrations/commit/b6c579c) Fixes Schema/app.php issue. -* [749e634](https://github.com/cakedc/migrations/commit/749e634) Improved logic for schema class name detection. -* [9ef51fd](https://github.com/cakedc/migrations/commit/9ef51fd) Adds an option for specifying the Schema class name. - Release 2.3.2 ------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26f53081..408e8119 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing ============ -This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugin-standard). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/contribution-guidelines) for detailed instructions. +This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugins). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/plugins) for detailed instructions. \ No newline at end of file diff --git a/Config/Migration/001_init_migrations.php b/Config/Migration/001_init_migrations.php index 537eb730..76190e17 100644 --- a/Config/Migration/001_init_migrations.php +++ b/Config/Migration/001_init_migrations.php @@ -38,7 +38,7 @@ class InitMigrations extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -48,7 +48,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; diff --git a/Config/Migration/002_convert_version_to_class_names.php b/Config/Migration/002_convert_version_to_class_names.php index f967aa1c..a8302c1c 100644 --- a/Config/Migration/002_convert_version_to_class_names.php +++ b/Config/Migration/002_convert_version_to_class_names.php @@ -48,7 +48,7 @@ class ConvertVersionToClassNames extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue * @throws InternalErrorException */ public function before($direction) { @@ -69,7 +69,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { $this->upgradeRecords(); diff --git a/Config/Migration/003_increase_class_name_length.php b/Config/Migration/003_increase_class_name_length.php index 990f7212..2813ef0e 100644 --- a/Config/Migration/003_increase_class_name_length.php +++ b/Config/Migration/003_increase_class_name_length.php @@ -34,7 +34,7 @@ class IncreaseClassNameLength extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -44,7 +44,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; diff --git a/Console/Command/MigrationShell.php b/Console/Command/MigrationShell.php index d4776e46..ba41b3ad 100644 --- a/Console/Command/MigrationShell.php +++ b/Console/Command/MigrationShell.php @@ -13,15 +13,12 @@ App::uses('AppShell', 'Console/Command'); App::uses('CakeSchema', 'Model'); App::uses('MigrationVersion', 'Migrations.Lib'); -App::uses('CakeText', 'Utility'); +App::uses('String', 'Utility'); App::uses('ClassRegistry', 'Utility'); -App::uses('ConnectionManager', 'Model'); -App::uses('Folder', 'Utility'); -App::uses('File', 'Utility'); -App::uses('CakeTime', 'Utility'); /** * Migration shell. + * */ class MigrationShell extends AppShell { @@ -62,13 +59,6 @@ class MigrationShell extends AppShell { */ public $Version; -/** - * Skip a version or it can skip many version using comma as separate. - * - * @var array - */ - public $skip = array(); - /** * Messages used to display action being performed * @@ -89,24 +79,26 @@ public function startup() { $this->connection = $this->params['connection']; } - $this->migrationConnection = $this->_startMigrationConnection(); + if (!empty($this->params['migrationConnection'])) { + $this->migrationConnection = $this->params['migrationConnection']; + } if (!empty($this->params['plugin'])) { $this->type = $this->params['plugin']; } - if (!empty($this->params['skip'])) { - $this->skip = $this->params['skip']; - } - $this->path = $this->_getPath() . 'Config' . DS . 'Migration' . DS; $options = array( 'precheck' => $this->params['precheck'], 'autoinit' => !$this->params['no-auto-init'], +<<<<<<< Updated upstream 'dry' => $this->params['dry'], 'skip' => isset($this->params['skip']) ? $this->params['skip'] : null, 'jumpTo' => isset($this->params['jump-to']) ? $this->params['jump-to'] : null); +======= + 'dry' => $this->params['dry']); +>>>>>>> Stashed changes if (!empty($this->connection)) { $options['connection'] = $this->connection; @@ -115,6 +107,7 @@ public function startup() { if (!empty($this->migrationConnection)) { $options['migrationConnection'] = $this->migrationConnection; } + $this->Version = new MigrationVersion($options); $this->_messages = array( @@ -130,38 +123,10 @@ public function startup() { ); } -/** - * Get a list of connection names. - * - * @return array The list of connection names - */ - protected function _connectionNamesEnum() { - return array_keys(ConnectionManager::enumConnectionObjects()); - } - -/** - * Set a migration connection - * - * @return string The name of the migration connection. - */ - protected function _startMigrationConnection() { - if (!empty($this->params['connection']) && empty($this->params['migrationConnection'])) { - return $this->in( - "You did not set a migration connection (-i), which connection do you want to use?", - $this->_connectionNamesEnum(), - $this->params['connection'] - ); - } - - if (!empty($this->params['migrationConnection'])) { - return $this->params['migrationConnection']; - } - } - /** * Get the option parser. * - * @return string + * @return void */ public function getOptionParser() { $parser = parent::getOptionParser(); @@ -170,11 +135,11 @@ public function getOptionParser() { '') ->addOption('plugin', array( 'short' => 'p', - 'help' => __d('migrations', 'Plugin name to be used'))) + 'help' => __('Plugin name to be used'))) ->addOption('precheck', array( 'short' => 'm', 'default' => 'Migrations.PrecheckException', - 'help' => __d('migrations', 'Precheck migrations'))) + 'help' => __('Precheck migrations'))) ->addOption('force', array( 'short' => 'f', 'boolean' => true, @@ -195,32 +160,27 @@ public function getOptionParser() { ->addOption('connection', array( 'short' => 'c', 'default' => null, - 'help' => __d('migrations', 'Overrides the \'default\' connection of the MigrationVersion'))) + 'help' => __('Overrides the \'default\' connection of the MigrationVersion'))) ->addOption('migrationConnection', array( 'short' => 'i', 'default' => null, - 'help' => __d('migrations', 'Overrides the \'default\' connection of the CakeMigrations that are applied'))) + 'help' => __('Overrides the \'default\' connection of the CakeMigrations that are applied'))) ->addOption('dry', array( 'short' => 'd', 'boolean' => true, 'default' => false, - 'help' => __d('migrations', 'Output the raw SQL queries rather than applying them to the database.'))) + 'help' => __('Output the raw SQL queries rather than applying them to the database.'))) ->addOption('no-auto-init', array( 'short' => 'n', 'boolean' => true, 'default' => false, - 'help' => __d('migrations', 'Disables automatic creation of migrations table and running any internal plugin migrations'))) - ->addOption('schema-class', array( - 'short' => 's', - 'boolean' => false, - 'default' => false, - 'help' => __d('migrations', 'CamelCased Classname without the `Schema` suffix to use when reading or generating schema files. See `Console/cake schema generate --help`.'))) + 'help' => __('Disables automatic creation of migrations table and running any internal plugin migrations'))) ->addSubcommand('status', array( - 'help' => __d('migrations', 'Displays a status of all plugin and app migrations.'))) + 'help' => __('Displays a status of all plugin and app migrations.'))) ->addSubcommand('run', array( - 'help' => __d('migrations', 'Run a migration to given direction or version.'))) + 'help' => __('Run a migration to given direction or version.'))) ->addSubcommand('generate', array( - 'help' => __d('migrations', 'Generates a migration file.'))); + 'help' => __('Generates a migration file.'))); } /** @@ -247,7 +207,7 @@ public function run() { if ($mapping === false) { $this->out(__d('migrations', 'No migrations available.')); - return $this->_stop(); + return $this->_stop(1); } $latestVersion = $this->Version->getVersion($this->type); @@ -259,8 +219,7 @@ public function run() { 'precheck' => isset($this->params['precheck']) ? $this->params['precheck'] : null, 'type' => $this->type, 'dry' => $this->params['dry'], - 'callback' => &$this, - 'skip' => $this->skip); + 'callback' => &$this); $once = false; //In case of exception run shell again (all, reset, migration number) if (isset($this->args[0]) && in_array($this->args[0], array('up', 'down'))) { @@ -292,9 +251,10 @@ public function run() { $this->out(__d('migrations', 'Migration will run dry, no database changes will be made')); $this->out(''); } + $result = $this->_execute($options, $once); if ($result !== true) { - $this->out($result); + $this->out(__d('migrations', $result)); } $this->out(__d('migrations', 'All migrations have completed.')); @@ -302,13 +262,6 @@ public function run() { return true; } -/** - * Execute migration - * - * @param array $options Options for migration - * @param bool $once True to only run once, false to retry - * @return bool True if success - */ protected function _execute($options, $once) { $result = true; try { @@ -339,7 +292,7 @@ protected function _execute($options, $once) { /** * Output the SQL log in dry mode * - * @param array $log List of queries per migration + * @param $log array * @return void */ protected function _outputLog($log) { @@ -358,14 +311,6 @@ protected function _outputLog($log) { $this->hr(); } -/** - * Single step options for up/down migrations - * - * @param array $mapping Migration version mappings - * @param string $latestVersion Latest migration version - * @param array $default Default options for migration - * @return array Modified options for migration - */ protected function _singleStepOptions($mapping, $latestVersion, $default = array()) { $options = $default; $versions = array_keys($mapping); @@ -384,13 +329,6 @@ protected function _singleStepOptions($mapping, $latestVersion, $default = array return $options; } -/** - * Output prompt with different migration versions to choose from - * - * @param array $mapping Migration version mappings - * @param string $latestVersion Latest migration version - * @return array User-chosen options for migration - */ protected function _promptVersionOptions($mapping, $latestVersion) { if (isset($this->args[0]) && is_numeric($this->args[0])) { $options['version'] = (int)$this->args[0]; @@ -405,7 +343,7 @@ protected function _promptVersionOptions($mapping, $latestVersion) { $this->hr(); while (true) { - $response = $this->in(__d('migrations', 'Please choose which version you want to migrate to. [q]uit or [c]lean.')); + $response = $this->in(__d('migrations', 'Please, choose what version you want to migrate to. [q]uit or [c]lean.')); if (strtolower($response) === 'q') { return $this->_stop(); } elseif (strtolower($response) === 'c') { @@ -451,27 +389,13 @@ public function generate() { } else { $oldSchema = $this->_getSchema($this->type); if ($oldSchema !== false) { - $response = isset($this->params['compare']) && $this->params['compare'] === true ? 'y' : false; - - if ($response === false) { - $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); - } - - $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); + $response = $this->in(__d('migrations', 'Do you want compare the schema.php file to the database?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_generateFromComparison($migration, $oldSchema, $comparison); - $this->_migrationChanges($migration); $fromSchema = true; - } else { - $response = $this->in(__d('migrations', 'Do you want to compare the database to the schema.php file?'), array('y', 'n'), 'y'); - if (strtolower($response) === 'y') { - $this->_generateFromInverseComparison($migration, $oldSchema, $comparison); - $this->_migrationChanges($migration); - $fromSchema = false; - } } } else { - $response = $this->in(__d('migrations', 'Do you want to generate a dump from the current database?'), array('y', 'n'), 'y'); + $response = $this->in(__d('migrations', 'Do you want generate a dump from current database?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_generateDump($migration); $fromSchema = true; @@ -481,12 +405,8 @@ public function generate() { $this->_finalizeGeneratedMigration($migration, $migrationName, $fromSchema); - if ($this->params['overwrite'] === true) { - $this->_overwriteSchema(); - } - if ($fromSchema && isset($comparison)) { - $response = $this->in(__d('migrations', 'Do you want to update the schema.php file?'), array('y', 'n'), 'y'); + $response = $this->in(__d('migrations', 'Do you want update the schema.php file?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_updateSchema(); } @@ -494,25 +414,10 @@ public function generate() { } /** - * _migrationsChanges method - * - * @param array $migration list of migrations - * @return bool - */ - protected function _migrationChanges($migration) { - if (empty($migration)) { - $this->hr(); - $this->out(__d('migrations', 'No database changes detected.')); - return $this->_stop(); - } - } - -/** - * Generate a migration by comparing schema.php with the database. - * - * @param array &$migration Reference to variable of the same name in generate() method - * @param array &$oldSchema Reference to variable of the same name in generate() method - * @param array &$comparison Reference to variable of the same name in generate() method + * generate a migration by comparing schema.php with the database. + * @param array $migration reference to variable of the same name in generate() method + * @param array $oldSchema reference to variable of the same name in generate() method + * @param array $comparison reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateFromComparison(&$migration, &$oldSchema, &$comparison) { @@ -528,31 +433,10 @@ protected function _generateFromComparison(&$migration, &$oldSchema, &$compariso } /** - * Generate a migration by comparing the database with schema.php. - * - * @param array &$migration Reference to variable of the same name in generate() method - * @param array &$oldSchema Reference to variable of the same name in generate() method - * @param array &$comparison Reference to variable of the same name in generate() method - * @return void (The variables passed by reference are changed; nothing is returned) - */ - protected function _generateFromInverseComparison(&$migration, &$oldSchema, &$comparison) { - $this->hr(); - $this->out(__d('migrations', 'Comparing database to the schema.php...')); - - if ($this->type !== 'migrations') { - unset($oldSchema->tables['schema_migrations']); - } - $database = $this->_readSchema(); - $comparison = $this->Schema->compare($database, $oldSchema); - $migration = $this->_fromComparison($migration, $comparison, $oldSchema->tables, $database['tables']); - } - -/** - * Generate a migration from arguments passed in at the command line - * - * @param array &$migration Reference to variable of the same name in generate() method - * @param array &$migrationName Reference to variable of the same name in generate() method - * @param array &$comparison Reference to variable of the same name in generate() method + * generate a migration from arguments passed in at the command line + * @param array $migration reference to variable of the same name in generate() method + * @param array $migrationName reference to variable of the same name in generate() method + * @param array $comparison reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateFromCliArgs(&$migration, &$migrationName, &$comparison) { @@ -589,12 +473,6 @@ protected function _generateFromCliArgs(&$migration, &$migrationName, &$comparis } } -/** - * Return list of field names from array of field/index definitions - * - * @param array $fields Field/index definitions - * @return array List of field names - */ protected function _fieldNamesArray($fields) { $fieldNames = array(); foreach ($fields as $name => $value) { @@ -607,13 +485,12 @@ protected function _fieldNamesArray($fields) { /** * Generate a dump of the current database. - * - * @param array &$migration Reference to variable of the same name in generate() method + * @param array $migration reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateDump(&$migration) { $this->hr(); - $this->out(__d('migrations', 'Generating dump from the current database...')); + $this->out(__d('migrations', 'Generating dump from current database...')); $dump = $this->_readSchema(); $dump = $dump['tables']; @@ -628,10 +505,9 @@ protected function _generateDump(&$migration) { /** * Finalizes the generated migration - offers to preview it, * prompts for a name, writes the file, and updates db version if needed. - * - * @param array &$migration Reference to variable of the same name in generate() method - * @param array &$migrationName Reference to variable of the same name in generate() method - * @param bool &$fromSchema Reference to variable of the same name in generate() method + * @param array $migration reference to variable of the same name in generate() method + * @param array $migrationName reference to variable of the same name in generate() method + * @param boolean $fromSchema reference to variable of the same name in generate() method * @return void */ protected function _finalizeGeneratedMigration(&$migration, &$migrationName, &$fromSchema) { @@ -659,7 +535,6 @@ protected function _finalizeGeneratedMigration(&$migration, &$migrationName, &$f /** * Prompt the user for a name for their new migration. - * * @return string */ protected function _promptForMigrationName() { @@ -709,13 +584,13 @@ public function status() { $this->out(__d('migrations', 'Current version:')); if ($version != 0) { $info = $mapping[$version]; - $this->out(' #' . sprintf("%'.03d", $info['version']) . ' ' . $info['name']); + $this->out(' #' . number_format($info['version'] / 100, 2, '', '') . ' ' . $info['name']); } else { $this->out(' ' . __d('migrations', 'None applied.')); } $this->out(__d('migrations', 'Latest version:')); - $this->out(' #' . sprintf("%'.03d", $latest['version']) . ' ' . $latest['name']); + $this->out(' #' . number_format($latest['version'] / 100, 2, '', '') . ' ' . $latest['name']); $this->hr(); } catch (MigrationVersionException $e) { continue; @@ -739,17 +614,17 @@ protected function _showInfo($mapping, $type = null) { if ($version != 0) { $info = $mapping[$version]; $this->out(__d('migrations', 'Current migration version:')); - $this->out(' #' . sprintf("%'.03d", $version) . ' ' . $info['name']); + $this->out(' #' . number_format($version / 100, 2, '', '') . ' ' . $info['name']); $this->hr(); } $this->out(__d('migrations', 'Available migrations:')); foreach ($mapping as $version => $info) { - $this->out(' [' . sprintf("%'.03d", $version) . '] ' . $info['name']); + $this->out(' [' . number_format($version / 100, 2, '', '') . '] ' . $info['name']); $this->out(' ', false); if ($info['migrated'] !== null) { - $this->out(__d('migrations', 'applied') . ' ' . CakeTime::nice(strtotime($info['migrated']))); + $this->out(__d('migrations', 'applied') . ' ' . date('r', strtotime($info['migrated']))); } else { $this->out(__d('migrations', 'not applied')); } @@ -819,30 +694,6 @@ protected function _fromComparison($migration, $comparison, $oldTables, $current return $migration; } -/** - * Gets the schema class name - * - * @param string $name Can be 'app' or a plugin name - * @param bool $suffix Return the class name with or without the "Schema" suffix, default is true - * @return string Returns the schema class name - */ - protected function _getSchemaClassName($name = null, $suffix = true) { - if (empty($name)) { - $name = $this->type; - } - if (!empty($this->params['schema-class'])) { - $name = $this->params['schema-class']; - } - $name = preg_replace('/[^a-zA-Z0-9]/', '', $name); - $name = Inflector::camelize($name); - if ($suffix === true && (substr($name, -6) !== 'Schema')) { - $name .= 'Schema'; - } elseif ($suffix === false && (substr($name, -6) === 'Schema')) { - $name = substr($name, 0, -6); - } - return $name; - } - /** * Load and construct the schema class if exists * @@ -854,49 +705,24 @@ protected function _getSchema($type = null) { $plugin = ($this->type === 'app') ? null : $this->type; return new CakeSchema(array('connection' => $this->connection, 'plugin' => $plugin)); } - - $folder = new Folder($this->_getPath($type) . 'Config' . DS . 'Schema'); - $schemaFiles = $folder->find('.*schema.*.php'); - - if (count($schemaFiles) === 0) { + $file = $this->_getPath($type) . 'Config' . DS . 'Schema' . DS . 'schema.php'; + if (!file_exists($file)) { return false; } + require_once $file; - $name = $this->_getSchemaClassName($type); - $file = $this->_findSchemaFile($folder, $schemaFiles, $name); + $name = Inflector::camelize($type) . 'Schema'; - if ($type === 'app' && empty($file)) { + if ($type === 'app' && !class_exists($name)) { $appDir = preg_replace('/[^a-zA-Z0-9]/', '', APP_DIR); $name = Inflector::camelize($appDir) . 'Schema'; - $file = $this->_getPath($type) . 'Config' . DS . 'Schema' . DS . 'schema.php'; } - require_once $file; - $plugin = ($type === 'app') ? null : $type; $schema = new $name(array('connection' => $this->connection, 'plugin' => $plugin)); return $schema; } -/** - * Finds schema file - * - * @param Folder $folder Folder object with schema folder path. - * @param string $schemaFiles Schema files inside schema folder. - * @param string $name Schema-class name. - * @return mixed null in case of no file found, schema file. - */ - protected function _findSchemaFile($folder, $schemaFiles, $name) { - foreach ($schemaFiles as $schemaFile) { - $file = new File($folder->pwd() . DS . $schemaFile); - $content = $file->read(); - if (strpos($content, $name) !== false) { - return $file->path; - } - } - return null; - } - /** * Reads the schema data * @@ -923,47 +749,9 @@ protected function _updateSchema() { if ($this->params['force']) { $command .= ' --force'; } - $command .= ' --file schema.php --name ' . $this->_getSchemaClassName($this->type, false); $this->dispatchShell($command); } -/** - * Overwrite the schema.php file - * - * @return void - */ - - protected function _overwriteSchema() { - $options = array(); - if ($this->params['force']) { - $options['models'] = false; - } elseif (!empty($this->params['models'])) { - $options['models'] = CakeText::tokenize($this->params['models']); - } - - $cacheDisable = Configure::read('Cache.disable'); - Configure::write('Cache.disable', true); - - $content = $this->Schema->read($options); - $file = 'schema.php'; - - Configure::write('Cache.disable', $cacheDisable); - - if (!empty($this->params['exclude']) && !empty($content)) { - $excluded = CakeText::tokenize($this->params['exclude']); - foreach ($excluded as $table) { - unset($content['tables'][$table]); - } - } - - if ($this->Schema->write($content)) { - $this->out(__d('cake_console', 'Schema file: %s generated', $file)); - return $this->_stop(); - } - $this->err(__d('cake_console', 'Schema file: %s generated')); - return $this->_stop(); - } - /** * Parse fields from the command line for use with generating new migration files * @@ -1010,12 +798,10 @@ protected function _parseCommandLineFields($name) { /** * Parse a single argument from the command line into the fields array - * - * @param array &$fields Reference to variable of same name in _parseCommandLineFields() - * @param array &$indexes Reference to variable of same name in _parseCommandLineFields() - * @param string $field A single command line argument - eg. 'id:primary_key' or 'name:string' - * @param array $validTypes Valid data types for the relevant database - eg. string, integer, biginteger, etc. - * @return void + * @param array $fields reference to variable of same name in _parseCommandLineFields() + * @param string $field a single command line argument - eg. 'id:primary_key' or 'name:string' + * @param array $validTypes valid data types for the relevant database - eg. string, integer, biginteger, etc. + * @return [type] [description] */ protected function _parseSingleCommandLineField(&$fields, &$indexes, $field, $validTypes) { if (preg_match('/^(\w*)(?::(\w*))?(?::(\w*))?(?::(\w*))?/', $field, $matches)) { @@ -1074,14 +860,6 @@ protected function _parseSingleCommandLineField(&$fields, &$indexes, $field, $va } } -/** - * Return valid field type based on name of field - * - * @param string $field Name of field - * @param string $type Current type - * @param array $validTypes List of valid types - * @return string Recognized type (eg. integer vs bigint) - */ protected function _getFieldType($field, $type, $validTypes) { if (!in_array($type, $validTypes)) { if ($field == 'id') { @@ -1167,9 +945,9 @@ protected function _generateMigration($name, $class, $migration) { * Write a migration with given name * * @param string $name Name of migration - * @param int $version The version number (timestamp) + * @param integer $version The version number (timestamp) * @param array $migration Migration instructions array - * @return bool + * @return boolean */ protected function _writeMigration($name, $version, $migration) { $content = ''; @@ -1189,12 +967,7 @@ protected function _values($values) { if (is_array($values)) { foreach ($values as $key => $value) { if (is_array($value)) { - if (array_keys($value) !== range(0, count($value) - 1)) { - $set = implode("', '", $this->_values($value)); - } else { - $set = "'" . implode("', '", $value) . "'"; - } - $_values[] = "'" . $key . "' => array(" . $set . ")"; + $_values[] = "'" . $key . "' => array('" . implode("', '", $value) . "')"; } elseif (!is_numeric($key)) { $value = var_export($value, true); $_values[] = "'" . $key . "' => " . $value; @@ -1240,27 +1013,18 @@ protected function _getPath($type = null) { /** * Callback used to display what migration is being runned * - * Additionally, shows the generation date of the migration, - * if the version is greater than '2000-01-01'. - * - * @param CakeMigration &$Migration Migration being performed + * @param CakeMigration $Migration Migration being performed * @param string $direction Direction being runned * @return void */ public function beforeMigration(&$Migration, $direction) { - $version = $Migration->info['version']; - $generationDate = ''; - if ($version > 946684800) { - $generationDate = ' (' . CakeTime::format($version, '%Y-%m-%d %H:%M:%S') . ')'; - } - $this->out(' [' . sprintf("%'.03d", $version) . '] ' . $Migration->info['name'] . $generationDate - ); + $this->out(' [' . number_format($Migration->info['version'] / 100, 2, '', '') . '] ' . $Migration->info['name']); } /** * Callback used to create a new line after the migration * - * @param CakeMigration &$Migration Migration being performed + * @param CakeMigration $Migration Migration being performed * @param string $direction Direction being runned * @return void */ @@ -1271,14 +1035,14 @@ public function afterMigration(&$Migration, $direction) { /** * Callback used to display actions being performed * - * @param CakeMigration &$Migration Migration being performed + * @param CakeMigration $Migration Migration being performed * @param string $type Type of action. i.e: create_table, drop_table, etc. * @param array $data Data to send to the callback * @return void */ public function beforeAction(&$Migration, $type, $data) { if (isset($this->_messages[$type])) { - $message = CakeText::insert($this->_messages[$type], $data); + $message = String::insert($this->_messages[$type], $data); $this->out(' > ' . $message); } } diff --git a/Console/Command/Templates/migration.ctp b/Console/Command/Templates/migration.ctp index 09c0334f..2a53f379 100644 --- a/Console/Command/Templates/migration.ctp +++ b/Console/Command/Templates/migration.ctp @@ -32,7 +32,7 @@ class extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -42,7 +42,7 @@ class extends CakeMigration { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; diff --git a/Docs/Documentation/Examples.md b/Docs/Documentation/Examples.md index c8b758c7..c71d7f54 100644 --- a/Docs/Documentation/Examples.md +++ b/Docs/Documentation/Examples.md @@ -69,6 +69,7 @@ Gets the status of all migrations. ``` cake Migrations.migration status ``` +<<<<<<< Updated upstream Adding a specific datasource -------------------------------------------------- @@ -105,4 +106,4 @@ If you want to jump to certain migration, you can use ```--jump-to``` or ```-j`` cake Migrations.migration run all -j 1458963215_articles_table ``` -Remember all migrations before this will be set as executed. \ No newline at end of file +Remember all migrations before this will be set as executed. diff --git a/Docs/Documentation/Installation.md b/Docs/Documentation/Installation.md index e975812e..171b1595 100644 --- a/Docs/Documentation/Installation.md +++ b/Docs/Documentation/Installation.md @@ -39,8 +39,4 @@ If any updates are added, go back to the base of your own repository, commit and Composer -------- -To install the plugin with the [Composer dependency manager](https://getcomposer.org/), run the following from your CakePHP project's ROOT directory (where the ``composer.json`` file is located): - -``` -php composer.phar require cakedc/migrations "~2.4.0" -``` +The plugin also provides a "composer.json" file, to easily use the plugin through the Composer dependency manager. diff --git a/Lib/CakeMigration.php b/Lib/CakeMigration.php index 65813886..7fe6898d 100644 --- a/Lib/CakeMigration.php +++ b/Lib/CakeMigration.php @@ -13,6 +13,7 @@ /** * Base Class for Migration management + * */ class CakeMigration extends Object { @@ -109,7 +110,7 @@ class CakeMigration extends Object { * If try, the SQL will be outputted to screen rather than * applied to the database * - * @var bool + * @var boolean */ public $dry = false; @@ -126,7 +127,7 @@ class CakeMigration extends Object { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -136,7 +137,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; @@ -145,7 +146,7 @@ public function after($direction) { /** * Log a dry run SQL query * - * @param string $sql SQL query + * @param str $sql * @return void */ public function logQuery($sql) { @@ -195,9 +196,10 @@ public function __construct($options = array()) { App::uses('PrecheckException', 'Migrations.Lib/Migration'); $this->Precheck = new PrecheckException(); } else { - list($plugin, $class) = pluginSplit($options['precheck'], true); - $class = Inflector::camelize($class); + $class = Inflector::camelize($options['precheck']); + list($plugin, $class) = pluginSplit($class, true); App::uses($class, $plugin . 'Lib/Migration'); + if (!class_exists($class)) { throw new MigrationException($this, sprintf( __d('migrations', 'Migration precheck class (%s) could not be loaded.'), $options['precheck'] @@ -218,7 +220,7 @@ public function __construct($options = array()) { * Run migration * * @param string $direction Direction of migration process (up or down) - * @return bool Status of the process + * @return boolean Status of the process * @throws MigrationException */ public function run($direction) { @@ -308,7 +310,7 @@ protected function _run() { * * @param string $a Type * @param string $b Type - * @return int Comparison value + * @return integer Comparison value */ protected function migration_order($a, $b) { $order = array('drop_table', 'rename_table', 'create_table', 'drop_field', 'rename_field', 'alter_field', 'create_field'); @@ -320,7 +322,7 @@ protected function migration_order($a, $b) { * * @param string $type Type of operation to be done, in this case 'create_table' * @param array $tables List of tables to be created - * @return bool Return true in case of success, otherwise false + * @return boolean Return true in case of success, otherwise false * @throws MigrationException */ protected function _createTable($type, $tables) { @@ -352,7 +354,7 @@ protected function _createTable($type, $tables) { * * @param string $type Type of operation to be done, in this case 'drop_table' * @param array $tables List of tables to be dropped - * @return bool Return true in case of success, otherwise false + * @return boolean Return true in case of success, otherwise false * @throws MigrationException */ protected function _dropTable($type, $tables) { @@ -381,7 +383,7 @@ protected function _dropTable($type, $tables) { * * @param string $type Type of operation to be done, this case 'rename_table' * @param array $tables List of tables to be renamed - * @return bool Return true in case of success, otherwise false + * @return boolean Return true in case of success, otherwise false * @throws MigrationException */ protected function _renameTable($type, $tables) { @@ -409,7 +411,7 @@ protected function _renameTable($type, $tables) { * * @param string $type Type of operation to be done * @param array $tables List of tables and fields - * @return bool Return true in case of success, otherwise false + * @return boolean Return true in case of success, otherwise false * @throws MigrationException */ protected function _alterTable($type, $tables) { @@ -571,11 +573,12 @@ protected function _invokeCallbacks($callback, $type, $data = array()) { * This method will invoke the before/afterAction callbacks, it is good when * you need track every action. * - * @param string $callback Callback name, beforeMigration, beforeAction or afterMigration. - * @param string $type Type of action (e.g. create_table, drop_table, etc.) - * Also can be the direction (before/after) for Migration callbacks + * @param string $callback Callback name, beforeMigration, beforeAction + * or afterMigration. + * @param string $type Type of action. i.e: create_table, drop_table, etc. + * Or also can be the direction, for before and after Migration callbacks * @param array $data Data to send to the callback - * @return bool + * @return boolean */ protected function _invokePrecheck($callback, $type, $data = array()) { if ($this->dry) { @@ -617,7 +620,7 @@ protected function _clearCache() { * * @param string $name Model name to be initialized * @param string $table Table name to be initialized - * @param array $options Model constructor options + * @param array $options * @return Model */ public function generateModel($name, $table = null, $options = array()) { @@ -636,6 +639,7 @@ public function generateModel($name, $table = null, $options = array()) { /** * Exception used when something goes wrong on migrations + * */ class MigrationException extends Exception { @@ -650,7 +654,7 @@ class MigrationException extends Exception { * * @param CakeMigration $Migration Reference to the Migration * @param string $message Message explaining the error - * @param int $code Error code + * @param integer $code Error code * @return \MigrationException */ public function __construct($Migration, $message = '', $code = 0) { diff --git a/Lib/Migration/PrecheckBase.php b/Lib/Migration/PrecheckBase.php index 18b63fc7..7f08771c 100644 --- a/Lib/Migration/PrecheckBase.php +++ b/Lib/Migration/PrecheckBase.php @@ -12,8 +12,6 @@ abstract class PrecheckBase { /** - * CakeMigration instance - * * @var CakeMigration */ protected $_migration; @@ -21,42 +19,42 @@ abstract class PrecheckBase { /** * Perform check before field create. * - * @param string $table Table to look for - * @param string $field Field to look for - * @return bool + * @param string $table + * @param string $field + * @return boolean */ abstract public function checkAddField($table, $field); /** * Perform check before table create. * - * @param string $table Table to look for - * @return bool + * @param string $table + * @return boolean */ abstract public function checkCreateTable($table); /** * Perform check before table drop. * - * @param string $table Table to look for - * @return bool + * @param string $table + * @return boolean */ abstract public function checkDropTable($table); /** * Perform check before field drop. * - * @param string $table Table to look for - * @param string $field Field to look for - * @return bool + * @param string $table + * @param string $field + * @return boolean */ abstract public function checkDropField($table, $field); /** * Check that table exists. * - * @param string $table Table to look for - * @return bool + * @param string $table + * @return boolean */ public function tableExists($table) { $this->_migration->db->cacheSources = false; @@ -67,9 +65,9 @@ public function tableExists($table) { /** * Check that field exists. * - * @param string $table Table to look for - * @param string $field Field to look for - * @return bool + * @param string $table + * @param string $field + * @return boolean */ public function fieldExists($table, $field) { if (!$this->tableExists($table)) { @@ -82,11 +80,11 @@ public function fieldExists($table, $field) { /** * Before action precheck callback. * - * @param CakeMigration $migration Migration to perform - * @param string $type Type of action being performed - * @param array $data Data passed to action + * @param $migration + * @param string $type + * @param array $data * @throws MigrationException - * @return bool + * @return boolean */ public function beforeAction($migration, $type, $data) { $this->_migration = $migration; diff --git a/Lib/Migration/PrecheckCondition.php b/Lib/Migration/PrecheckCondition.php index 2fcf5cde..326473d7 100644 --- a/Lib/Migration/PrecheckCondition.php +++ b/Lib/Migration/PrecheckCondition.php @@ -1,4 +1,4 @@ -tableExists($table); @@ -26,8 +26,8 @@ public function checkDropTable($table) { /** * Perform check before table create. * - * @param string $table Table to look for - * @return bool + * @param string $table + * @return boolean */ public function checkCreateTable($table) { return !$this->tableExists($table); @@ -36,9 +36,9 @@ public function checkCreateTable($table) { /** * Perform check before field drop. * - * @param string $table Table to look for - * @param string $field Field to look for - * @return bool + * @param string $table + * @param string $field + * @return boolean */ public function checkDropField($table, $field) { return $this->tableExists($table) && $this->fieldExists($table, $field); @@ -47,12 +47,13 @@ public function checkDropField($table, $field) { /** * Perform check before field create. * - * @param string $table Table to look for - * @param string $field Field to look for - * @return bool + * @param string $table + * @param string $field + * @return boolean */ public function checkAddField($table, $field) { return $this->tableExists($table) && !$this->fieldExists($table, $field); } } + diff --git a/Lib/Migration/PrecheckException.php b/Lib/Migration/PrecheckException.php index d6b7de01..fdeff04f 100644 --- a/Lib/Migration/PrecheckException.php +++ b/Lib/Migration/PrecheckException.php @@ -1,4 +1,4 @@ -tableExists($table)) { throw new MigrationException($this->_migration, - __d('migrations', 'Table "%s" does not exist in database.', $this->_migration->db->fullTableName($table, false, false)) + __d('migrations', 'Table "%s" does not exists in database.', $this->_migration->db->fullTableName($table, false, false)) ); } return true; } /** - * Check if table already exists. + * Check that table exists. * - * @param string $table Table to look for + * @param string $table * @throws MigrationException - * @return bool + * @return boolean */ public function checkCreateTable($table) { if ($this->tableExists($table)) { @@ -48,15 +48,15 @@ public function checkCreateTable($table) { /** * Perform check before field drop. * - * @param string $table Table to look in - * @param string $field Field to look for + * @param string $table + * @param string $field * @throws MigrationException - * @return bool + * @return boolean */ public function checkDropField($table, $field) { if ($this->tableExists($table) && !$this->fieldExists($table, $field)) { throw new MigrationException($this->_migration, sprintf( - __d('migrations', 'Field "%s" does not exist in "%s".'), $field, $table + __d('migrations', 'Field "%s" does not exists in "%s".'), $field, $table )); } return true; @@ -65,10 +65,10 @@ public function checkDropField($table, $field) { /** * Perform check before field create. * - * @param string $table Table to look in - * @param string $field Field to look for + * @param string $table + * @param string $field * @throws MigrationException - * @return bool + * @return boolean */ public function checkAddField($table, $field) { if ($this->tableExists($table) && $this->fieldExists($table, $field)) { @@ -79,4 +79,4 @@ public function checkAddField($table, $field) { return true; } -} +} \ No newline at end of file diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index 1663bc94..f0dca32f 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -18,6 +18,7 @@ /** * Migration version management. + * */ class MigrationVersion { @@ -64,7 +65,7 @@ class MigrationVersion { * If try, the SQL will be outputted to screen rather than * applied to the database * - * @var bool + * @var boolean */ public $dry = false; @@ -134,6 +135,7 @@ public function __construct($options = array()) { * * @return void */ + public function initVersion() { $this->Version = ClassRegistry::init(array( 'class' => 'Migrations.SchemaMigration', @@ -146,7 +148,7 @@ public function initVersion() { * Get last version for given type * * @param string $type Can be 'app' or a plugin name - * @return int Last version migrated + * @return integer Last version migrated */ public function getVersion($type) { $mapping = $this->getMapping($type); @@ -165,11 +167,11 @@ public function getVersion($type) { /** * Set current version for given type * - * @param int $version Current version + * @param integer $version Current version * @param string $type Can be 'app' or a plugin name - * @param bool $migrated If true, will add the record to the database + * @param boolean $migrated If true, will add the record to the database * If false, will remove the record from the database - * @return bool + * @return boolean */ public function setVersion($version, $type, $migrated = true) { if ($this->dry) { @@ -208,7 +210,7 @@ public function setVersion($version, $type, $migrated = true) { * Get mapping for the given type * * @param string $type Can be 'app' or a plugin name - * @param bool $cache Whether to return the cached value or not + * @param boolean $cache * @return mixed False in case of no file found or empty mapping, array with mapping */ public function getMapping($type, $cache = true) { @@ -283,7 +285,7 @@ public function getMapping($type, $cache = true) { * @param string $class Migration class name * @param string $type Can be 'app' or a plugin name * @param array $options Extra options to send to CakeMigration class - * @return bool|CakeMigration False in case of no file found, instance of the migration + * @return boolean|CakeMigration False in case of no file found, instance of the migration * @throws MigrationVersionException */ public function getMigration($name, $class, $type, $options = array()) { @@ -313,7 +315,7 @@ public function getMigration($name, $class, $type, $options = array()) { * - `version` - Until what version want migrate to * * @param array $options An array with options. - * @return bool + * @return boolean * @throws Exception */ public function run($options) { @@ -333,10 +335,6 @@ public function run($options) { } } - if (!empty($this->skip) && is_string($this->skip)) { - $this->skip = explode(',', trim($this->skip)); - } - if ($direction === 'up' && !isset($options['version'])) { $keys = array_keys($mapping); $flipped = array_flip($keys); @@ -368,11 +366,6 @@ public function run($options) { continue; } - if (in_array($mapping[$version]['name'], $this->skip)) { - $this->setVersion($version, $info['type']); - continue; - } - $migration = $this->getMigration($info['name'], $info['class'], $info['type'], $options); $migration->Version = $this; $migration->info = $info; @@ -380,18 +373,16 @@ public function run($options) { try { $result = $migration->run($direction, $options); $this->log[$info['name']] = $migration->getQueryLog(); - } catch (MigrationException $migrationException){ - throw $migrationException; // throw to MigrationShell::_execute } catch (Exception $exception) { $mapping = $this->getMapping($options['type']); if (isset($mapping[$latestVersion]['version'])) { $latestVersionName = '#' . - sprintf("%'.03d", $mapping[$latestVersion]['version']) . ' ' . + number_format($mapping[$latestVersion]['version'] / 100, 2, '', '') . ' ' . $mapping[$latestVersion]['name']; } else { $latestVersionName = null; } - $errorMessage = __d('migrations', "There was an error during a migration. \n The error was: '%s' \n You must resolve the issue manually and try again.", $exception->getMessage(), $latestVersionName); + $errorMessage = __d('migrations', sprintf("There was an error during a migration. \n The error was: '%s' \n You must resolve the issue manually and try again.", $exception->getMessage(), $latestVersionName)); return $errorMessage; } @@ -402,6 +393,7 @@ public function run($options) { if (isset($result)) { return $result; } + return true; } @@ -559,6 +551,7 @@ protected function _enumerateOldMigrations($type) { /** * Usually used when migrations file/class or map files are not found + * */ class MigrationVersionException extends Exception { diff --git a/Lib/Panel/MigrationsPanel.php b/Lib/Panel/MigrationsPanel.php index e98a4d87..78837e8a 100644 --- a/Lib/Panel/MigrationsPanel.php +++ b/Lib/Panel/MigrationsPanel.php @@ -22,6 +22,7 @@ * 'panels' => array('Migrations.migrations') * )); * @@@ + * */ class MigrationsPanel extends DebugPanel { @@ -56,7 +57,7 @@ class MigrationsPanel extends DebugPanel { /** * BeforeRender Callback * - * @param Controller $controller Current controller + * @param Controller $controller * @return array */ public function beforeRender(Controller $controller) { diff --git a/Locale/deu/LC_MESSAGES/migrations.po b/Locale/deu/LC_MESSAGES/migrations.po index 4c06b127..f2e3d05b 100644 --- a/Locale/deu/LC_MESSAGES/migrations.po +++ b/Locale/deu/LC_MESSAGES/migrations.po @@ -8,20 +8,22 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" -"PO-Revision-Date: 2015-03-09 17:41-0000\n" -"Last-Translator: Chris Burke \n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"PO-Revision-Date: 2014-07-18 18:28+0100\n" +"Last-Translator: Florian Krämer \n" "Language-Team: Cake Development Corporation \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" +"X-Poedit-Language: GERMAN\n" +"X-Poedit-Country: GERMANY\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" @@ -76,181 +78,176 @@ msgstr "Füge index \":index\" zu \":table\" hinzu." msgid "Dropping index \":index\" from table \":table\"." msgstr "Verwerfe index \":index\" von \":table\"." -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "Keine Migrationen verfügbar." -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "Führe Migrationen aus:" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" -msgstr "" -"Migration führt einen Trockentest durch. Es werden keine Änderungen an der " -"Datenbank vorgenommen." +msgstr "Migration führt einen Trockentest durch. Es werden keine Änderungen an der Datenbank vorgenommen." -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "Alle Migrationen wurden durchgeführt." -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "Es trat ein Fehler während der Durchführung der Migration auf:" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "Migration: %s" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "Error: %s" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." msgstr "Wollen Sie die Migration als erfolgreich markieren? [y]Ja oder [a]bbrechen" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "Dies ist keine gültige Migrationsversion" -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." -msgstr "" -"Bitte wählen Sie zu welcher Version sie migrieren wollen. [q] um zu beenden oder " -"[c] zum aufräumen." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +msgstr "Bitte wählen Sie zu welcher Version sie migrieren wollen. [q] um zu beenden " +"oder [c] zum aufräumen." -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." -msgstr "Keine Datenbankänderungen erkannt." - -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" msgstr "Möchten Sie einen Dump von der aktuellen Datenbank generieren?" -#: Console/Command/MigrationShell.php:422 +#: Console/Command/MigrationShell.php:390 #, fuzzy -msgid "Do you want to update the schema.php file?" -msgstr "Möchten Sie die schema.php Datei aktualisieren?" +msgid "Do you want update the schema.php file?" +msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "Vergleiche schema.php mit der Datenbank..." -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generiere Migration anhand der Kommandozeilenparameter..." -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" msgstr "Üngültiger Parameter" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration from " -"the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration " +"from the CLI." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "Generiere Dump von aktueller Datenbank..." -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "Generiere Migration..." -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "Fertig." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "" -"Bitte geben Sie einen deskriptiven Namen für die zu generierende Migration ein." +"Bitte geben Sie einen deskriptiven Namen für die zu generierende Migration " +"ein." -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters and " -"start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters " +"and start with a letter." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 #, fuzzy -msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "" +"Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "Aktuelle Version:" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "Nicht angewandt." -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "Letzte Version:" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "Aktuelle Migrations Version:" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "Verfügbare Migrationen:" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "angewandt" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "nicht angewandt" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" -msgstr "Fehlende erforderliche Argument 'name' für die Migration" +msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." -msgstr "Migration Vorprüfung Klasse (%s) konnte nicht geladen werden." +msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Die Migrationsrichtung (%s) ist keine gültige Richtung." -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "Die Migrationsrichtung (%s) ist keine gültige Richtung." -#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Der Aktionstyp (%s) der Migration ist kein gültiger Aktionstyp." -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "SQL Error: %s" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "Unterbrechung" @@ -258,12 +255,12 @@ msgstr "Unterbrechung" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Klasse `%1$s` nicht gefunden in Datei `%2$s` für %3$s." -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "Datei `%1$s` nicht gefunden in %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "Die Tabelle \"%s\" existiert nicht in der Datenbank." #: Lib/Migration/PrecheckException.php:42 @@ -271,7 +268,7 @@ msgid "Table \"%s\" already exists in database." msgstr "Die Tabelle \"%s\" existiert bereits in der Datenbank." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "Das Feld \"%s\" existiert nicht in der Tabelle \"%s\" ." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/fre/LC_MESSAGES/migrations.po b/Locale/fre/LC_MESSAGES/migrations.po index 6515d956..93700983 100644 --- a/Locale/fre/LC_MESSAGES/migrations.po +++ b/Locale/fre/LC_MESSAGES/migrations.po @@ -8,25 +8,26 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" "PO-Revision-Date: \n" -"Last-Translator: Chris Burke \n" +"Last-Translator: Pierre MARTIN \n" "Language-Team: Cake Development Corporation \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" +"X-Poedit-Language: FRENCH\n" +"X-Poedit-Country: FRANCE\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" -"Désolé, je ne peux pas rétrograder. Pourquoi voudriez-vous que de toute façon?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -77,184 +78,179 @@ msgstr "Ajout de l'index :index à :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Suppression de l'index :index de :table." -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "Aucune migration disponible." -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "Exécution des migrations :" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" msgstr "" -"Migration va fonctionner à sec, pas de changement de base de données seront " -"effectués" -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "Toutes les migrations ont été exécutées." -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "Une erreur est apparue lors de l'exécution de la migration :" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "Migration : %s" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "Erreur : %s" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "Voulez-vous marquer la migration réussie ? [y] oui ou [a]vorter." +msgstr "" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "Version de migration invalide." -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." msgstr "" -"Veuillez choisir la version vers laquelle vous souhaitez migrer. [q]uitter ou [c] " -"pour nettoyer" +"Veuillez choisir la version vers laquelle vous souhaitez migrer. [q]uitter " +"ou [c] pour nettoyer" -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." -msgstr "Aucun changement de base de données détectées." - -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" msgstr "Voulez vous générer un dump de votre base de données actuelle ?" -#: Console/Command/MigrationShell.php:422 +#: Console/Command/MigrationShell.php:390 #, fuzzy -msgid "Do you want to update the schema.php file?" +msgid "Do you want update the schema.php file?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "Comparaison de schema.php à la base de données ..." -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Génération de la Migration ..." -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" -msgstr "Invalid argument" +msgstr "" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration from " -"the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration " +"from the CLI." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " -"alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " +"caractères alphanumériques." -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "Génération d'un dump de la base de données actuelle ..." -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "Génération de la Migration ..." -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "Exécuté." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Veuillez entrer le nom décrivant la migration à générer :" -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters and " -"start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters " +"and start with a letter." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " -"alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " +"caractères alphanumériques." -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 #, fuzzy -msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "" +"Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " -"alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " +"caractères alphanumériques." -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "Version actuelle :" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "Aucune appliquée." -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "Dernière version :" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "Version actuelle de la Migration :" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "Migrations disponibles :" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "appliquée" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "non appliquée" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" -msgstr "Nécessaire argument 'nom' de la migration manquant" +msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." -msgstr "Migration classe de précontrôle (%s) n'a pas pu être chargé." +msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "" "La direction de la Migration (%s) ne fait pas partie des directions valides." -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "" "La direction de la Migration (%s) ne fait pas partie des directions valides." -#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "" "Le type d'action de la Migration (%s) ne fait pas partie des type d'actions " "valides." -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "Erreur SQL : %s" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "Interrompu lors de l'exécution du callback \"%s\"." @@ -262,12 +258,12 @@ msgstr "Interrompu lors de l'exécution du callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` introuvable dans le fichier `%2$s` pour %3$s." -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "Fichier `%1$s` introuvable dans %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "La table \"%s\" n'existe pas dans la base de données." #: Lib/Migration/PrecheckException.php:42 @@ -275,7 +271,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La table \"%s\" existe déjà dans la base de données." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "Le champ \"%s\" n'existe pas dans \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/ita/LC_MESSAGES/migrations.po b/Locale/ita/LC_MESSAGES/migrations.po index 3269d6de..1c907d40 100644 --- a/Locale/ita/LC_MESSAGES/migrations.po +++ b/Locale/ita/LC_MESSAGES/migrations.po @@ -8,25 +8,26 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" -"PO-Revision-Date: 2015-03-09 17:40-0000\n" -"Last-Translator: Chris Burke \n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"PO-Revision-Date: 2014-07-18 18:42+0100\n" +"Last-Translator: Donald \"Lanodd\" Gagliano \n" "Language-Team: Cake Development Corporation \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Poedit-Language: Italian\n" +"X-Poedit-Country: ITALY\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" -"Mi dispiace, non posso effettuare il downgrade. Perché si vuole che in ogni modo?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -77,179 +78,175 @@ msgstr "Aggiunta indice :index a :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Rimozione indice :index da :table." -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "Nessuna migrazione disponibile." -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "Esecuzione delle migrazioni:" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" msgstr "" -"La migrazione verrà eseguito a secco, saranno apportate modifiche di database" -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "Tutte le migrazioni sono state completate." -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "Si è verificato un errore nell'esecuzione della migrazione:" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "Migrazione: %s" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "Errore: %s" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "Vuoi segnare la migrazione di successo ?. [y] SI o [a]bortire." +msgstr "" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "Versione di migrazione non valida." -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." msgstr "" -"Per favore, scegliere la versione alla quale si desidera migrare. [q] per uscire " -"o [c] per pulire." +"Per favore, scegliere la versione alla quale si desidera migrare. [q] per " +"uscire o [c] per pulire." -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." -msgstr "Nessuna modifica del database rilevato." - -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" msgstr "Vuoi generare un dump del database corrente?" -#: Console/Command/MigrationShell.php:422 +#: Console/Command/MigrationShell.php:390 #, fuzzy -msgid "Do you want to update the schema.php file?" +msgid "Do you want update the schema.php file?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "Comparazione di schema.php col database..." -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generazione delle Migrazioni..." -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" -msgstr "Argomento non valido" +msgstr "" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration from " -"the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration " +"from the CLI." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "Generazione dump del database corrente..." -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "Generazione delle Migrazioni..." -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "Fatto." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Per favore inserire il nome descrittivo della migrazione da generare:" -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters and " -"start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters " +"and start with a letter." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 #, fuzzy -msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "" +"Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "Versione corrente:" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "Nessuna applicata." -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "Versione più recente:" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "Versione della migrazione corrente:" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "Migrazioni disponibili:" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "applicato" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "non applicato" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" -msgstr "Mancante richiesta argomento 'nome' per la migrazione" +msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." -msgstr "Migrazione classe controllo preliminare (%s) non ha potuto essere caricato." +msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "La direzione di migrazione (%s) non è una delle direzioni valide." -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "La direzione di migrazione (%s) non è una delle direzioni valide." -#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Il tipo di azione (%s) non è un tipo di azione valido." -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "Errore SQL: %s" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "Interrotto durante l'esecuzione della callback \"%s\"." @@ -257,12 +254,12 @@ msgstr "Interrotto durante l'esecuzione della callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` non trovata nel file `%2$s` per %3$s." -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "File `%1$s` non trovato in %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "La tabella \"%s\" non esiste nel database." #: Lib/Migration/PrecheckException.php:42 @@ -270,7 +267,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La tabella \"%s\" esiste già nel database." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "il campo \"%s\" non esiste in \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/migrations.pot b/Locale/migrations.pot index d6854948..169b6664 100644 --- a/Locale/migrations.pot +++ b/Locale/migrations.pot @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" "Last-Translator: NAME \n" "Language-Team: Cake Development Corporation \n" @@ -66,160 +66,156 @@ msgstr "" msgid "Dropping index \":index\" from table \":table\"." msgstr "" -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "" -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" msgstr "" -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "" -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." msgstr "" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "" -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." msgstr "" -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" msgstr "" -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" +#: Console/Command/MigrationShell.php:390 +msgid "Do you want update the schema.php file?" msgstr "" -#: Console/Command/MigrationShell.php:422 -msgid "Do you want to update the schema.php file?" -msgstr "" - -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "" -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 msgid "Generating migration from commandline arguments..." msgstr "" -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" msgstr "" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 msgid "Migration name (%s) is invalid. It cannot be used to generate a migration from the CLI." msgstr "" -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "" -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 msgid "Do you want to preview the file before generation?" msgstr "" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "" -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "" -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "" -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 msgid "Migration name (%s) is invalid. It must only contain alphanumeric characters and start with a letter." msgstr "" -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "" -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "" -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "" -#: Lib/CakeMigration.php:295 -#: Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 +#: Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "" -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "" @@ -227,12 +223,12 @@ msgstr "" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "" -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "" #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "" #: Lib/Migration/PrecheckException.php:42 @@ -240,7 +236,7 @@ msgid "Table \"%s\" already exists in database." msgstr "" #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "" #: Lib/Migration/PrecheckException.php:76 @@ -250,4 +246,3 @@ msgstr "" #: View/Elements/migrations_panel.ctp:12 msgid "Migration Status" msgstr "" - diff --git a/Locale/por/LC_MESSAGES/migrations.po b/Locale/por/LC_MESSAGES/migrations.po index e8db05d0..d5c9b80e 100644 --- a/Locale/por/LC_MESSAGES/migrations.po +++ b/Locale/por/LC_MESSAGES/migrations.po @@ -8,26 +8,26 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" -"PO-Revision-Date: 2015-03-09 17:39-0000\n" -"Last-Translator: Chris Burke \n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"PO-Revision-Date: 2014-07-18 18:42+0100\n" +"Last-Translator: Renan Gonçalves \n" "Language-Team: Cake Development Corporation \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" +"X-Poedit-Language: Portuguese\n" +"X-Poedit-Country: BRAZIL\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" -"Desculpe, eu não posso fazer o downgrade. Por que você quer que de qualquer " -"maneira?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -78,172 +78,174 @@ msgstr "Adicionar chave :index para :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Removendo chave :index de :table." -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "Nenhuma migração disponível." -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "Rodando migrações:" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" -msgstr "Migração secará, sem alterações de banco de dados será feita" +msgstr "" -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "Todas as migrações foram completas." -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "Aconteceu um erro enquanto processava a migração:" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "Migração: %s" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "Erro: %s" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "Você quer marcar a migração tão bem sucedido ?. [y] sim ou [a]bortar." +msgstr "" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "Não é uma versão de migração válida," -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." -msgstr "Por favor, escolha para qual versão você deseja migrar. [q]uit ou [c]lean." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +msgstr "" +"Por favor, escolha para qual versão você deseja migrar. [q]uit ou [c]lean." -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." -msgstr "" - -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" msgstr "Você deseja gerar um dump do banco de dados atual?" -#: Console/Command/MigrationShell.php:422 +#: Console/Command/MigrationShell.php:390 #, fuzzy -msgid "Do you want to update the schema.php file?" +msgid "Do you want update the schema.php file?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "Comparando schema.php com o banco de dados..." -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 +#, fuzzy msgid "Generating migration from commandline arguments..." -msgstr "Gerando migração de argumentos de linha de comando ..." +msgstr "Gerando Migração..." -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" -msgstr "Invalid argument" +msgstr "" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration from " -"the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration " +"from the CLI." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " +"alfanuméricos." -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "Gerando dump do banco de dados atual..." -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "Gerando Migração..." -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "Feito." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Por favor entre com um nome descritivo para a migração a ser gerada:" -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters and " -"start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters " +"and start with a letter." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " +"alfanuméricos." -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 #, fuzzy -msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "" +"Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " +"alfanuméricos." -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "Versão atual:" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "Nenhuma aplicada." -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "Última versão:" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "Versão de Migração atual:" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "Migrações disponíveis:" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "aplicada" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "não aplicada" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" -msgstr "Faltando exigido argumento 'nome' para migração" +msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." -msgstr "Migração classe pré-verificação (%s) não pôde ser carregado." +msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Direção da Migração (%s) não é uma das direções válidas." -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "Direção da Migração (%s) não é uma das direções válidas." -#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Tipo de ação (%s) da Migração não é um dos tipos de ações válidos." -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "Erro SQL: %s" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "Interrompido enquanto rodava o callback \"%s\"." @@ -251,12 +253,12 @@ msgstr "Interrompido enquanto rodava o callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` não encontrado no arquivo `%2$s` para %3$s." -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "Arquivo `%1$s` não encontrada no %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "Table \"%s\" não existe no banco de dados." #: Lib/Migration/PrecheckException.php:42 @@ -264,7 +266,7 @@ msgid "Table \"%s\" already exists in database." msgstr "Tabela \"%s\" já existe no banco de dados." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "Coluna \"%s\" não existe em \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/spa/LC_MESSAGES/migrations.po b/Locale/spa/LC_MESSAGES/migrations.po index 2075cfa3..70eb0930 100644 --- a/Locale/spa/LC_MESSAGES/migrations.po +++ b/Locale/spa/LC_MESSAGES/migrations.po @@ -8,24 +8,25 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # +#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2015-03-09 17:36+0000\n" -"PO-Revision-Date: 2015-03-09 17:39-0000\n" -"Last-Translator: Chris Burke \n" +"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"PO-Revision-Date: 2014-07-18 18:42+0100\n" +"Last-Translator: José Lorenzo Rodríguez \n" "Language-Team: Cake Development Corporation \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" +"X-Poedit-Language: Spanish\n" "X-Poedit-SourceCharset: utf-8\n" -"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" -msgstr "Lo siento, no puedo retroceder. ¿Por qué quieres que de todos modos?" +msgstr "" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -76,177 +77,175 @@ msgstr "Agregando índice :index a :table" msgid "Dropping index \":index\" from table \":table\"." msgstr "Eliminando índice :index de :table" -#: Console/Command/MigrationShell.php:195 +#: Console/Command/MigrationShell.php:190 msgid "No migrations available." msgstr "No hay migraciones disponibles" -#: Console/Command/MigrationShell.php:225 +#: Console/Command/MigrationShell.php:220 msgid "Running migrations:" msgstr "Ejecutando migraciones:" -#: Console/Command/MigrationShell.php:237 +#: Console/Command/MigrationShell.php:232 msgid "Migration will run dry, no database changes will be made" -msgstr "La migración se secará, no se harán cambios de base de datos" +msgstr "" -#: Console/Command/MigrationShell.php:246 +#: Console/Command/MigrationShell.php:241 msgid "All migrations have completed." msgstr "Todas las migraciones han sido completadas" -#: Console/Command/MigrationShell.php:264 +#: Console/Command/MigrationShell.php:252 msgid "An error occurred when processing the migration:" msgstr "Un error ha ocurrido al procesar la migración:" -#: Console/Command/MigrationShell.php:265 +#: Console/Command/MigrationShell.php:253 msgid "Migration: %s" msgstr "Migración: %s" -#: Console/Command/MigrationShell.php:266 +#: Console/Command/MigrationShell.php:254 msgid "Error: %s" msgstr "Error: %s" -#: Console/Command/MigrationShell.php:270 +#: Console/Command/MigrationShell.php:258 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "¿Quieres marcar la migración como un éxito? [y] SÍ o [a]bortar." +msgstr "" -#: Console/Command/MigrationShell.php:326;346;373 +#: Console/Command/MigrationShell.php:306;319;346 msgid "Not a valid migration version." msgstr "No es una versión de migración válida" -#: Console/Command/MigrationShell.php:354 -msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:327 +msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." msgstr "" "Por favor, escoge la versión a lo cual deseas migrar. [q] salir o [c] limpiar" -#: Console/Command/MigrationShell.php:400 -msgid "Do you want to compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:373 +msgid "Do you want compare the schema.php file to the database?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:405 -msgid "No database changes detected." -msgstr "No hay cambios de base de datos detectados." - -#: Console/Command/MigrationShell.php:411 -msgid "Do you want to generate a dump from the current database?" -msgstr "¿Desea generar un volcado completo de la estructura de su base de datos?" +#: Console/Command/MigrationShell.php:379 +msgid "Do you want generate a dump from current database?" +msgstr "" +"¿Desea generar un volcado completo de la estructura de su base de datos?" -#: Console/Command/MigrationShell.php:422 +#: Console/Command/MigrationShell.php:390 #, fuzzy -msgid "Do you want to update the schema.php file?" +msgid "Do you want update the schema.php file?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:439 +#: Console/Command/MigrationShell.php:406 msgid "Comparing schema.php to the database..." msgstr "Comparando schema.php con la base de datos..." -#: Console/Command/MigrationShell.php:459 +#: Console/Command/MigrationShell.php:425 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generando migración" -#: Console/Command/MigrationShell.php:487;842 +#: Console/Command/MigrationShell.php:453;775 msgid "Invalid argument" -msgstr "Argumento no válido" +msgstr "" -#: Console/Command/MigrationShell.php:487 +#: Console/Command/MigrationShell.php:453 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration from " -"the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration " +"from the CLI." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:515 -msgid "Generating dump from the current database..." +#: Console/Command/MigrationShell.php:474 +msgid "Generating dump from current database..." msgstr "Generando volcado de la base de datos actual" -#: Console/Command/MigrationShell.php:537 +#: Console/Command/MigrationShell.php:495 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:547 +#: Console/Command/MigrationShell.php:506 msgid "Generating Migration..." msgstr "Generando migración" -#: Console/Command/MigrationShell.php:556 +#: Console/Command/MigrationShell.php:515 msgid "Done." msgstr "Listo." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:524 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Por favor ingrese el nombre descriptivo de la migración a generar:" -#: Console/Command/MigrationShell.php:569 +#: Console/Command/MigrationShell.php:527 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters and " -"start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters " +"and start with a letter." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:572 +#: Console/Command/MigrationShell.php:530 #, fuzzy -msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "" +"Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:608 +#: Console/Command/MigrationShell.php:566 msgid "Current version:" msgstr "Versión Actual:" -#: Console/Command/MigrationShell.php:613 +#: Console/Command/MigrationShell.php:571 msgid "None applied." msgstr "Ninguna aplicada." -#: Console/Command/MigrationShell.php:616 +#: Console/Command/MigrationShell.php:574 msgid "Latest version:" msgstr "Última versión:" -#: Console/Command/MigrationShell.php:640 +#: Console/Command/MigrationShell.php:598 msgid "Current migration version:" msgstr "Versión de migración actual:" -#: Console/Command/MigrationShell.php:645 +#: Console/Command/MigrationShell.php:603 msgid "Available migrations:" msgstr "Migraciones disponibles:" -#: Console/Command/MigrationShell.php:651 +#: Console/Command/MigrationShell.php:609 msgid "applied" msgstr "applicada" -#: Console/Command/MigrationShell.php:653 +#: Console/Command/MigrationShell.php:611 msgid "not applied" msgstr "no aplicada" -#: Console/Command/MigrationShell.php:842 +#: Console/Command/MigrationShell.php:775 msgid "Missing required argument 'name' for migration" -msgstr "Missing requerido argumento 'nombre' para la migración" +msgstr "" -#: Lib/CakeMigration.php:205 +#: Lib/CakeMigration.php:204 msgid "Migration precheck class (%s) could not be loaded." -msgstr "Clase de comprobación previa Migraciones (%s) no se pudo cargar." +msgstr "" -#: Lib/CakeMigration.php:213 +#: Lib/CakeMigration.php:212 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Dirección (%s) de migración no es válida" -#: Lib/CakeMigration.php:229 +#: Lib/CakeMigration.php:228 msgid "Migration direction (%s) is not one of valid directions." msgstr "Dirección (%s) de migración no es válida" -#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 +#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Acción de tipo %s no es una acción válida" -#: Lib/CakeMigration.php:343;373;401;489;529 +#: Lib/CakeMigration.php:343;373;401;488;528 msgid "SQL Error: %s" msgstr "Error SQL: %s" -#: Lib/CakeMigration.php:567 +#: Lib/CakeMigration.php:566 msgid "Interrupted when running \"%s\" callback." msgstr "Iterrumpido al llamar la función \"%s\"" @@ -254,12 +253,12 @@ msgstr "Iterrumpido al llamar la función \"%s\"" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Clase`%1$s` no encontrada en archivo `%2$s` para %3$s." -#: Lib/MigrationVersion.php:410 +#: Lib/MigrationVersion.php:408 msgid "File `%1$s` not found in the %2$s." msgstr "Archivo`%1$s` no encontrado en %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exist in database." +msgid "Table \"%s\" does not exists in database." msgstr "La tabla \"%s\" no existe en la base de datos." #: Lib/Migration/PrecheckException.php:42 @@ -267,7 +266,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La tabla \"%s\" ya existe en la base de datos." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exist in \"%s\"." +msgid "Field \"%s\" does not exists in \"%s\"." msgstr "El campo \"%s\" no existe en \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Model/SchemaMigration.php b/Model/SchemaMigration.php index 8108f77a..9dafb632 100644 --- a/Model/SchemaMigration.php +++ b/Model/SchemaMigration.php @@ -11,10 +11,10 @@ /** * Default model for manipulating schema migrations - * + * * There is no custom logic yet, but it needs to extends Model instead of AppModel. That is the * reason why a ghost model cannot be used instead */ class SchemaMigration extends Model { -} +} \ No newline at end of file diff --git a/README.md b/README.md index 93091c9b..d7997006 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ However, you can make use of the ```before()``` and ```after()``` callbacks in t Requirements ------------ -* CakePHP 2.7.0+ -* PHP 5.3.0+ +* CakePHP 2.5+ +* PHP 5.2.8+ Documentation ------------- @@ -34,7 +34,7 @@ For documentation, as well as tutorials, see the [Docs](Docs/Home.md) directory Support ------- -For bugs and feature requests, please use the [issues](https://github.com/CakeDC/migrations/issues) section of this repository. +For bugs and feature requests, please use the [issues](https://github.com/CakeDC/migrations/issues) section of this repository. Commercial support is also available, [contact us](http://cakedc.com/contact) for more information. @@ -48,4 +48,4 @@ License Copyright 2007-2014 Cake Development Corporation (CakeDC). All rights reserved. -Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file. +Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file. \ No newline at end of file diff --git a/Test/Case/Console/Command/MigrationShellTest.php b/Test/Case/Console/Command/MigrationShellTest.php index 4dba0b63..ef7b06ec 100644 --- a/Test/Case/Console/Command/MigrationShellTest.php +++ b/Test/Case/Console/Command/MigrationShellTest.php @@ -14,6 +14,7 @@ /** * TestMigrationShell + * */ class TestMigrationShell extends MigrationShell { @@ -63,6 +64,7 @@ public function writeMigration($name, $class, $migration) { /** * MigrationShellTest + * */ class MigrationShellTest extends CakeTestCase { @@ -119,11 +121,12 @@ public function tearDown() { CakePlugin::unload('TestMigrationPlugin'); CakePlugin::unload('TestMigrationPlugin2'); CakePlugin::unload('TestMigrationPlugin3'); - CakePlugin::unload('TestMigrationPlugin4'); App::build(array('Plugin' => $this->plugins), true); App::objects('plugins', null, false); unset($this->Dispatcher, $this->Shell, $this->plugins); - $this->_unlink(glob(TMP . 'tests' . DS . '*.php')); + foreach (glob(TMP . 'tests' . DS . '*.php') as $f) { + unlink($f); + } } /** @@ -168,11 +171,6 @@ public function testStartup() { $this->Shell->startup(); $this->assertEquals($this->Shell->connection, 'test'); $this->assertEquals($this->Shell->type, 'Migrations'); - - $this->Shell->expects($this->any())->method('in')->will($this->returnValue('test')); - $this->Shell->expects($this->any())->method('_startMigrationConnection')->will($this->returnValue('test')); - $this->Shell->startup(); - $this->assertEquals($this->Shell->migrationConnection, 'test'); } /** @@ -624,7 +622,7 @@ public function testFromComparisonFieldActions() { */ public function testWriteMigration() { // Remove if exists - $this->_unlink(array(TMP . 'tests' . DS . '12345_migration_test_file.php')); + $this->_unlink('12345_migration_test_file.php'); $users = $this->tables['users']; $users['indexes'] = array('UNIQUE_USER' => array('column' => 'user', 'unique' => true)); @@ -686,7 +684,7 @@ public function testWriteMigration() { ); TEXT; $this->assertEquals($result, str_replace("\r\n", "\n", $expected)); - $this->_unlink(array(TMP . 'tests' . DS . '12345_migration_test_file.php')); + $this->_unlink('12345_migration_test_file.php'); } /** @@ -696,7 +694,7 @@ public function testWriteMigration() { * @link https://github.com/CakeDC/migrations/issues/189 */ public function testWriteMigrationIndexesOnly() { - $this->_unlink(array(TMP . 'tests' . DS . '12346_migration_test_file.php')); + $this->_unlink('12345_migration_test_file.php'); $users = $this->tables['users']; $users['indexes'] = array('UNIQUE_USER' => array('column' => 'user', 'unique' => true)); @@ -719,10 +717,11 @@ public function testWriteMigrationIndexesOnly() { ) ); - $this->assertTrue($this->Shell->writeMigration('migration_test_file', 12346, $migration)); - $this->assertTrue(file_exists(TMP . 'tests' . DS . '12346_migration_test_file.php')); + $this->assertFalse(file_exists(TMP . 'tests' . DS . '12345_migration_test_file.php')); + $this->assertTrue($this->Shell->writeMigration('migration_test_file', 12345, $migration)); + $this->assertTrue(file_exists(TMP . 'tests' . DS . '12345_migration_test_file.php')); - $result = $this->_getMigrationVariable(TMP . 'tests' . DS . '12346_migration_test_file.php'); + $result = $this->_getMigrationVariable(TMP . 'tests' . DS . '12345_migration_test_file.php'); $expected = << array( @@ -742,7 +741,7 @@ public function testWriteMigrationIndexesOnly() { ); TEXT; $this->assertEquals($result, str_replace("\r\n", "\n", $expected)); - $this->_unlink(array(TMP . 'tests' . DS . '12346_migration_test_file.php')); + $this->_unlink('12345_migration_test_file.php'); } /** @@ -753,14 +752,13 @@ public function testWriteMigrationIndexesOnly() { public function testGenerate() { $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('Initial Schema')); + $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('Initial Schema')); - $this->Shell->params['overwrite'] = false; $this->Shell->generate(); - $files = glob(TMP . 'tests' . DS . '*initial_schema.php'); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $this->assertNotEmpty(preg_grep('/([0-9])+_initial_schema\.php$/i', $files)); } @@ -773,16 +771,15 @@ public function testGenerate2() { $this->Shell->expects($this->atLeastOnce())->method('err'); $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('002 invalid name')); - $this->Shell->expects($this->at(5))->method('in')->will($this->returnValue('invalid-name')); - $this->Shell->expects($this->at(7))->method('in')->will($this->returnValue('create some sample_data')); + $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('002 invalid name')); + $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('invalid-name')); + $this->Shell->expects($this->at(6))->method('in')->will($this->returnValue('create some sample_data')); - $this->Shell->params['overwrite'] = false; $this->Shell->generate(); - $files = glob(TMP . 'tests' . DS . '*create_some_sample_data.php'); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $this->assertNotEmpty(preg_grep('/([0-9])+_create_some_sample_data\.php$/i', $files)); } @@ -797,21 +794,20 @@ public function testGenerateComparison() { $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('drop slug field')); $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('y')); - $this->Shell->expects($this->at(5))->method('dispatchShell')->with('schema generate --connection test --force --file schema.php --name TestMigrationPlugin4'); + $this->Shell->expects($this->at(5))->method('dispatchShell')->with('schema generate --connection test --force'); $this->Shell->Version->expects($this->any())->method('getMapping')->will($this->returnCallback(array($this, 'returnMapping'))); $this->assertEmpty(glob(TMP . 'tests' . DS . '*drop_slug_field.php')); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); + $this->Shell->params['force'] = true; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*drop_slug_field.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $this->assertNotRegExp('/\'schema_migrations\'/', $result); $pattern = <<Shell->type = 'TestMigrationPlugin4'; - $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('y')); - $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('create slug field')); - - $this->Shell->Version->expects($this->any())->method('getMapping')->will($this->returnCallback(array($this, 'returnMapping'))); - - $this->assertEmpty(glob(TMP . 'tests' . DS . '*create_slug_field.php')); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); - $this->Shell->generate(); - $files = glob(TMP . 'tests' . DS . '*create_slug_field.php'); - $this->assertNotEmpty($files); - - $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); - $this->assertNotRegExp('/\'schema_migrations\'/', $result); - - $pattern = << array\( - 'articles' => array\( - 'slug' => array\('type' => 'string', 'null' => false, 'after' => 'title'\), - \), - \),/ -TEXT; - $this->assertRegExp(str_replace("\r\n", "\n", $pattern), $result); - - $pattern = << array\( - 'articles' => array\('slug'\), - \),/ -TEXT; - $this->assertRegExp(str_replace("\r\n", "\n", $pattern), $result); - } - /** * testGenerateFromCliParamsCreateTable method * test the case of using a command such as: @@ -893,15 +845,14 @@ public function testGenerateFromCliParamsCreateTable() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*create_products.php')); $this->Shell->args = array('create_products', 'id', 'created', 'modified', 'name', 'description:text', 'in_stock:boolean', 'price:float', 'stock_count:integer'); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); + $this->Shell->params['force'] = true; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*create_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_create_table_from_cli.txt'); $this->assertEquals($expected, $result); @@ -919,15 +870,14 @@ public function testGenerateFromCliParamsDropTable() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*drop_products.php')); $this->Shell->args = array('drop_products'); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); + $this->Shell->params['force'] = true; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*drop_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_drop_table_from_cli.txt'); $this->assertEquals($expected, $result); @@ -945,15 +895,14 @@ public function testGenerateFromCliParamsAddFields() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*add_all_fields_to_products.php')); $this->Shell->args = array('add_all_fields_to_products', 'id', 'created', 'modified', 'name', 'description:text', 'in_stock:boolean', 'price:float', 'stock_count:integer'); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); + $this->Shell->params['force'] = true; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*add_all_fields_to_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_add_fields_from_cli.txt'); $this->assertEquals($expected, $result); @@ -971,15 +920,14 @@ public function testGenerateFromCliParamsRemoveFields() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*remove_name_and_desc_from_products.php')); $this->Shell->args = array('remove_name_and_desc_from_products', 'name', 'description'); - $this->Shell->params = array( - 'force' => true, - 'overwrite' => false - ); + $this->Shell->params['force'] = true; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*remove_name_and_desc_from_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_remove_fields_from_cli.txt'); $this->assertEquals($expected, $result); @@ -999,18 +947,17 @@ public function testGenerateDump() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*schema_dump.php')); $this->Shell->type = 'TestMigrationPlugin2'; - $this->Shell->params = array( - 'force' => true, - 'dry' => false, - 'precheck' => 'Migrations.PrecheckException', - 'overwrite' => false - ); + $this->Shell->params['force'] = true; + $this->Shell->params['dry'] = false; + $this->Shell->params['precheck'] = 'Migrations.PrecheckException'; $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*schema_dump.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - $this->_unlink($files); + foreach ($files as $f) { + unlink($f); + } $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration.txt'); $expected = str_replace("\r\n", "\n", $expected); @@ -1076,12 +1023,13 @@ protected function _getMigrationVariable($file) { /** * Unlink test files from filesystem * - * @param array Absolute paths to unlink + * @param mixed files * @return void */ - protected function _unlink($files) { + protected function _unlink() { + $files = func_get_args(); foreach ($files as $file) { - @unlink($file); + @unlink(TMP . 'tests' . DS . $file); } } diff --git a/Test/Case/Lib/Migration/PrecheckConditionTest.php b/Test/Case/Lib/Migration/PrecheckConditionTest.php index 71c317d7..51cf0124 100644 --- a/Test/Case/Lib/Migration/PrecheckConditionTest.php +++ b/Test/Case/Lib/Migration/PrecheckConditionTest.php @@ -14,6 +14,7 @@ /** * TestPrecheckCakeMigration + * */ class TestPrecheckCakeMigration extends CakeMigration { diff --git a/Test/Case/Lib/MigrationVersionTest.php b/Test/Case/Lib/MigrationVersionTest.php index b9793d45..9cb7d504 100644 --- a/Test/Case/Lib/MigrationVersionTest.php +++ b/Test/Case/Lib/MigrationVersionTest.php @@ -12,7 +12,6 @@ App::uses('CakeMigration', 'Migrations.Lib'); App::uses('CakeSchema', 'Model'); App::uses('MigrationVersion', 'Migrations.Lib'); -App::uses('CakeTime', 'Utility'); class MigrationVersionTest extends CakeTestCase { @@ -376,8 +375,8 @@ public function testGetVersionByName() { /** * _mapping method * - * @param int $start - * @param int $end + * @param integer $start + * @param integer $end * @return array */ protected function _mapping($start = 0, $end = 0) { @@ -390,10 +389,10 @@ protected function _mapping($start = 0, $end = 0) { 'type' => 'mocks', 'migrated' => null ); if ($i >= $start && $i <= $end) { - $mapping[$i]['migrated'] = CakeTime::nice(); + $mapping[$i]['migrated'] = date('r'); } } return $mapping; } -} +} \ No newline at end of file diff --git a/Test/Case/Lib/Model/CakeMigrationTest.php b/Test/Case/Lib/Model/CakeMigrationTest.php index 78113be0..76ec1004 100644 --- a/Test/Case/Lib/Model/CakeMigrationTest.php +++ b/Test/Case/Lib/Model/CakeMigrationTest.php @@ -14,6 +14,7 @@ /** * TestCakeMigration + * */ class TestCakeMigration extends CakeMigration { @@ -27,6 +28,7 @@ class TestCakeMigration extends CakeMigration { /** * TestCallbackCakeMigration + * */ class TestCallbackCakeMigration { @@ -87,6 +89,7 @@ public function afterAction(&$Migration, $type, $data) { /** * CakeMigrationTest + * */ class CakeMigrationTest extends CakeTestCase { @@ -285,7 +288,7 @@ public function testCreateDropField() { $migration->run('down'); $this->fail('No exception triggered'); } catch (MigrationException $e) { - $this->assertEquals('Field "views" does not exist in "posts".', $e->getMessage()); + $this->assertEquals('Field "views" does not exists in "posts".', $e->getMessage()); } } diff --git a/Test/Fixture/SchemaMigrationsFixture.php b/Test/Fixture/SchemaMigrationsFixture.php index c17b4114..c09725a7 100644 --- a/Test/Fixture/SchemaMigrationsFixture.php +++ b/Test/Fixture/SchemaMigrationsFixture.php @@ -32,4 +32,4 @@ class SchemaMigrationsFixture extends CakeTestFixture { array('id' => '2', 'class' => 'ConvertVersionToClassNames', 'type' => 'migrations', 'created' => '2011-11-18 13:53:32') ); -} +} \ No newline at end of file diff --git a/Test/Fixture/test_migration.txt b/Test/Fixture/test_migration.txt index 6e34ee3e..54a56ef7 100644 --- a/Test/Fixture/test_migration.txt +++ b/Test/Fixture/test_migration.txt @@ -4,45 +4,55 @@ 'articles' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB'), + ), + 'jumped_migrations' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), + 'class' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 33, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'type' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), + 'indexes' => array( + 'PRIMARY' => array('column' => 'id', 'unique' => 1), + ), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MEMORY'), ), 'posts' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'author_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), - 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB'), ), 'users' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'user' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), - 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'user' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MEMORY'), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MEMORY'), ), ), ), 'down' => array( 'drop_table' => array( - 'articles', 'posts', 'users' + 'articles', 'jumped_migrations', 'posts', 'users' ), ), ); \ No newline at end of file diff --git a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php index 89a35aae..1e0cc5b6 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php +++ b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php @@ -22,7 +22,7 @@ class M4af6d40056b04408808500cb58157726 extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -32,7 +32,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; diff --git a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php index 1a619641..3b420f8e 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php +++ b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php @@ -22,7 +22,7 @@ class AnotherMigrationPluginTestMigration extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function before($direction) { return true; @@ -32,7 +32,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return bool Should process continue + * @return boolean Should process continue */ public function after($direction) { return true; diff --git a/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php b/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php index 3a9de6b3..457cf535 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php +++ b/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php @@ -63,4 +63,5 @@ public function after($event = array()) { 'PRIMARY' => array('column' => 'id', 'unique' => 1) ) ); -} + +} \ No newline at end of file diff --git a/View/Elements/migrations_panel.ctp b/View/Elements/migrations_panel.ctp index 1b9b752f..7692b120 100644 --- a/View/Elements/migrations_panel.ctp +++ b/View/Elements/migrations_panel.ctp @@ -62,49 +62,46 @@ if (document.getElementsByClassName == undefined) { return results; } } -setTimeout(function() { - DEBUGKIT.$(document).ready(function () { - DEBUGKIT.module('migrationsPanel'); - DEBUGKIT.migrationsPanel = function () { - var toolbar = DEBUGKIT.toolbar, - Element = DEBUGKIT.Util.Element, - Cookie = DEBUGKIT.Util.Cookie, - Collection = DEBUGKIT.Util.Collection, - Event = DEBUGKIT.Util.Event, - migrationsHidden = false; - return { - init: function () { - var button = document.getElementById('hide-migrations'), - self = this; +DEBUGKIT.module('migrationsPanel'); +DEBUGKIT.migrationsPanel = function () { + var toolbar = DEBUGKIT.toolbar, + Element = DEBUGKIT.Util.Element, + Cookie = DEBUGKIT.Util.Cookie, + Collection = DEBUGKIT.Util.Collection, + Event = DEBUGKIT.Util.Event, + migrationsHidden = false; - Event.addEvent(button, 'click', function (event) { - event.preventDefault(); - self.toggleMigrations(); - }); + return { + init: function () { + var button = document.getElementById('hide-migrations'), + self = this; - var migrationsState = Cookie.read('migrationsDisplay'); - console.log(migrationsState); - if (migrationsState != 'show') { - migrationsHidden = false; - this.toggleMigrations(); - } - }, + Event.addEvent(button, 'click', function (event) { + event.preventDefault(); + self.toggleMigrations(); + }); - toggleMigrations: function () { - var display = migrationsHidden ? 'show' : 'hide'; - var arr = document.getElementsByClassName("migration-applied"); - for (i = 0; i < arr.length; i++) { - Element[display](arr[i]); - } - Cookie.write('migrationsDisplay', display); - migrationsHidden = !migrationsHidden; - return false; - } - }; - }(); - DEBUGKIT.loader.register(DEBUGKIT.migrationsPanel); - }); -}, 0); + var migrationsState = Cookie.read('migrationsDisplay'); + console.log(migrationsState); + if (migrationsState != 'show') { + migrationsHidden = false; + this.toggleMigrations(); + } + }, + + toggleMigrations: function () { + var display = migrationsHidden ? 'show' : 'hide'; + var arr = document.getElementsByClassName("migration-applied"); + for (i = 0; i < arr.length; i++) { + Element[display](arr[i]); + } + Cookie.write('migrationsDisplay', display); + migrationsHidden = !migrationsHidden; + return false; + } + }; +}(); +DEBUGKIT.loader.register(DEBUGKIT.migrationsPanel); //]]> diff --git a/composer.json b/composer.json index 9f458f0a..73aae702 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "homepage": "http://cakedc.com", "license": "MIT", "authors": [ - { + { "name": "Cake Development Corporation", "email": "team@cakedc.com", "homepage": "http://cakedc.com" From 471c82d5756ac74007748f75fb00a56fb79f6b7e Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 15:27:44 -0300 Subject: [PATCH 5/8] Revert "refs #272 fixing unit tests and removing a unnecessary command" This reverts commit f6bb5c693081ad5e1cc904203e67d963ef3cf8b1. --- .semver | 4 +- .travis.yml | 23 +- CHANGELOG.md | 70 ++++ CONTRIBUTING.md | 2 +- Config/Migration/001_init_migrations.php | 4 +- .../002_convert_version_to_class_names.php | 4 +- .../003_increase_class_name_length.php | 4 +- Console/Command/MigrationShell.php | 364 +++++++++++++++--- Console/Command/Templates/migration.ctp | 4 +- Docs/Documentation/Examples.md | 3 +- Docs/Documentation/Installation.md | 6 +- Lib/CakeMigration.php | 40 +- Lib/Migration/PrecheckBase.php | 40 +- Lib/Migration/PrecheckCondition.php | 23 +- Lib/Migration/PrecheckException.php | 32 +- Lib/MigrationVersion.php | 35 +- Lib/Panel/MigrationsPanel.php | 3 +- Locale/deu/LC_MESSAGES/migrations.po | 135 +++---- Locale/fre/LC_MESSAGES/migrations.po | 142 +++---- Locale/ita/LC_MESSAGES/migrations.po | 131 ++++--- Locale/migrations.pot | 101 ++--- Locale/por/LC_MESSAGES/migrations.po | 144 ++++--- Locale/spa/LC_MESSAGES/migrations.po | 131 +++---- Model/SchemaMigration.php | 4 +- README.md | 8 +- .../Console/Command/MigrationShellTest.php | 160 +++++--- .../Lib/Migration/PrecheckConditionTest.php | 1 - Test/Case/Lib/MigrationVersionTest.php | 9 +- Test/Case/Lib/Model/CakeMigrationTest.php | 5 +- Test/Fixture/SchemaMigrationsFixture.php | 2 +- Test/Fixture/test_migration.txt | 34 +- .../Config/Migration/001_schema_dump.php | 4 +- ...nother_migration_plugin_test_migration.php | 4 +- .../Config/Schema/schema.php | 3 +- View/Elements/migrations_panel.ctp | 77 ++-- composer.json | 2 +- 36 files changed, 1062 insertions(+), 696 deletions(-) diff --git a/.semver b/.semver index e88c8a2b..d42d4c53 100644 --- a/.semver +++ b/.semver @@ -1,5 +1,5 @@ --- :major: 2 -:minor: 3 -:patch: 2 +:minor: 4 +:patch: 1 :special: '' diff --git a/.travis.yml b/.travis.yml index 9746c3a9..a4dee622 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,9 @@ language: php php: - - 5.3 - - 5.4 - 5.5 - + - 5.6 + - 7.0 env: global: - PLUGIN_NAME=Migrations @@ -13,22 +12,21 @@ env: - REQUIRE="phpunit/phpunit:3.7.31" matrix: - - DB=mysql CAKE_VERSION=master + - DB=mysql CAKE_VERSION=2.7 matrix: include: - - php: 5.3 + - php: 5.5 env: - - CAKE_VERSION=master - - php: 5.4 + - CAKE_VERSION=2.7 + - php: 5.6 env: - - CAKE_VERSION=master - - php: 5.5 + - CAKE_VERSION=2.7 + - php: 7.0 env: - - CAKE_VERSION=master - + - CAKE_VERSION=2.8 before_script: - - git clone https://github.com/burzum/travis.git --depth 1 ../travis + - git clone https://github.com/steinkel/travis.git --depth 1 ../travis - ../travis/before_script.sh - if [ "$PHPCS" != 1 ]; then echo " @@ -44,3 +42,4 @@ after_success: notifications: email: false + diff --git a/CHANGELOG.md b/CHANGELOG.md index a93fd422..ec4775fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,76 @@ Changelog ========= +Release 2.4.1 +------------- + +* Bugfix/Improvement release + +Release 2.4.0 +------------- + +* [43228df](https://github.com/cakedc/migrations/commit/43228df) Code standard fix +* [4352ed8](https://github.com/cakedc/migrations/commit/4352ed8) Changed method comment to a clearer comment +* [25d7181](https://github.com/cakedc/migrations/commit/25d7181) Changed uses of the ConnectionManager class to static +* [9a56814](https://github.com/cakedc/migrations/commit/9a56814) Fixed method comments +* [2ee4c1e](https://github.com/cakedc/migrations/commit/2ee4c1e) Changed call of enumConnectionObjects to static +* [caf1730](https://github.com/cakedc/migrations/commit/caf1730) Correct definition of the connection manager class uses +* [193ed70](https://github.com/cakedc/migrations/commit/193ed70) Fixed code formating +* [283590a](https://github.com/cakedc/migrations/commit/283590a) Fixed console input message that asks migrationConnection +* [1909320](https://github.com/cakedc/migrations/commit/1909320) Added test case to check migrationConnection shell parameter +* [b60fa05](https://github.com/cakedc/migrations/commit/b60fa05) Fixed array syntax in model uses +* [9237949](https://github.com/cakedc/migrations/commit/9237949) Validate migrateConnection argument when a custom connection is set +* [6374acc](https://github.com/cakedc/migrations/commit/6374acc) Added example to set a specific datasource on run + +Release 2.3.6 +------------- + +* [1489496](https://github.com/cakedc/migrations/commit/1489496) Revert "fixing unit tests" to pass tests in travis env +* [ebf6bc6](https://github.com/cakedc/migrations/commit/ebf6bc6) using minor for travis CakePHP +* [517a810](https://github.com/cakedc/migrations/commit/517a810) updating travis +* [180fe03](https://github.com/cakedc/migrations/commit/180fe03) fixed class condition after some changes done in Inflector::camelize in 2.6.6 +* [27d5afb](https://github.com/cakedc/migrations/commit/27d5afb) fixing unit tests + +Release 2.3.6 +------------- + +https://github.com/CakeDC/migrations/tree/2.3.6 + +* [ccac5a3](https://github.com/cakedc/migrations/commit/ccac5a3) Update translation files +* [bca17ea](https://github.com/cakedc/migrations/commit/bca17ea) Show prompt for marking as successful when failure +* [18aa020](https://github.com/cakedc/migrations/commit/18aa020) crlf to lf +* [db96c9e](https://github.com/cakedc/migrations/commit/db96c9e) Grammatical corrections for generate command +* [cc7b03a](https://github.com/cakedc/migrations/commit/cc7b03a) Fix CS issues +* [942eab0](https://github.com/cakedc/migrations/commit/942eab0) Fix grammar in console output +* [89ddfc1](https://github.com/cakedc/migrations/commit/89ddfc1) Tidy up unlinking in tests +* [894f736](https://github.com/cakedc/migrations/commit/894f736) Fix for incorrect naming of all plugin migrations + +Release 2.3.5 +------------- + +https://github.com/CakeDC/migrations/tree/2.3.5 + +* [69e6136](https://github.com/cakedc/migrations/commit/69e6136) Add translations for new/missing strings +* [c98ecdd](https://github.com/cakedc/migrations/commit/c98ecdd) Exit shell if comparing schema.php and nothing has changed + +Release 2.3.4 +------------- + +https://github.com/CakeDC/migrations/tree/2.3.4 + +* [94a7fe9](https://github.com/cakedc/migrations/commit/94a7fe9) Removed cakephp dependency from composer.json + +Release 2.3.3 +------------- + +https://github.com/CakeDC/migrations/tree/2.3.3 + +* [14a3cc4](https://github.com/cakedc/migrations/commit/14a3cc4) Bump minimum required CakePHP version to 2.5.4 (refs [#184](https://github.com/CakeDC/migrations/issues/184)) +* [f6f3490](https://github.com/cakedc/migrations/commit/f6f3490) CS: Changed doc block "boolean" to "bool" +* [b6c579c](https://github.com/cakedc/migrations/commit/b6c579c) Fixes Schema/app.php issue. +* [749e634](https://github.com/cakedc/migrations/commit/749e634) Improved logic for schema class name detection. +* [9ef51fd](https://github.com/cakedc/migrations/commit/9ef51fd) Adds an option for specifying the Schema class name. + Release 2.3.2 ------------- diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 408e8119..26f53081 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ Contributing ============ -This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugins). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/plugins) for detailed instructions. \ No newline at end of file +This repository follows the [CakeDC Plugin Standard](http://cakedc.com/plugin-standard). If you'd like to contribute new features, enhancements or bug fixes to the plugin, please read our [Contribution Guidelines](http://cakedc.com/contribution-guidelines) for detailed instructions. diff --git a/Config/Migration/001_init_migrations.php b/Config/Migration/001_init_migrations.php index 76190e17..537eb730 100644 --- a/Config/Migration/001_init_migrations.php +++ b/Config/Migration/001_init_migrations.php @@ -38,7 +38,7 @@ class InitMigrations extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -48,7 +48,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; diff --git a/Config/Migration/002_convert_version_to_class_names.php b/Config/Migration/002_convert_version_to_class_names.php index a8302c1c..f967aa1c 100644 --- a/Config/Migration/002_convert_version_to_class_names.php +++ b/Config/Migration/002_convert_version_to_class_names.php @@ -48,7 +48,7 @@ class ConvertVersionToClassNames extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue * @throws InternalErrorException */ public function before($direction) { @@ -69,7 +69,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { $this->upgradeRecords(); diff --git a/Config/Migration/003_increase_class_name_length.php b/Config/Migration/003_increase_class_name_length.php index 2813ef0e..990f7212 100644 --- a/Config/Migration/003_increase_class_name_length.php +++ b/Config/Migration/003_increase_class_name_length.php @@ -34,7 +34,7 @@ class IncreaseClassNameLength extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -44,7 +44,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; diff --git a/Console/Command/MigrationShell.php b/Console/Command/MigrationShell.php index ba41b3ad..d4776e46 100644 --- a/Console/Command/MigrationShell.php +++ b/Console/Command/MigrationShell.php @@ -13,12 +13,15 @@ App::uses('AppShell', 'Console/Command'); App::uses('CakeSchema', 'Model'); App::uses('MigrationVersion', 'Migrations.Lib'); -App::uses('String', 'Utility'); +App::uses('CakeText', 'Utility'); App::uses('ClassRegistry', 'Utility'); +App::uses('ConnectionManager', 'Model'); +App::uses('Folder', 'Utility'); +App::uses('File', 'Utility'); +App::uses('CakeTime', 'Utility'); /** * Migration shell. - * */ class MigrationShell extends AppShell { @@ -59,6 +62,13 @@ class MigrationShell extends AppShell { */ public $Version; +/** + * Skip a version or it can skip many version using comma as separate. + * + * @var array + */ + public $skip = array(); + /** * Messages used to display action being performed * @@ -79,26 +89,24 @@ public function startup() { $this->connection = $this->params['connection']; } - if (!empty($this->params['migrationConnection'])) { - $this->migrationConnection = $this->params['migrationConnection']; - } + $this->migrationConnection = $this->_startMigrationConnection(); if (!empty($this->params['plugin'])) { $this->type = $this->params['plugin']; } + if (!empty($this->params['skip'])) { + $this->skip = $this->params['skip']; + } + $this->path = $this->_getPath() . 'Config' . DS . 'Migration' . DS; $options = array( 'precheck' => $this->params['precheck'], 'autoinit' => !$this->params['no-auto-init'], -<<<<<<< Updated upstream 'dry' => $this->params['dry'], 'skip' => isset($this->params['skip']) ? $this->params['skip'] : null, 'jumpTo' => isset($this->params['jump-to']) ? $this->params['jump-to'] : null); -======= - 'dry' => $this->params['dry']); ->>>>>>> Stashed changes if (!empty($this->connection)) { $options['connection'] = $this->connection; @@ -107,7 +115,6 @@ public function startup() { if (!empty($this->migrationConnection)) { $options['migrationConnection'] = $this->migrationConnection; } - $this->Version = new MigrationVersion($options); $this->_messages = array( @@ -123,10 +130,38 @@ public function startup() { ); } +/** + * Get a list of connection names. + * + * @return array The list of connection names + */ + protected function _connectionNamesEnum() { + return array_keys(ConnectionManager::enumConnectionObjects()); + } + +/** + * Set a migration connection + * + * @return string The name of the migration connection. + */ + protected function _startMigrationConnection() { + if (!empty($this->params['connection']) && empty($this->params['migrationConnection'])) { + return $this->in( + "You did not set a migration connection (-i), which connection do you want to use?", + $this->_connectionNamesEnum(), + $this->params['connection'] + ); + } + + if (!empty($this->params['migrationConnection'])) { + return $this->params['migrationConnection']; + } + } + /** * Get the option parser. * - * @return void + * @return string */ public function getOptionParser() { $parser = parent::getOptionParser(); @@ -135,11 +170,11 @@ public function getOptionParser() { '') ->addOption('plugin', array( 'short' => 'p', - 'help' => __('Plugin name to be used'))) + 'help' => __d('migrations', 'Plugin name to be used'))) ->addOption('precheck', array( 'short' => 'm', 'default' => 'Migrations.PrecheckException', - 'help' => __('Precheck migrations'))) + 'help' => __d('migrations', 'Precheck migrations'))) ->addOption('force', array( 'short' => 'f', 'boolean' => true, @@ -160,27 +195,32 @@ public function getOptionParser() { ->addOption('connection', array( 'short' => 'c', 'default' => null, - 'help' => __('Overrides the \'default\' connection of the MigrationVersion'))) + 'help' => __d('migrations', 'Overrides the \'default\' connection of the MigrationVersion'))) ->addOption('migrationConnection', array( 'short' => 'i', 'default' => null, - 'help' => __('Overrides the \'default\' connection of the CakeMigrations that are applied'))) + 'help' => __d('migrations', 'Overrides the \'default\' connection of the CakeMigrations that are applied'))) ->addOption('dry', array( 'short' => 'd', 'boolean' => true, 'default' => false, - 'help' => __('Output the raw SQL queries rather than applying them to the database.'))) + 'help' => __d('migrations', 'Output the raw SQL queries rather than applying them to the database.'))) ->addOption('no-auto-init', array( 'short' => 'n', 'boolean' => true, 'default' => false, - 'help' => __('Disables automatic creation of migrations table and running any internal plugin migrations'))) + 'help' => __d('migrations', 'Disables automatic creation of migrations table and running any internal plugin migrations'))) + ->addOption('schema-class', array( + 'short' => 's', + 'boolean' => false, + 'default' => false, + 'help' => __d('migrations', 'CamelCased Classname without the `Schema` suffix to use when reading or generating schema files. See `Console/cake schema generate --help`.'))) ->addSubcommand('status', array( - 'help' => __('Displays a status of all plugin and app migrations.'))) + 'help' => __d('migrations', 'Displays a status of all plugin and app migrations.'))) ->addSubcommand('run', array( - 'help' => __('Run a migration to given direction or version.'))) + 'help' => __d('migrations', 'Run a migration to given direction or version.'))) ->addSubcommand('generate', array( - 'help' => __('Generates a migration file.'))); + 'help' => __d('migrations', 'Generates a migration file.'))); } /** @@ -207,7 +247,7 @@ public function run() { if ($mapping === false) { $this->out(__d('migrations', 'No migrations available.')); - return $this->_stop(1); + return $this->_stop(); } $latestVersion = $this->Version->getVersion($this->type); @@ -219,7 +259,8 @@ public function run() { 'precheck' => isset($this->params['precheck']) ? $this->params['precheck'] : null, 'type' => $this->type, 'dry' => $this->params['dry'], - 'callback' => &$this); + 'callback' => &$this, + 'skip' => $this->skip); $once = false; //In case of exception run shell again (all, reset, migration number) if (isset($this->args[0]) && in_array($this->args[0], array('up', 'down'))) { @@ -251,10 +292,9 @@ public function run() { $this->out(__d('migrations', 'Migration will run dry, no database changes will be made')); $this->out(''); } - $result = $this->_execute($options, $once); if ($result !== true) { - $this->out(__d('migrations', $result)); + $this->out($result); } $this->out(__d('migrations', 'All migrations have completed.')); @@ -262,6 +302,13 @@ public function run() { return true; } +/** + * Execute migration + * + * @param array $options Options for migration + * @param bool $once True to only run once, false to retry + * @return bool True if success + */ protected function _execute($options, $once) { $result = true; try { @@ -292,7 +339,7 @@ protected function _execute($options, $once) { /** * Output the SQL log in dry mode * - * @param $log array + * @param array $log List of queries per migration * @return void */ protected function _outputLog($log) { @@ -311,6 +358,14 @@ protected function _outputLog($log) { $this->hr(); } +/** + * Single step options for up/down migrations + * + * @param array $mapping Migration version mappings + * @param string $latestVersion Latest migration version + * @param array $default Default options for migration + * @return array Modified options for migration + */ protected function _singleStepOptions($mapping, $latestVersion, $default = array()) { $options = $default; $versions = array_keys($mapping); @@ -329,6 +384,13 @@ protected function _singleStepOptions($mapping, $latestVersion, $default = array return $options; } +/** + * Output prompt with different migration versions to choose from + * + * @param array $mapping Migration version mappings + * @param string $latestVersion Latest migration version + * @return array User-chosen options for migration + */ protected function _promptVersionOptions($mapping, $latestVersion) { if (isset($this->args[0]) && is_numeric($this->args[0])) { $options['version'] = (int)$this->args[0]; @@ -343,7 +405,7 @@ protected function _promptVersionOptions($mapping, $latestVersion) { $this->hr(); while (true) { - $response = $this->in(__d('migrations', 'Please, choose what version you want to migrate to. [q]uit or [c]lean.')); + $response = $this->in(__d('migrations', 'Please choose which version you want to migrate to. [q]uit or [c]lean.')); if (strtolower($response) === 'q') { return $this->_stop(); } elseif (strtolower($response) === 'c') { @@ -389,13 +451,27 @@ public function generate() { } else { $oldSchema = $this->_getSchema($this->type); if ($oldSchema !== false) { - $response = $this->in(__d('migrations', 'Do you want compare the schema.php file to the database?'), array('y', 'n'), 'y'); + $response = isset($this->params['compare']) && $this->params['compare'] === true ? 'y' : false; + + if ($response === false) { + $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); + } + + $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_generateFromComparison($migration, $oldSchema, $comparison); + $this->_migrationChanges($migration); $fromSchema = true; + } else { + $response = $this->in(__d('migrations', 'Do you want to compare the database to the schema.php file?'), array('y', 'n'), 'y'); + if (strtolower($response) === 'y') { + $this->_generateFromInverseComparison($migration, $oldSchema, $comparison); + $this->_migrationChanges($migration); + $fromSchema = false; + } } } else { - $response = $this->in(__d('migrations', 'Do you want generate a dump from current database?'), array('y', 'n'), 'y'); + $response = $this->in(__d('migrations', 'Do you want to generate a dump from the current database?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_generateDump($migration); $fromSchema = true; @@ -405,8 +481,12 @@ public function generate() { $this->_finalizeGeneratedMigration($migration, $migrationName, $fromSchema); + if ($this->params['overwrite'] === true) { + $this->_overwriteSchema(); + } + if ($fromSchema && isset($comparison)) { - $response = $this->in(__d('migrations', 'Do you want update the schema.php file?'), array('y', 'n'), 'y'); + $response = $this->in(__d('migrations', 'Do you want to update the schema.php file?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_updateSchema(); } @@ -414,10 +494,25 @@ public function generate() { } /** - * generate a migration by comparing schema.php with the database. - * @param array $migration reference to variable of the same name in generate() method - * @param array $oldSchema reference to variable of the same name in generate() method - * @param array $comparison reference to variable of the same name in generate() method + * _migrationsChanges method + * + * @param array $migration list of migrations + * @return bool + */ + protected function _migrationChanges($migration) { + if (empty($migration)) { + $this->hr(); + $this->out(__d('migrations', 'No database changes detected.')); + return $this->_stop(); + } + } + +/** + * Generate a migration by comparing schema.php with the database. + * + * @param array &$migration Reference to variable of the same name in generate() method + * @param array &$oldSchema Reference to variable of the same name in generate() method + * @param array &$comparison Reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateFromComparison(&$migration, &$oldSchema, &$comparison) { @@ -433,10 +528,31 @@ protected function _generateFromComparison(&$migration, &$oldSchema, &$compariso } /** - * generate a migration from arguments passed in at the command line - * @param array $migration reference to variable of the same name in generate() method - * @param array $migrationName reference to variable of the same name in generate() method - * @param array $comparison reference to variable of the same name in generate() method + * Generate a migration by comparing the database with schema.php. + * + * @param array &$migration Reference to variable of the same name in generate() method + * @param array &$oldSchema Reference to variable of the same name in generate() method + * @param array &$comparison Reference to variable of the same name in generate() method + * @return void (The variables passed by reference are changed; nothing is returned) + */ + protected function _generateFromInverseComparison(&$migration, &$oldSchema, &$comparison) { + $this->hr(); + $this->out(__d('migrations', 'Comparing database to the schema.php...')); + + if ($this->type !== 'migrations') { + unset($oldSchema->tables['schema_migrations']); + } + $database = $this->_readSchema(); + $comparison = $this->Schema->compare($database, $oldSchema); + $migration = $this->_fromComparison($migration, $comparison, $oldSchema->tables, $database['tables']); + } + +/** + * Generate a migration from arguments passed in at the command line + * + * @param array &$migration Reference to variable of the same name in generate() method + * @param array &$migrationName Reference to variable of the same name in generate() method + * @param array &$comparison Reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateFromCliArgs(&$migration, &$migrationName, &$comparison) { @@ -473,6 +589,12 @@ protected function _generateFromCliArgs(&$migration, &$migrationName, &$comparis } } +/** + * Return list of field names from array of field/index definitions + * + * @param array $fields Field/index definitions + * @return array List of field names + */ protected function _fieldNamesArray($fields) { $fieldNames = array(); foreach ($fields as $name => $value) { @@ -485,12 +607,13 @@ protected function _fieldNamesArray($fields) { /** * Generate a dump of the current database. - * @param array $migration reference to variable of the same name in generate() method + * + * @param array &$migration Reference to variable of the same name in generate() method * @return void (The variables passed by reference are changed; nothing is returned) */ protected function _generateDump(&$migration) { $this->hr(); - $this->out(__d('migrations', 'Generating dump from current database...')); + $this->out(__d('migrations', 'Generating dump from the current database...')); $dump = $this->_readSchema(); $dump = $dump['tables']; @@ -505,9 +628,10 @@ protected function _generateDump(&$migration) { /** * Finalizes the generated migration - offers to preview it, * prompts for a name, writes the file, and updates db version if needed. - * @param array $migration reference to variable of the same name in generate() method - * @param array $migrationName reference to variable of the same name in generate() method - * @param boolean $fromSchema reference to variable of the same name in generate() method + * + * @param array &$migration Reference to variable of the same name in generate() method + * @param array &$migrationName Reference to variable of the same name in generate() method + * @param bool &$fromSchema Reference to variable of the same name in generate() method * @return void */ protected function _finalizeGeneratedMigration(&$migration, &$migrationName, &$fromSchema) { @@ -535,6 +659,7 @@ protected function _finalizeGeneratedMigration(&$migration, &$migrationName, &$f /** * Prompt the user for a name for their new migration. + * * @return string */ protected function _promptForMigrationName() { @@ -584,13 +709,13 @@ public function status() { $this->out(__d('migrations', 'Current version:')); if ($version != 0) { $info = $mapping[$version]; - $this->out(' #' . number_format($info['version'] / 100, 2, '', '') . ' ' . $info['name']); + $this->out(' #' . sprintf("%'.03d", $info['version']) . ' ' . $info['name']); } else { $this->out(' ' . __d('migrations', 'None applied.')); } $this->out(__d('migrations', 'Latest version:')); - $this->out(' #' . number_format($latest['version'] / 100, 2, '', '') . ' ' . $latest['name']); + $this->out(' #' . sprintf("%'.03d", $latest['version']) . ' ' . $latest['name']); $this->hr(); } catch (MigrationVersionException $e) { continue; @@ -614,17 +739,17 @@ protected function _showInfo($mapping, $type = null) { if ($version != 0) { $info = $mapping[$version]; $this->out(__d('migrations', 'Current migration version:')); - $this->out(' #' . number_format($version / 100, 2, '', '') . ' ' . $info['name']); + $this->out(' #' . sprintf("%'.03d", $version) . ' ' . $info['name']); $this->hr(); } $this->out(__d('migrations', 'Available migrations:')); foreach ($mapping as $version => $info) { - $this->out(' [' . number_format($version / 100, 2, '', '') . '] ' . $info['name']); + $this->out(' [' . sprintf("%'.03d", $version) . '] ' . $info['name']); $this->out(' ', false); if ($info['migrated'] !== null) { - $this->out(__d('migrations', 'applied') . ' ' . date('r', strtotime($info['migrated']))); + $this->out(__d('migrations', 'applied') . ' ' . CakeTime::nice(strtotime($info['migrated']))); } else { $this->out(__d('migrations', 'not applied')); } @@ -694,6 +819,30 @@ protected function _fromComparison($migration, $comparison, $oldTables, $current return $migration; } +/** + * Gets the schema class name + * + * @param string $name Can be 'app' or a plugin name + * @param bool $suffix Return the class name with or without the "Schema" suffix, default is true + * @return string Returns the schema class name + */ + protected function _getSchemaClassName($name = null, $suffix = true) { + if (empty($name)) { + $name = $this->type; + } + if (!empty($this->params['schema-class'])) { + $name = $this->params['schema-class']; + } + $name = preg_replace('/[^a-zA-Z0-9]/', '', $name); + $name = Inflector::camelize($name); + if ($suffix === true && (substr($name, -6) !== 'Schema')) { + $name .= 'Schema'; + } elseif ($suffix === false && (substr($name, -6) === 'Schema')) { + $name = substr($name, 0, -6); + } + return $name; + } + /** * Load and construct the schema class if exists * @@ -705,24 +854,49 @@ protected function _getSchema($type = null) { $plugin = ($this->type === 'app') ? null : $this->type; return new CakeSchema(array('connection' => $this->connection, 'plugin' => $plugin)); } - $file = $this->_getPath($type) . 'Config' . DS . 'Schema' . DS . 'schema.php'; - if (!file_exists($file)) { + + $folder = new Folder($this->_getPath($type) . 'Config' . DS . 'Schema'); + $schemaFiles = $folder->find('.*schema.*.php'); + + if (count($schemaFiles) === 0) { return false; } - require_once $file; - $name = Inflector::camelize($type) . 'Schema'; + $name = $this->_getSchemaClassName($type); + $file = $this->_findSchemaFile($folder, $schemaFiles, $name); - if ($type === 'app' && !class_exists($name)) { + if ($type === 'app' && empty($file)) { $appDir = preg_replace('/[^a-zA-Z0-9]/', '', APP_DIR); $name = Inflector::camelize($appDir) . 'Schema'; + $file = $this->_getPath($type) . 'Config' . DS . 'Schema' . DS . 'schema.php'; } + require_once $file; + $plugin = ($type === 'app') ? null : $type; $schema = new $name(array('connection' => $this->connection, 'plugin' => $plugin)); return $schema; } +/** + * Finds schema file + * + * @param Folder $folder Folder object with schema folder path. + * @param string $schemaFiles Schema files inside schema folder. + * @param string $name Schema-class name. + * @return mixed null in case of no file found, schema file. + */ + protected function _findSchemaFile($folder, $schemaFiles, $name) { + foreach ($schemaFiles as $schemaFile) { + $file = new File($folder->pwd() . DS . $schemaFile); + $content = $file->read(); + if (strpos($content, $name) !== false) { + return $file->path; + } + } + return null; + } + /** * Reads the schema data * @@ -749,9 +923,47 @@ protected function _updateSchema() { if ($this->params['force']) { $command .= ' --force'; } + $command .= ' --file schema.php --name ' . $this->_getSchemaClassName($this->type, false); $this->dispatchShell($command); } +/** + * Overwrite the schema.php file + * + * @return void + */ + + protected function _overwriteSchema() { + $options = array(); + if ($this->params['force']) { + $options['models'] = false; + } elseif (!empty($this->params['models'])) { + $options['models'] = CakeText::tokenize($this->params['models']); + } + + $cacheDisable = Configure::read('Cache.disable'); + Configure::write('Cache.disable', true); + + $content = $this->Schema->read($options); + $file = 'schema.php'; + + Configure::write('Cache.disable', $cacheDisable); + + if (!empty($this->params['exclude']) && !empty($content)) { + $excluded = CakeText::tokenize($this->params['exclude']); + foreach ($excluded as $table) { + unset($content['tables'][$table]); + } + } + + if ($this->Schema->write($content)) { + $this->out(__d('cake_console', 'Schema file: %s generated', $file)); + return $this->_stop(); + } + $this->err(__d('cake_console', 'Schema file: %s generated')); + return $this->_stop(); + } + /** * Parse fields from the command line for use with generating new migration files * @@ -798,10 +1010,12 @@ protected function _parseCommandLineFields($name) { /** * Parse a single argument from the command line into the fields array - * @param array $fields reference to variable of same name in _parseCommandLineFields() - * @param string $field a single command line argument - eg. 'id:primary_key' or 'name:string' - * @param array $validTypes valid data types for the relevant database - eg. string, integer, biginteger, etc. - * @return [type] [description] + * + * @param array &$fields Reference to variable of same name in _parseCommandLineFields() + * @param array &$indexes Reference to variable of same name in _parseCommandLineFields() + * @param string $field A single command line argument - eg. 'id:primary_key' or 'name:string' + * @param array $validTypes Valid data types for the relevant database - eg. string, integer, biginteger, etc. + * @return void */ protected function _parseSingleCommandLineField(&$fields, &$indexes, $field, $validTypes) { if (preg_match('/^(\w*)(?::(\w*))?(?::(\w*))?(?::(\w*))?/', $field, $matches)) { @@ -860,6 +1074,14 @@ protected function _parseSingleCommandLineField(&$fields, &$indexes, $field, $va } } +/** + * Return valid field type based on name of field + * + * @param string $field Name of field + * @param string $type Current type + * @param array $validTypes List of valid types + * @return string Recognized type (eg. integer vs bigint) + */ protected function _getFieldType($field, $type, $validTypes) { if (!in_array($type, $validTypes)) { if ($field == 'id') { @@ -945,9 +1167,9 @@ protected function _generateMigration($name, $class, $migration) { * Write a migration with given name * * @param string $name Name of migration - * @param integer $version The version number (timestamp) + * @param int $version The version number (timestamp) * @param array $migration Migration instructions array - * @return boolean + * @return bool */ protected function _writeMigration($name, $version, $migration) { $content = ''; @@ -967,7 +1189,12 @@ protected function _values($values) { if (is_array($values)) { foreach ($values as $key => $value) { if (is_array($value)) { - $_values[] = "'" . $key . "' => array('" . implode("', '", $value) . "')"; + if (array_keys($value) !== range(0, count($value) - 1)) { + $set = implode("', '", $this->_values($value)); + } else { + $set = "'" . implode("', '", $value) . "'"; + } + $_values[] = "'" . $key . "' => array(" . $set . ")"; } elseif (!is_numeric($key)) { $value = var_export($value, true); $_values[] = "'" . $key . "' => " . $value; @@ -1013,18 +1240,27 @@ protected function _getPath($type = null) { /** * Callback used to display what migration is being runned * - * @param CakeMigration $Migration Migration being performed + * Additionally, shows the generation date of the migration, + * if the version is greater than '2000-01-01'. + * + * @param CakeMigration &$Migration Migration being performed * @param string $direction Direction being runned * @return void */ public function beforeMigration(&$Migration, $direction) { - $this->out(' [' . number_format($Migration->info['version'] / 100, 2, '', '') . '] ' . $Migration->info['name']); + $version = $Migration->info['version']; + $generationDate = ''; + if ($version > 946684800) { + $generationDate = ' (' . CakeTime::format($version, '%Y-%m-%d %H:%M:%S') . ')'; + } + $this->out(' [' . sprintf("%'.03d", $version) . '] ' . $Migration->info['name'] . $generationDate + ); } /** * Callback used to create a new line after the migration * - * @param CakeMigration $Migration Migration being performed + * @param CakeMigration &$Migration Migration being performed * @param string $direction Direction being runned * @return void */ @@ -1035,14 +1271,14 @@ public function afterMigration(&$Migration, $direction) { /** * Callback used to display actions being performed * - * @param CakeMigration $Migration Migration being performed + * @param CakeMigration &$Migration Migration being performed * @param string $type Type of action. i.e: create_table, drop_table, etc. * @param array $data Data to send to the callback * @return void */ public function beforeAction(&$Migration, $type, $data) { if (isset($this->_messages[$type])) { - $message = String::insert($this->_messages[$type], $data); + $message = CakeText::insert($this->_messages[$type], $data); $this->out(' > ' . $message); } } diff --git a/Console/Command/Templates/migration.ctp b/Console/Command/Templates/migration.ctp index 2a53f379..09c0334f 100644 --- a/Console/Command/Templates/migration.ctp +++ b/Console/Command/Templates/migration.ctp @@ -32,7 +32,7 @@ class extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -42,7 +42,7 @@ class extends CakeMigration { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; diff --git a/Docs/Documentation/Examples.md b/Docs/Documentation/Examples.md index c71d7f54..c8b758c7 100644 --- a/Docs/Documentation/Examples.md +++ b/Docs/Documentation/Examples.md @@ -69,7 +69,6 @@ Gets the status of all migrations. ``` cake Migrations.migration status ``` -<<<<<<< Updated upstream Adding a specific datasource -------------------------------------------------- @@ -106,4 +105,4 @@ If you want to jump to certain migration, you can use ```--jump-to``` or ```-j`` cake Migrations.migration run all -j 1458963215_articles_table ``` -Remember all migrations before this will be set as executed. +Remember all migrations before this will be set as executed. \ No newline at end of file diff --git a/Docs/Documentation/Installation.md b/Docs/Documentation/Installation.md index 171b1595..e975812e 100644 --- a/Docs/Documentation/Installation.md +++ b/Docs/Documentation/Installation.md @@ -39,4 +39,8 @@ If any updates are added, go back to the base of your own repository, commit and Composer -------- -The plugin also provides a "composer.json" file, to easily use the plugin through the Composer dependency manager. +To install the plugin with the [Composer dependency manager](https://getcomposer.org/), run the following from your CakePHP project's ROOT directory (where the ``composer.json`` file is located): + +``` +php composer.phar require cakedc/migrations "~2.4.0" +``` diff --git a/Lib/CakeMigration.php b/Lib/CakeMigration.php index 7fe6898d..65813886 100644 --- a/Lib/CakeMigration.php +++ b/Lib/CakeMigration.php @@ -13,7 +13,6 @@ /** * Base Class for Migration management - * */ class CakeMigration extends Object { @@ -110,7 +109,7 @@ class CakeMigration extends Object { * If try, the SQL will be outputted to screen rather than * applied to the database * - * @var boolean + * @var bool */ public $dry = false; @@ -127,7 +126,7 @@ class CakeMigration extends Object { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -137,7 +136,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; @@ -146,7 +145,7 @@ public function after($direction) { /** * Log a dry run SQL query * - * @param str $sql + * @param string $sql SQL query * @return void */ public function logQuery($sql) { @@ -196,10 +195,9 @@ public function __construct($options = array()) { App::uses('PrecheckException', 'Migrations.Lib/Migration'); $this->Precheck = new PrecheckException(); } else { - $class = Inflector::camelize($options['precheck']); - list($plugin, $class) = pluginSplit($class, true); + list($plugin, $class) = pluginSplit($options['precheck'], true); + $class = Inflector::camelize($class); App::uses($class, $plugin . 'Lib/Migration'); - if (!class_exists($class)) { throw new MigrationException($this, sprintf( __d('migrations', 'Migration precheck class (%s) could not be loaded.'), $options['precheck'] @@ -220,7 +218,7 @@ public function __construct($options = array()) { * Run migration * * @param string $direction Direction of migration process (up or down) - * @return boolean Status of the process + * @return bool Status of the process * @throws MigrationException */ public function run($direction) { @@ -310,7 +308,7 @@ protected function _run() { * * @param string $a Type * @param string $b Type - * @return integer Comparison value + * @return int Comparison value */ protected function migration_order($a, $b) { $order = array('drop_table', 'rename_table', 'create_table', 'drop_field', 'rename_field', 'alter_field', 'create_field'); @@ -322,7 +320,7 @@ protected function migration_order($a, $b) { * * @param string $type Type of operation to be done, in this case 'create_table' * @param array $tables List of tables to be created - * @return boolean Return true in case of success, otherwise false + * @return bool Return true in case of success, otherwise false * @throws MigrationException */ protected function _createTable($type, $tables) { @@ -354,7 +352,7 @@ protected function _createTable($type, $tables) { * * @param string $type Type of operation to be done, in this case 'drop_table' * @param array $tables List of tables to be dropped - * @return boolean Return true in case of success, otherwise false + * @return bool Return true in case of success, otherwise false * @throws MigrationException */ protected function _dropTable($type, $tables) { @@ -383,7 +381,7 @@ protected function _dropTable($type, $tables) { * * @param string $type Type of operation to be done, this case 'rename_table' * @param array $tables List of tables to be renamed - * @return boolean Return true in case of success, otherwise false + * @return bool Return true in case of success, otherwise false * @throws MigrationException */ protected function _renameTable($type, $tables) { @@ -411,7 +409,7 @@ protected function _renameTable($type, $tables) { * * @param string $type Type of operation to be done * @param array $tables List of tables and fields - * @return boolean Return true in case of success, otherwise false + * @return bool Return true in case of success, otherwise false * @throws MigrationException */ protected function _alterTable($type, $tables) { @@ -573,12 +571,11 @@ protected function _invokeCallbacks($callback, $type, $data = array()) { * This method will invoke the before/afterAction callbacks, it is good when * you need track every action. * - * @param string $callback Callback name, beforeMigration, beforeAction - * or afterMigration. - * @param string $type Type of action. i.e: create_table, drop_table, etc. - * Or also can be the direction, for before and after Migration callbacks + * @param string $callback Callback name, beforeMigration, beforeAction or afterMigration. + * @param string $type Type of action (e.g. create_table, drop_table, etc.) + * Also can be the direction (before/after) for Migration callbacks * @param array $data Data to send to the callback - * @return boolean + * @return bool */ protected function _invokePrecheck($callback, $type, $data = array()) { if ($this->dry) { @@ -620,7 +617,7 @@ protected function _clearCache() { * * @param string $name Model name to be initialized * @param string $table Table name to be initialized - * @param array $options + * @param array $options Model constructor options * @return Model */ public function generateModel($name, $table = null, $options = array()) { @@ -639,7 +636,6 @@ public function generateModel($name, $table = null, $options = array()) { /** * Exception used when something goes wrong on migrations - * */ class MigrationException extends Exception { @@ -654,7 +650,7 @@ class MigrationException extends Exception { * * @param CakeMigration $Migration Reference to the Migration * @param string $message Message explaining the error - * @param integer $code Error code + * @param int $code Error code * @return \MigrationException */ public function __construct($Migration, $message = '', $code = 0) { diff --git a/Lib/Migration/PrecheckBase.php b/Lib/Migration/PrecheckBase.php index 7f08771c..18b63fc7 100644 --- a/Lib/Migration/PrecheckBase.php +++ b/Lib/Migration/PrecheckBase.php @@ -12,6 +12,8 @@ abstract class PrecheckBase { /** + * CakeMigration instance + * * @var CakeMigration */ protected $_migration; @@ -19,42 +21,42 @@ abstract class PrecheckBase { /** * Perform check before field create. * - * @param string $table - * @param string $field - * @return boolean + * @param string $table Table to look for + * @param string $field Field to look for + * @return bool */ abstract public function checkAddField($table, $field); /** * Perform check before table create. * - * @param string $table - * @return boolean + * @param string $table Table to look for + * @return bool */ abstract public function checkCreateTable($table); /** * Perform check before table drop. * - * @param string $table - * @return boolean + * @param string $table Table to look for + * @return bool */ abstract public function checkDropTable($table); /** * Perform check before field drop. * - * @param string $table - * @param string $field - * @return boolean + * @param string $table Table to look for + * @param string $field Field to look for + * @return bool */ abstract public function checkDropField($table, $field); /** * Check that table exists. * - * @param string $table - * @return boolean + * @param string $table Table to look for + * @return bool */ public function tableExists($table) { $this->_migration->db->cacheSources = false; @@ -65,9 +67,9 @@ public function tableExists($table) { /** * Check that field exists. * - * @param string $table - * @param string $field - * @return boolean + * @param string $table Table to look for + * @param string $field Field to look for + * @return bool */ public function fieldExists($table, $field) { if (!$this->tableExists($table)) { @@ -80,11 +82,11 @@ public function fieldExists($table, $field) { /** * Before action precheck callback. * - * @param $migration - * @param string $type - * @param array $data + * @param CakeMigration $migration Migration to perform + * @param string $type Type of action being performed + * @param array $data Data passed to action * @throws MigrationException - * @return boolean + * @return bool */ public function beforeAction($migration, $type, $data) { $this->_migration = $migration; diff --git a/Lib/Migration/PrecheckCondition.php b/Lib/Migration/PrecheckCondition.php index 326473d7..2fcf5cde 100644 --- a/Lib/Migration/PrecheckCondition.php +++ b/Lib/Migration/PrecheckCondition.php @@ -1,4 +1,4 @@ -tableExists($table); @@ -26,8 +26,8 @@ public function checkDropTable($table) { /** * Perform check before table create. * - * @param string $table - * @return boolean + * @param string $table Table to look for + * @return bool */ public function checkCreateTable($table) { return !$this->tableExists($table); @@ -36,9 +36,9 @@ public function checkCreateTable($table) { /** * Perform check before field drop. * - * @param string $table - * @param string $field - * @return boolean + * @param string $table Table to look for + * @param string $field Field to look for + * @return bool */ public function checkDropField($table, $field) { return $this->tableExists($table) && $this->fieldExists($table, $field); @@ -47,13 +47,12 @@ public function checkDropField($table, $field) { /** * Perform check before field create. * - * @param string $table - * @param string $field - * @return boolean + * @param string $table Table to look for + * @param string $field Field to look for + * @return bool */ public function checkAddField($table, $field) { return $this->tableExists($table) && !$this->fieldExists($table, $field); } } - diff --git a/Lib/Migration/PrecheckException.php b/Lib/Migration/PrecheckException.php index fdeff04f..d6b7de01 100644 --- a/Lib/Migration/PrecheckException.php +++ b/Lib/Migration/PrecheckException.php @@ -1,4 +1,4 @@ -tableExists($table)) { throw new MigrationException($this->_migration, - __d('migrations', 'Table "%s" does not exists in database.', $this->_migration->db->fullTableName($table, false, false)) + __d('migrations', 'Table "%s" does not exist in database.', $this->_migration->db->fullTableName($table, false, false)) ); } return true; } /** - * Check that table exists. + * Check if table already exists. * - * @param string $table + * @param string $table Table to look for * @throws MigrationException - * @return boolean + * @return bool */ public function checkCreateTable($table) { if ($this->tableExists($table)) { @@ -48,15 +48,15 @@ public function checkCreateTable($table) { /** * Perform check before field drop. * - * @param string $table - * @param string $field + * @param string $table Table to look in + * @param string $field Field to look for * @throws MigrationException - * @return boolean + * @return bool */ public function checkDropField($table, $field) { if ($this->tableExists($table) && !$this->fieldExists($table, $field)) { throw new MigrationException($this->_migration, sprintf( - __d('migrations', 'Field "%s" does not exists in "%s".'), $field, $table + __d('migrations', 'Field "%s" does not exist in "%s".'), $field, $table )); } return true; @@ -65,10 +65,10 @@ public function checkDropField($table, $field) { /** * Perform check before field create. * - * @param string $table - * @param string $field + * @param string $table Table to look in + * @param string $field Field to look for * @throws MigrationException - * @return boolean + * @return bool */ public function checkAddField($table, $field) { if ($this->tableExists($table) && $this->fieldExists($table, $field)) { @@ -79,4 +79,4 @@ public function checkAddField($table, $field) { return true; } -} \ No newline at end of file +} diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index f0dca32f..1663bc94 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -18,7 +18,6 @@ /** * Migration version management. - * */ class MigrationVersion { @@ -65,7 +64,7 @@ class MigrationVersion { * If try, the SQL will be outputted to screen rather than * applied to the database * - * @var boolean + * @var bool */ public $dry = false; @@ -135,7 +134,6 @@ public function __construct($options = array()) { * * @return void */ - public function initVersion() { $this->Version = ClassRegistry::init(array( 'class' => 'Migrations.SchemaMigration', @@ -148,7 +146,7 @@ public function initVersion() { * Get last version for given type * * @param string $type Can be 'app' or a plugin name - * @return integer Last version migrated + * @return int Last version migrated */ public function getVersion($type) { $mapping = $this->getMapping($type); @@ -167,11 +165,11 @@ public function getVersion($type) { /** * Set current version for given type * - * @param integer $version Current version + * @param int $version Current version * @param string $type Can be 'app' or a plugin name - * @param boolean $migrated If true, will add the record to the database + * @param bool $migrated If true, will add the record to the database * If false, will remove the record from the database - * @return boolean + * @return bool */ public function setVersion($version, $type, $migrated = true) { if ($this->dry) { @@ -210,7 +208,7 @@ public function setVersion($version, $type, $migrated = true) { * Get mapping for the given type * * @param string $type Can be 'app' or a plugin name - * @param boolean $cache + * @param bool $cache Whether to return the cached value or not * @return mixed False in case of no file found or empty mapping, array with mapping */ public function getMapping($type, $cache = true) { @@ -285,7 +283,7 @@ public function getMapping($type, $cache = true) { * @param string $class Migration class name * @param string $type Can be 'app' or a plugin name * @param array $options Extra options to send to CakeMigration class - * @return boolean|CakeMigration False in case of no file found, instance of the migration + * @return bool|CakeMigration False in case of no file found, instance of the migration * @throws MigrationVersionException */ public function getMigration($name, $class, $type, $options = array()) { @@ -315,7 +313,7 @@ public function getMigration($name, $class, $type, $options = array()) { * - `version` - Until what version want migrate to * * @param array $options An array with options. - * @return boolean + * @return bool * @throws Exception */ public function run($options) { @@ -335,6 +333,10 @@ public function run($options) { } } + if (!empty($this->skip) && is_string($this->skip)) { + $this->skip = explode(',', trim($this->skip)); + } + if ($direction === 'up' && !isset($options['version'])) { $keys = array_keys($mapping); $flipped = array_flip($keys); @@ -366,6 +368,11 @@ public function run($options) { continue; } + if (in_array($mapping[$version]['name'], $this->skip)) { + $this->setVersion($version, $info['type']); + continue; + } + $migration = $this->getMigration($info['name'], $info['class'], $info['type'], $options); $migration->Version = $this; $migration->info = $info; @@ -373,16 +380,18 @@ public function run($options) { try { $result = $migration->run($direction, $options); $this->log[$info['name']] = $migration->getQueryLog(); + } catch (MigrationException $migrationException){ + throw $migrationException; // throw to MigrationShell::_execute } catch (Exception $exception) { $mapping = $this->getMapping($options['type']); if (isset($mapping[$latestVersion]['version'])) { $latestVersionName = '#' . - number_format($mapping[$latestVersion]['version'] / 100, 2, '', '') . ' ' . + sprintf("%'.03d", $mapping[$latestVersion]['version']) . ' ' . $mapping[$latestVersion]['name']; } else { $latestVersionName = null; } - $errorMessage = __d('migrations', sprintf("There was an error during a migration. \n The error was: '%s' \n You must resolve the issue manually and try again.", $exception->getMessage(), $latestVersionName)); + $errorMessage = __d('migrations', "There was an error during a migration. \n The error was: '%s' \n You must resolve the issue manually and try again.", $exception->getMessage(), $latestVersionName); return $errorMessage; } @@ -393,7 +402,6 @@ public function run($options) { if (isset($result)) { return $result; } - return true; } @@ -551,7 +559,6 @@ protected function _enumerateOldMigrations($type) { /** * Usually used when migrations file/class or map files are not found - * */ class MigrationVersionException extends Exception { diff --git a/Lib/Panel/MigrationsPanel.php b/Lib/Panel/MigrationsPanel.php index 78837e8a..e98a4d87 100644 --- a/Lib/Panel/MigrationsPanel.php +++ b/Lib/Panel/MigrationsPanel.php @@ -22,7 +22,6 @@ * 'panels' => array('Migrations.migrations') * )); * @@@ - * */ class MigrationsPanel extends DebugPanel { @@ -57,7 +56,7 @@ class MigrationsPanel extends DebugPanel { /** * BeforeRender Callback * - * @param Controller $controller + * @param Controller $controller Current controller * @return array */ public function beforeRender(Controller $controller) { diff --git a/Locale/deu/LC_MESSAGES/migrations.po b/Locale/deu/LC_MESSAGES/migrations.po index f2e3d05b..4c06b127 100644 --- a/Locale/deu/LC_MESSAGES/migrations.po +++ b/Locale/deu/LC_MESSAGES/migrations.po @@ -8,22 +8,20 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" -"PO-Revision-Date: 2014-07-18 18:28+0100\n" -"Last-Translator: Florian Krämer \n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"PO-Revision-Date: 2015-03-09 17:41-0000\n" +"Last-Translator: Chris Burke \n" "Language-Team: Cake Development Corporation \n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -"X-Poedit-Language: GERMAN\n" -"X-Poedit-Country: GERMANY\n" "X-Poedit-SourceCharset: utf-8\n" +"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" @@ -78,176 +76,181 @@ msgstr "Füge index \":index\" zu \":table\" hinzu." msgid "Dropping index \":index\" from table \":table\"." msgstr "Verwerfe index \":index\" von \":table\"." -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "Keine Migrationen verfügbar." -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "Führe Migrationen aus:" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" -msgstr "Migration führt einen Trockentest durch. Es werden keine Änderungen an der Datenbank vorgenommen." +msgstr "" +"Migration führt einen Trockentest durch. Es werden keine Änderungen an der " +"Datenbank vorgenommen." -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "Alle Migrationen wurden durchgeführt." -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "Es trat ein Fehler während der Durchführung der Migration auf:" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "Migration: %s" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "Error: %s" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." msgstr "Wollen Sie die Migration als erfolgreich markieren? [y]Ja oder [a]bbrechen" -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "Dies ist keine gültige Migrationsversion" -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." -msgstr "Bitte wählen Sie zu welcher Version sie migrieren wollen. [q] um zu beenden " -"oder [c] zum aufräumen." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +msgstr "" +"Bitte wählen Sie zu welcher Version sie migrieren wollen. [q] um zu beenden oder " +"[c] zum aufräumen." -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." +msgstr "Keine Datenbankänderungen erkannt." + +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" msgstr "Möchten Sie einen Dump von der aktuellen Datenbank generieren?" -#: Console/Command/MigrationShell.php:390 +#: Console/Command/MigrationShell.php:422 #, fuzzy -msgid "Do you want update the schema.php file?" -msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" +msgid "Do you want to update the schema.php file?" +msgstr "Möchten Sie die schema.php Datei aktualisieren?" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "Vergleiche schema.php mit der Datenbank..." -#: Console/Command/MigrationShell.php:425 +#: Console/Command/MigrationShell.php:459 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generiere Migration anhand der Kommandozeilenparameter..." -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" msgstr "Üngültiger Parameter" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration " -"from the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration from " +"the CLI." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "Generiere Dump von aktueller Datenbank..." -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Möchten Sie die schema.php Datei mit der Datenbank vergleichen?" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "Generiere Migration..." -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "Fertig." -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "" -"Bitte geben Sie einen deskriptiven Namen für die zu generierende Migration " -"ein." +"Bitte geben Sie einen deskriptiven Namen für die zu generierende Migration ein." -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters " -"and start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters and " +"start with a letter." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 #, fuzzy -msgid "" -"Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "Der Migrations Name (%s) is ungültig. Er darf nur alphanumerische Zeichen " "enthalten." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "Aktuelle Version:" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "Nicht angewandt." -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "Letzte Version:" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "Aktuelle Migrations Version:" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "Verfügbare Migrationen:" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "angewandt" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "nicht angewandt" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" -msgstr "" +msgstr "Fehlende erforderliche Argument 'name' für die Migration" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." -msgstr "" +msgstr "Migration Vorprüfung Klasse (%s) konnte nicht geladen werden." -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Die Migrationsrichtung (%s) ist keine gültige Richtung." -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "Die Migrationsrichtung (%s) ist keine gültige Richtung." -#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Der Aktionstyp (%s) der Migration ist kein gültiger Aktionstyp." -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "SQL Error: %s" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "Unterbrechung" @@ -255,12 +258,12 @@ msgstr "Unterbrechung" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Klasse `%1$s` nicht gefunden in Datei `%2$s` für %3$s." -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "Datei `%1$s` nicht gefunden in %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "Die Tabelle \"%s\" existiert nicht in der Datenbank." #: Lib/Migration/PrecheckException.php:42 @@ -268,7 +271,7 @@ msgid "Table \"%s\" already exists in database." msgstr "Die Tabelle \"%s\" existiert bereits in der Datenbank." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "Das Feld \"%s\" existiert nicht in der Tabelle \"%s\" ." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/fre/LC_MESSAGES/migrations.po b/Locale/fre/LC_MESSAGES/migrations.po index 93700983..6515d956 100644 --- a/Locale/fre/LC_MESSAGES/migrations.po +++ b/Locale/fre/LC_MESSAGES/migrations.po @@ -8,26 +8,25 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" "PO-Revision-Date: \n" -"Last-Translator: Pierre MARTIN \n" +"Last-Translator: Chris Burke \n" "Language-Team: Cake Development Corporation \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -"X-Poedit-Language: FRENCH\n" -"X-Poedit-Country: FRANCE\n" "X-Poedit-SourceCharset: utf-8\n" +"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" +"Désolé, je ne peux pas rétrograder. Pourquoi voudriez-vous que de toute façon?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -78,179 +77,184 @@ msgstr "Ajout de l'index :index à :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Suppression de l'index :index de :table." -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "Aucune migration disponible." -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "Exécution des migrations :" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" msgstr "" +"Migration va fonctionner à sec, pas de changement de base de données seront " +"effectués" -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "Toutes les migrations ont été exécutées." -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "Une erreur est apparue lors de l'exécution de la migration :" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "Migration : %s" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "Erreur : %s" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "" +msgstr "Voulez-vous marquer la migration réussie ? [y] oui ou [a]vorter." -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "Version de migration invalide." -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." msgstr "" -"Veuillez choisir la version vers laquelle vous souhaitez migrer. [q]uitter " -"ou [c] pour nettoyer" +"Veuillez choisir la version vers laquelle vous souhaitez migrer. [q]uitter ou [c] " +"pour nettoyer" -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." +msgstr "Aucun changement de base de données détectées." + +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" msgstr "Voulez vous générer un dump de votre base de données actuelle ?" -#: Console/Command/MigrationShell.php:390 +#: Console/Command/MigrationShell.php:422 #, fuzzy -msgid "Do you want update the schema.php file?" +msgid "Do you want to update the schema.php file?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "Comparaison de schema.php à la base de données ..." -#: Console/Command/MigrationShell.php:425 +#: Console/Command/MigrationShell.php:459 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Génération de la Migration ..." -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" -msgstr "" +msgstr "Invalid argument" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration " -"from the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration from " +"the CLI." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " -"caractères alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " +"alphanumériques." -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "Génération d'un dump de la base de données actuelle ..." -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Voulez vous comparer le fichier schema.php à la base de données ?" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "Génération de la Migration ..." -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "Exécuté." -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Veuillez entrer le nom décrivant la migration à générer :" -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters " -"and start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters and " +"start with a letter." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " -"caractères alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " +"alphanumériques." -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 #, fuzzy -msgid "" -"Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des " -"caractères alphanumériques." +"Le nom de la Migration (%s) est invalide. Il ne doit contenir que des caractères " +"alphanumériques." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "Version actuelle :" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "Aucune appliquée." -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "Dernière version :" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "Version actuelle de la Migration :" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "Migrations disponibles :" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "appliquée" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "non appliquée" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" -msgstr "" +msgstr "Nécessaire argument 'nom' de la migration manquant" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." -msgstr "" +msgstr "Migration classe de précontrôle (%s) n'a pas pu être chargé." -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "" "La direction de la Migration (%s) ne fait pas partie des directions valides." -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "" "La direction de la Migration (%s) ne fait pas partie des directions valides." -#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "" "Le type d'action de la Migration (%s) ne fait pas partie des type d'actions " "valides." -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "Erreur SQL : %s" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "Interrompu lors de l'exécution du callback \"%s\"." @@ -258,12 +262,12 @@ msgstr "Interrompu lors de l'exécution du callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` introuvable dans le fichier `%2$s` pour %3$s." -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "Fichier `%1$s` introuvable dans %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "La table \"%s\" n'existe pas dans la base de données." #: Lib/Migration/PrecheckException.php:42 @@ -271,7 +275,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La table \"%s\" existe déjà dans la base de données." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "Le champ \"%s\" n'existe pas dans \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/ita/LC_MESSAGES/migrations.po b/Locale/ita/LC_MESSAGES/migrations.po index 1c907d40..3269d6de 100644 --- a/Locale/ita/LC_MESSAGES/migrations.po +++ b/Locale/ita/LC_MESSAGES/migrations.po @@ -8,26 +8,25 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" -"PO-Revision-Date: 2014-07-18 18:42+0100\n" -"Last-Translator: Donald \"Lanodd\" Gagliano \n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"PO-Revision-Date: 2015-03-09 17:40-0000\n" +"Last-Translator: Chris Burke \n" "Language-Team: Cake Development Corporation \n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Poedit-Language: Italian\n" -"X-Poedit-Country: ITALY\n" "X-Poedit-SourceCharset: utf-8\n" +"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" +"Mi dispiace, non posso effettuare il downgrade. Perché si vuole che in ogni modo?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -78,175 +77,179 @@ msgstr "Aggiunta indice :index a :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Rimozione indice :index da :table." -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "Nessuna migrazione disponibile." -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "Esecuzione delle migrazioni:" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" msgstr "" +"La migrazione verrà eseguito a secco, saranno apportate modifiche di database" -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "Tutte le migrazioni sono state completate." -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "Si è verificato un errore nell'esecuzione della migrazione:" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "Migrazione: %s" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "Errore: %s" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "" +msgstr "Vuoi segnare la migrazione di successo ?. [y] SI o [a]bortire." -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "Versione di migrazione non valida." -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." msgstr "" -"Per favore, scegliere la versione alla quale si desidera migrare. [q] per " -"uscire o [c] per pulire." +"Per favore, scegliere la versione alla quale si desidera migrare. [q] per uscire " +"o [c] per pulire." -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." +msgstr "Nessuna modifica del database rilevato." + +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" msgstr "Vuoi generare un dump del database corrente?" -#: Console/Command/MigrationShell.php:390 +#: Console/Command/MigrationShell.php:422 #, fuzzy -msgid "Do you want update the schema.php file?" +msgid "Do you want to update the schema.php file?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "Comparazione di schema.php col database..." -#: Console/Command/MigrationShell.php:425 +#: Console/Command/MigrationShell.php:459 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generazione delle Migrazioni..." -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" -msgstr "" +msgstr "Argomento non valido" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration " -"from the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration from " +"the CLI." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "Generazione dump del database corrente..." -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Vuoi comparare il file schema.php col database?" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "Generazione delle Migrazioni..." -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "Fatto." -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Per favore inserire il nome descrittivo della migrazione da generare:" -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters " -"and start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters and " +"start with a letter." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 #, fuzzy -msgid "" -"Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "Il nome (%s) per la migrazione non è valido. Deve contenere solo caratteri " "alfanumerici." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "Versione corrente:" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "Nessuna applicata." -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "Versione più recente:" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "Versione della migrazione corrente:" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "Migrazioni disponibili:" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "applicato" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "non applicato" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" -msgstr "" +msgstr "Mancante richiesta argomento 'nome' per la migrazione" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." -msgstr "" +msgstr "Migrazione classe controllo preliminare (%s) non ha potuto essere caricato." -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "La direzione di migrazione (%s) non è una delle direzioni valide." -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "La direzione di migrazione (%s) non è una delle direzioni valide." -#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Il tipo di azione (%s) non è un tipo di azione valido." -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "Errore SQL: %s" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "Interrotto durante l'esecuzione della callback \"%s\"." @@ -254,12 +257,12 @@ msgstr "Interrotto durante l'esecuzione della callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` non trovata nel file `%2$s` per %3$s." -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "File `%1$s` non trovato in %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "La tabella \"%s\" non esiste nel database." #: Lib/Migration/PrecheckException.php:42 @@ -267,7 +270,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La tabella \"%s\" esiste già nel database." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "il campo \"%s\" non esiste in \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/migrations.pot b/Locale/migrations.pot index 169b6664..d6854948 100644 --- a/Locale/migrations.pot +++ b/Locale/migrations.pot @@ -12,7 +12,7 @@ msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" "PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n" "Last-Translator: NAME \n" "Language-Team: Cake Development Corporation \n" @@ -66,156 +66,160 @@ msgstr "" msgid "Dropping index \":index\" from table \":table\"." msgstr "" -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "" -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" msgstr "" -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "" -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." msgstr "" -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "" -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." msgstr "" -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." msgstr "" -#: Console/Command/MigrationShell.php:390 -msgid "Do you want update the schema.php file?" +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" msgstr "" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:422 +msgid "Do you want to update the schema.php file?" +msgstr "" + +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "" -#: Console/Command/MigrationShell.php:425 +#: Console/Command/MigrationShell.php:459 msgid "Generating migration from commandline arguments..." msgstr "" -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" msgstr "" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 msgid "Migration name (%s) is invalid. It cannot be used to generate a migration from the CLI." msgstr "" -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "" -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 msgid "Do you want to preview the file before generation?" msgstr "" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "" -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "" -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "" -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 msgid "Migration name (%s) is invalid. It must only contain alphanumeric characters and start with a letter." msgstr "" -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "" -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" msgstr "" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." msgstr "" -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "" -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "" -#: Lib/CakeMigration.php:294 -#: Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 +#: Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "" -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "" @@ -223,12 +227,12 @@ msgstr "" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "" -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "" #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "" #: Lib/Migration/PrecheckException.php:42 @@ -236,7 +240,7 @@ msgid "Table \"%s\" already exists in database." msgstr "" #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "" #: Lib/Migration/PrecheckException.php:76 @@ -246,3 +250,4 @@ msgstr "" #: View/Elements/migrations_panel.ctp:12 msgid "Migration Status" msgstr "" + diff --git a/Locale/por/LC_MESSAGES/migrations.po b/Locale/por/LC_MESSAGES/migrations.po index d5c9b80e..e8db05d0 100644 --- a/Locale/por/LC_MESSAGES/migrations.po +++ b/Locale/por/LC_MESSAGES/migrations.po @@ -8,26 +8,26 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" -"PO-Revision-Date: 2014-07-18 18:42+0100\n" -"Last-Translator: Renan Gonçalves \n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"PO-Revision-Date: 2015-03-09 17:39-0000\n" +"Last-Translator: Chris Burke \n" "Language-Team: Cake Development Corporation \n" "Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -"X-Poedit-Language: Portuguese\n" -"X-Poedit-Country: BRAZIL\n" "X-Poedit-SourceCharset: utf-8\n" +"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" msgstr "" +"Desculpe, eu não posso fazer o downgrade. Por que você quer que de qualquer " +"maneira?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -78,174 +78,172 @@ msgstr "Adicionar chave :index para :table." msgid "Dropping index \":index\" from table \":table\"." msgstr "Removendo chave :index de :table." -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "Nenhuma migração disponível." -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "Rodando migrações:" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" -msgstr "" +msgstr "Migração secará, sem alterações de banco de dados será feita" -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "Todas as migrações foram completas." -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "Aconteceu um erro enquanto processava a migração:" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "Migração: %s" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "Erro: %s" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "" +msgstr "Você quer marcar a migração tão bem sucedido ?. [y] sim ou [a]bortar." -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "Não é uma versão de migração válida," -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." -msgstr "" -"Por favor, escolha para qual versão você deseja migrar. [q]uit ou [c]lean." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." +msgstr "Por favor, escolha para qual versão você deseja migrar. [q]uit ou [c]lean." -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." +msgstr "" + +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" msgstr "Você deseja gerar um dump do banco de dados atual?" -#: Console/Command/MigrationShell.php:390 +#: Console/Command/MigrationShell.php:422 #, fuzzy -msgid "Do you want update the schema.php file?" +msgid "Do you want to update the schema.php file?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "Comparando schema.php com o banco de dados..." -#: Console/Command/MigrationShell.php:425 -#, fuzzy +#: Console/Command/MigrationShell.php:459 msgid "Generating migration from commandline arguments..." -msgstr "Gerando Migração..." +msgstr "Gerando migração de argumentos de linha de comando ..." -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" -msgstr "" +msgstr "Invalid argument" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration " -"from the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration from " +"the CLI." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " -"alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "Gerando dump do banco de dados atual..." -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "Você deseja comparar o arquivo schema.php com o banco de dados?" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "Gerando Migração..." -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "Feito." -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Por favor entre com um nome descritivo para a migração a ser gerada:" -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters " -"and start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters and " +"start with a letter." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " -"alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 #, fuzzy -msgid "" -"Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" -"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres " -"alfanuméricos." +"Nome de Migração (%s) inválida. Ele deve conter apenas caracteres alfanuméricos." -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "Versão atual:" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "Nenhuma aplicada." -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "Última versão:" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "Versão de Migração atual:" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "Migrações disponíveis:" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "aplicada" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "não aplicada" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" -msgstr "" +msgstr "Faltando exigido argumento 'nome' para migração" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." -msgstr "" +msgstr "Migração classe pré-verificação (%s) não pôde ser carregado." -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Direção da Migração (%s) não é uma das direções válidas." -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "Direção da Migração (%s) não é uma das direções válidas." -#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Tipo de ação (%s) da Migração não é um dos tipos de ações válidos." -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "Erro SQL: %s" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "Interrompido enquanto rodava o callback \"%s\"." @@ -253,12 +251,12 @@ msgstr "Interrompido enquanto rodava o callback \"%s\"." msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Classe `%1$s` não encontrado no arquivo `%2$s` para %3$s." -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "Arquivo `%1$s` não encontrada no %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "Table \"%s\" não existe no banco de dados." #: Lib/Migration/PrecheckException.php:42 @@ -266,7 +264,7 @@ msgid "Table \"%s\" already exists in database." msgstr "Tabela \"%s\" já existe no banco de dados." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "Coluna \"%s\" não existe em \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Locale/spa/LC_MESSAGES/migrations.po b/Locale/spa/LC_MESSAGES/migrations.po index 70eb0930..2075cfa3 100644 --- a/Locale/spa/LC_MESSAGES/migrations.po +++ b/Locale/spa/LC_MESSAGES/migrations.po @@ -8,25 +8,24 @@ # @copyright Copyright 2010 - 2014, Cake Development Corporation (http://cakedc.com) # @license MIT License (http://www.opensource.org/licenses/mit-license.php) # -#, fuzzy msgid "" msgstr "" "Project-Id-Version: CakePHP Migrations Plugin\n" -"POT-Creation-Date: 2014-07-18 18:10+0200\n" -"PO-Revision-Date: 2014-07-18 18:42+0100\n" -"Last-Translator: José Lorenzo Rodríguez \n" +"POT-Creation-Date: 2015-03-09 17:36+0000\n" +"PO-Revision-Date: 2015-03-09 17:39-0000\n" +"Last-Translator: Chris Burke \n" "Language-Team: Cake Development Corporation \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n!=1);\n" -"X-Poedit-Language: Spanish\n" "X-Poedit-SourceCharset: utf-8\n" +"X-Generator: Poedit 1.7.4\n" #: Config/Migration/002_convert_version_to_class_names.php:56 msgid "Sorry, I can't downgrade. Why would you want that anyways?" -msgstr "" +msgstr "Lo siento, no puedo retroceder. ¿Por qué quieres que de todos modos?" #: Console/Command/MigrationShell.php:75 msgid "Cake Migration Shell" @@ -77,175 +76,177 @@ msgstr "Agregando índice :index a :table" msgid "Dropping index \":index\" from table \":table\"." msgstr "Eliminando índice :index de :table" -#: Console/Command/MigrationShell.php:190 +#: Console/Command/MigrationShell.php:195 msgid "No migrations available." msgstr "No hay migraciones disponibles" -#: Console/Command/MigrationShell.php:220 +#: Console/Command/MigrationShell.php:225 msgid "Running migrations:" msgstr "Ejecutando migraciones:" -#: Console/Command/MigrationShell.php:232 +#: Console/Command/MigrationShell.php:237 msgid "Migration will run dry, no database changes will be made" -msgstr "" +msgstr "La migración se secará, no se harán cambios de base de datos" -#: Console/Command/MigrationShell.php:241 +#: Console/Command/MigrationShell.php:246 msgid "All migrations have completed." msgstr "Todas las migraciones han sido completadas" -#: Console/Command/MigrationShell.php:252 +#: Console/Command/MigrationShell.php:264 msgid "An error occurred when processing the migration:" msgstr "Un error ha ocurrido al procesar la migración:" -#: Console/Command/MigrationShell.php:253 +#: Console/Command/MigrationShell.php:265 msgid "Migration: %s" msgstr "Migración: %s" -#: Console/Command/MigrationShell.php:254 +#: Console/Command/MigrationShell.php:266 msgid "Error: %s" msgstr "Error: %s" -#: Console/Command/MigrationShell.php:258 +#: Console/Command/MigrationShell.php:270 msgid "Do you want to mark the migration as successful?. [y]es or [a]bort." -msgstr "" +msgstr "¿Quieres marcar la migración como un éxito? [y] SÍ o [a]bortar." -#: Console/Command/MigrationShell.php:306;319;346 +#: Console/Command/MigrationShell.php:326;346;373 msgid "Not a valid migration version." msgstr "No es una versión de migración válida" -#: Console/Command/MigrationShell.php:327 -msgid "Please, choose what version you want to migrate to. [q]uit or [c]lean." +#: Console/Command/MigrationShell.php:354 +msgid "Please choose which version you want to migrate to. [q]uit or [c]lean." msgstr "" "Por favor, escoge la versión a lo cual deseas migrar. [q] salir o [c] limpiar" -#: Console/Command/MigrationShell.php:373 -msgid "Do you want compare the schema.php file to the database?" +#: Console/Command/MigrationShell.php:400 +msgid "Do you want to compare the schema.php file to the database?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:379 -msgid "Do you want generate a dump from current database?" -msgstr "" -"¿Desea generar un volcado completo de la estructura de su base de datos?" +#: Console/Command/MigrationShell.php:405 +msgid "No database changes detected." +msgstr "No hay cambios de base de datos detectados." + +#: Console/Command/MigrationShell.php:411 +msgid "Do you want to generate a dump from the current database?" +msgstr "¿Desea generar un volcado completo de la estructura de su base de datos?" -#: Console/Command/MigrationShell.php:390 +#: Console/Command/MigrationShell.php:422 #, fuzzy -msgid "Do you want update the schema.php file?" +msgid "Do you want to update the schema.php file?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:406 +#: Console/Command/MigrationShell.php:439 msgid "Comparing schema.php to the database..." msgstr "Comparando schema.php con la base de datos..." -#: Console/Command/MigrationShell.php:425 +#: Console/Command/MigrationShell.php:459 #, fuzzy msgid "Generating migration from commandline arguments..." msgstr "Generando migración" -#: Console/Command/MigrationShell.php:453;775 +#: Console/Command/MigrationShell.php:487;842 msgid "Invalid argument" -msgstr "" +msgstr "Argumento no válido" -#: Console/Command/MigrationShell.php:453 +#: Console/Command/MigrationShell.php:487 #, fuzzy msgid "" -"Migration name (%s) is invalid. It cannot be used to generate a migration " -"from the CLI." +"Migration name (%s) is invalid. It cannot be used to generate a migration from " +"the CLI." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:474 -msgid "Generating dump from current database..." +#: Console/Command/MigrationShell.php:515 +msgid "Generating dump from the current database..." msgstr "Generando volcado de la base de datos actual" -#: Console/Command/MigrationShell.php:495 +#: Console/Command/MigrationShell.php:537 #, fuzzy msgid "Do you want to preview the file before generation?" msgstr "¿Desea comparar el archivo schema.php a la base de datos?" -#: Console/Command/MigrationShell.php:506 +#: Console/Command/MigrationShell.php:547 msgid "Generating Migration..." msgstr "Generando migración" -#: Console/Command/MigrationShell.php:515 +#: Console/Command/MigrationShell.php:556 msgid "Done." msgstr "Listo." -#: Console/Command/MigrationShell.php:524 +#: Console/Command/MigrationShell.php:566 msgid "Please enter the descriptive name of the migration to generate:" msgstr "Por favor ingrese el nombre descriptivo de la migración a generar:" -#: Console/Command/MigrationShell.php:527 +#: Console/Command/MigrationShell.php:569 #, fuzzy msgid "" -"Migration name (%s) is invalid. It must only contain alphanumeric characters " -"and start with a letter." +"Migration name (%s) is invalid. It must only contain alphanumeric characters and " +"start with a letter." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:530 +#: Console/Command/MigrationShell.php:572 #, fuzzy -msgid "" -"Migration name (%s) is invalid. It cannot be longer than 255 characters." +msgid "Migration name (%s) is invalid. It cannot be longer than 255 characters." msgstr "" "El nombre de migración (%s) no es válido. SOlo puede contenter carateres " "alfanuméricos" -#: Console/Command/MigrationShell.php:566 +#: Console/Command/MigrationShell.php:608 msgid "Current version:" msgstr "Versión Actual:" -#: Console/Command/MigrationShell.php:571 +#: Console/Command/MigrationShell.php:613 msgid "None applied." msgstr "Ninguna aplicada." -#: Console/Command/MigrationShell.php:574 +#: Console/Command/MigrationShell.php:616 msgid "Latest version:" msgstr "Última versión:" -#: Console/Command/MigrationShell.php:598 +#: Console/Command/MigrationShell.php:640 msgid "Current migration version:" msgstr "Versión de migración actual:" -#: Console/Command/MigrationShell.php:603 +#: Console/Command/MigrationShell.php:645 msgid "Available migrations:" msgstr "Migraciones disponibles:" -#: Console/Command/MigrationShell.php:609 +#: Console/Command/MigrationShell.php:651 msgid "applied" msgstr "applicada" -#: Console/Command/MigrationShell.php:611 +#: Console/Command/MigrationShell.php:653 msgid "not applied" msgstr "no aplicada" -#: Console/Command/MigrationShell.php:775 +#: Console/Command/MigrationShell.php:842 msgid "Missing required argument 'name' for migration" -msgstr "" +msgstr "Missing requerido argumento 'nombre' para la migración" -#: Lib/CakeMigration.php:204 +#: Lib/CakeMigration.php:205 msgid "Migration precheck class (%s) could not be loaded." -msgstr "" +msgstr "Clase de comprobación previa Migraciones (%s) no se pudo cargar." -#: Lib/CakeMigration.php:212 +#: Lib/CakeMigration.php:213 #, fuzzy msgid "Migration precheck class (%s) is not a valid precheck class." msgstr "Dirección (%s) de migración no es válida" -#: Lib/CakeMigration.php:228 +#: Lib/CakeMigration.php:229 msgid "Migration direction (%s) is not one of valid directions." msgstr "Dirección (%s) de migración no es válida" -#: Lib/CakeMigration.php:294 Lib/Migration/PrecheckBase.php:111 +#: Lib/CakeMigration.php:295 Lib/Migration/PrecheckBase.php:113 msgid "Migration action type (%s) is not one of valid actions type." msgstr "Acción de tipo %s no es una acción válida" -#: Lib/CakeMigration.php:343;373;401;488;528 +#: Lib/CakeMigration.php:343;373;401;489;529 msgid "SQL Error: %s" msgstr "Error SQL: %s" -#: Lib/CakeMigration.php:566 +#: Lib/CakeMigration.php:567 msgid "Interrupted when running \"%s\" callback." msgstr "Iterrumpido al llamar la función \"%s\"" @@ -253,12 +254,12 @@ msgstr "Iterrumpido al llamar la función \"%s\"" msgid "Class `%1$s` not found on file `%2$s` for %3$s." msgstr "Clase`%1$s` no encontrada en archivo `%2$s` para %3$s." -#: Lib/MigrationVersion.php:408 +#: Lib/MigrationVersion.php:410 msgid "File `%1$s` not found in the %2$s." msgstr "Archivo`%1$s` no encontrado en %2$s." #: Lib/Migration/PrecheckException.php:26 -msgid "Table \"%s\" does not exists in database." +msgid "Table \"%s\" does not exist in database." msgstr "La tabla \"%s\" no existe en la base de datos." #: Lib/Migration/PrecheckException.php:42 @@ -266,7 +267,7 @@ msgid "Table \"%s\" already exists in database." msgstr "La tabla \"%s\" ya existe en la base de datos." #: Lib/Migration/PrecheckException.php:59 -msgid "Field \"%s\" does not exists in \"%s\"." +msgid "Field \"%s\" does not exist in \"%s\"." msgstr "El campo \"%s\" no existe en \"%s\"." #: Lib/Migration/PrecheckException.php:76 diff --git a/Model/SchemaMigration.php b/Model/SchemaMigration.php index 9dafb632..8108f77a 100644 --- a/Model/SchemaMigration.php +++ b/Model/SchemaMigration.php @@ -11,10 +11,10 @@ /** * Default model for manipulating schema migrations - * + * * There is no custom logic yet, but it needs to extends Model instead of AppModel. That is the * reason why a ghost model cannot be used instead */ class SchemaMigration extends Model { -} \ No newline at end of file +} diff --git a/README.md b/README.md index d7997006..93091c9b 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,8 @@ However, you can make use of the ```before()``` and ```after()``` callbacks in t Requirements ------------ -* CakePHP 2.5+ -* PHP 5.2.8+ +* CakePHP 2.7.0+ +* PHP 5.3.0+ Documentation ------------- @@ -34,7 +34,7 @@ For documentation, as well as tutorials, see the [Docs](Docs/Home.md) directory Support ------- -For bugs and feature requests, please use the [issues](https://github.com/CakeDC/migrations/issues) section of this repository. +For bugs and feature requests, please use the [issues](https://github.com/CakeDC/migrations/issues) section of this repository. Commercial support is also available, [contact us](http://cakedc.com/contact) for more information. @@ -48,4 +48,4 @@ License Copyright 2007-2014 Cake Development Corporation (CakeDC). All rights reserved. -Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file. \ No newline at end of file +Licensed under the [MIT](http://www.opensource.org/licenses/mit-license.php) License. Redistributions of the source code included in this repository must retain the copyright notice found in each file. diff --git a/Test/Case/Console/Command/MigrationShellTest.php b/Test/Case/Console/Command/MigrationShellTest.php index ef7b06ec..4dba0b63 100644 --- a/Test/Case/Console/Command/MigrationShellTest.php +++ b/Test/Case/Console/Command/MigrationShellTest.php @@ -14,7 +14,6 @@ /** * TestMigrationShell - * */ class TestMigrationShell extends MigrationShell { @@ -64,7 +63,6 @@ public function writeMigration($name, $class, $migration) { /** * MigrationShellTest - * */ class MigrationShellTest extends CakeTestCase { @@ -121,12 +119,11 @@ public function tearDown() { CakePlugin::unload('TestMigrationPlugin'); CakePlugin::unload('TestMigrationPlugin2'); CakePlugin::unload('TestMigrationPlugin3'); + CakePlugin::unload('TestMigrationPlugin4'); App::build(array('Plugin' => $this->plugins), true); App::objects('plugins', null, false); unset($this->Dispatcher, $this->Shell, $this->plugins); - foreach (glob(TMP . 'tests' . DS . '*.php') as $f) { - unlink($f); - } + $this->_unlink(glob(TMP . 'tests' . DS . '*.php')); } /** @@ -171,6 +168,11 @@ public function testStartup() { $this->Shell->startup(); $this->assertEquals($this->Shell->connection, 'test'); $this->assertEquals($this->Shell->type, 'Migrations'); + + $this->Shell->expects($this->any())->method('in')->will($this->returnValue('test')); + $this->Shell->expects($this->any())->method('_startMigrationConnection')->will($this->returnValue('test')); + $this->Shell->startup(); + $this->assertEquals($this->Shell->migrationConnection, 'test'); } /** @@ -622,7 +624,7 @@ public function testFromComparisonFieldActions() { */ public function testWriteMigration() { // Remove if exists - $this->_unlink('12345_migration_test_file.php'); + $this->_unlink(array(TMP . 'tests' . DS . '12345_migration_test_file.php')); $users = $this->tables['users']; $users['indexes'] = array('UNIQUE_USER' => array('column' => 'user', 'unique' => true)); @@ -684,7 +686,7 @@ public function testWriteMigration() { ); TEXT; $this->assertEquals($result, str_replace("\r\n", "\n", $expected)); - $this->_unlink('12345_migration_test_file.php'); + $this->_unlink(array(TMP . 'tests' . DS . '12345_migration_test_file.php')); } /** @@ -694,7 +696,7 @@ public function testWriteMigration() { * @link https://github.com/CakeDC/migrations/issues/189 */ public function testWriteMigrationIndexesOnly() { - $this->_unlink('12345_migration_test_file.php'); + $this->_unlink(array(TMP . 'tests' . DS . '12346_migration_test_file.php')); $users = $this->tables['users']; $users['indexes'] = array('UNIQUE_USER' => array('column' => 'user', 'unique' => true)); @@ -717,11 +719,10 @@ public function testWriteMigrationIndexesOnly() { ) ); - $this->assertFalse(file_exists(TMP . 'tests' . DS . '12345_migration_test_file.php')); - $this->assertTrue($this->Shell->writeMigration('migration_test_file', 12345, $migration)); - $this->assertTrue(file_exists(TMP . 'tests' . DS . '12345_migration_test_file.php')); + $this->assertTrue($this->Shell->writeMigration('migration_test_file', 12346, $migration)); + $this->assertTrue(file_exists(TMP . 'tests' . DS . '12346_migration_test_file.php')); - $result = $this->_getMigrationVariable(TMP . 'tests' . DS . '12345_migration_test_file.php'); + $result = $this->_getMigrationVariable(TMP . 'tests' . DS . '12346_migration_test_file.php'); $expected = << array( @@ -741,7 +742,7 @@ public function testWriteMigrationIndexesOnly() { ); TEXT; $this->assertEquals($result, str_replace("\r\n", "\n", $expected)); - $this->_unlink('12345_migration_test_file.php'); + $this->_unlink(array(TMP . 'tests' . DS . '12346_migration_test_file.php')); } /** @@ -752,13 +753,14 @@ public function testWriteMigrationIndexesOnly() { public function testGenerate() { $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('Initial Schema')); + $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); + $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('Initial Schema')); + $this->Shell->params['overwrite'] = false; $this->Shell->generate(); + $files = glob(TMP . 'tests' . DS . '*initial_schema.php'); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $this->assertNotEmpty(preg_grep('/([0-9])+_initial_schema\.php$/i', $files)); } @@ -771,15 +773,16 @@ public function testGenerate2() { $this->Shell->expects($this->atLeastOnce())->method('err'); $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('n')); - $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('002 invalid name')); - $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('invalid-name')); - $this->Shell->expects($this->at(6))->method('in')->will($this->returnValue('create some sample_data')); + $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); + $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('002 invalid name')); + $this->Shell->expects($this->at(5))->method('in')->will($this->returnValue('invalid-name')); + $this->Shell->expects($this->at(7))->method('in')->will($this->returnValue('create some sample_data')); + $this->Shell->params['overwrite'] = false; $this->Shell->generate(); + $files = glob(TMP . 'tests' . DS . '*create_some_sample_data.php'); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $this->assertNotEmpty(preg_grep('/([0-9])+_create_some_sample_data\.php$/i', $files)); } @@ -794,20 +797,21 @@ public function testGenerateComparison() { $this->Shell->expects($this->at(2))->method('in')->will($this->returnValue('n')); $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('drop slug field')); $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('y')); - $this->Shell->expects($this->at(5))->method('dispatchShell')->with('schema generate --connection test --force'); + $this->Shell->expects($this->at(5))->method('dispatchShell')->with('schema generate --connection test --force --file schema.php --name TestMigrationPlugin4'); $this->Shell->Version->expects($this->any())->method('getMapping')->will($this->returnCallback(array($this, 'returnMapping'))); $this->assertEmpty(glob(TMP . 'tests' . DS . '*drop_slug_field.php')); - $this->Shell->params['force'] = true; + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*drop_slug_field.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $this->assertNotRegExp('/\'schema_migrations\'/', $result); $pattern = <<Shell->type = 'TestMigrationPlugin4'; + $this->Shell->expects($this->at(0))->method('in')->will($this->returnValue('n')); + $this->Shell->expects($this->at(1))->method('in')->will($this->returnValue('y')); + $this->Shell->expects($this->at(3))->method('in')->will($this->returnValue('n')); + $this->Shell->expects($this->at(4))->method('in')->will($this->returnValue('create slug field')); + + $this->Shell->Version->expects($this->any())->method('getMapping')->will($this->returnCallback(array($this, 'returnMapping'))); + + $this->assertEmpty(glob(TMP . 'tests' . DS . '*create_slug_field.php')); + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); + $this->Shell->generate(); + $files = glob(TMP . 'tests' . DS . '*create_slug_field.php'); + $this->assertNotEmpty($files); + + $result = $this->_getMigrationVariable(current($files)); + $this->_unlink($files); + $this->assertNotRegExp('/\'schema_migrations\'/', $result); + + $pattern = << array\( + 'articles' => array\( + 'slug' => array\('type' => 'string', 'null' => false, 'after' => 'title'\), + \), + \),/ +TEXT; + $this->assertRegExp(str_replace("\r\n", "\n", $pattern), $result); + + $pattern = << array\( + 'articles' => array\('slug'\), + \),/ +TEXT; + $this->assertRegExp(str_replace("\r\n", "\n", $pattern), $result); + } + /** * testGenerateFromCliParamsCreateTable method * test the case of using a command such as: @@ -845,14 +893,15 @@ public function testGenerateFromCliParamsCreateTable() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*create_products.php')); $this->Shell->args = array('create_products', 'id', 'created', 'modified', 'name', 'description:text', 'in_stock:boolean', 'price:float', 'stock_count:integer'); - $this->Shell->params['force'] = true; + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*create_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_create_table_from_cli.txt'); $this->assertEquals($expected, $result); @@ -870,14 +919,15 @@ public function testGenerateFromCliParamsDropTable() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*drop_products.php')); $this->Shell->args = array('drop_products'); - $this->Shell->params['force'] = true; + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*drop_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_drop_table_from_cli.txt'); $this->assertEquals($expected, $result); @@ -895,14 +945,15 @@ public function testGenerateFromCliParamsAddFields() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*add_all_fields_to_products.php')); $this->Shell->args = array('add_all_fields_to_products', 'id', 'created', 'modified', 'name', 'description:text', 'in_stock:boolean', 'price:float', 'stock_count:integer'); - $this->Shell->params['force'] = true; + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*add_all_fields_to_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_add_fields_from_cli.txt'); $this->assertEquals($expected, $result); @@ -920,14 +971,15 @@ public function testGenerateFromCliParamsRemoveFields() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*remove_name_and_desc_from_products.php')); $this->Shell->args = array('remove_name_and_desc_from_products', 'name', 'description'); - $this->Shell->params['force'] = true; + $this->Shell->params = array( + 'force' => true, + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*remove_name_and_desc_from_products.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration_remove_fields_from_cli.txt'); $this->assertEquals($expected, $result); @@ -947,17 +999,18 @@ public function testGenerateDump() { $this->assertEmpty(glob(TMP . 'tests' . DS . '*schema_dump.php')); $this->Shell->type = 'TestMigrationPlugin2'; - $this->Shell->params['force'] = true; - $this->Shell->params['dry'] = false; - $this->Shell->params['precheck'] = 'Migrations.PrecheckException'; + $this->Shell->params = array( + 'force' => true, + 'dry' => false, + 'precheck' => 'Migrations.PrecheckException', + 'overwrite' => false + ); $this->Shell->generate(); $files = glob(TMP . 'tests' . DS . '*schema_dump.php'); $this->assertNotEmpty($files); $result = $this->_getMigrationVariable(current($files)); - foreach ($files as $f) { - unlink($f); - } + $this->_unlink($files); $expected = file_get_contents(CakePlugin::path('Migrations') . '/Test/Fixture/test_migration.txt'); $expected = str_replace("\r\n", "\n", $expected); @@ -1023,13 +1076,12 @@ protected function _getMigrationVariable($file) { /** * Unlink test files from filesystem * - * @param mixed files + * @param array Absolute paths to unlink * @return void */ - protected function _unlink() { - $files = func_get_args(); + protected function _unlink($files) { foreach ($files as $file) { - @unlink(TMP . 'tests' . DS . $file); + @unlink($file); } } diff --git a/Test/Case/Lib/Migration/PrecheckConditionTest.php b/Test/Case/Lib/Migration/PrecheckConditionTest.php index 51cf0124..71c317d7 100644 --- a/Test/Case/Lib/Migration/PrecheckConditionTest.php +++ b/Test/Case/Lib/Migration/PrecheckConditionTest.php @@ -14,7 +14,6 @@ /** * TestPrecheckCakeMigration - * */ class TestPrecheckCakeMigration extends CakeMigration { diff --git a/Test/Case/Lib/MigrationVersionTest.php b/Test/Case/Lib/MigrationVersionTest.php index 9cb7d504..b9793d45 100644 --- a/Test/Case/Lib/MigrationVersionTest.php +++ b/Test/Case/Lib/MigrationVersionTest.php @@ -12,6 +12,7 @@ App::uses('CakeMigration', 'Migrations.Lib'); App::uses('CakeSchema', 'Model'); App::uses('MigrationVersion', 'Migrations.Lib'); +App::uses('CakeTime', 'Utility'); class MigrationVersionTest extends CakeTestCase { @@ -375,8 +376,8 @@ public function testGetVersionByName() { /** * _mapping method * - * @param integer $start - * @param integer $end + * @param int $start + * @param int $end * @return array */ protected function _mapping($start = 0, $end = 0) { @@ -389,10 +390,10 @@ protected function _mapping($start = 0, $end = 0) { 'type' => 'mocks', 'migrated' => null ); if ($i >= $start && $i <= $end) { - $mapping[$i]['migrated'] = date('r'); + $mapping[$i]['migrated'] = CakeTime::nice(); } } return $mapping; } -} \ No newline at end of file +} diff --git a/Test/Case/Lib/Model/CakeMigrationTest.php b/Test/Case/Lib/Model/CakeMigrationTest.php index 76ec1004..78113be0 100644 --- a/Test/Case/Lib/Model/CakeMigrationTest.php +++ b/Test/Case/Lib/Model/CakeMigrationTest.php @@ -14,7 +14,6 @@ /** * TestCakeMigration - * */ class TestCakeMigration extends CakeMigration { @@ -28,7 +27,6 @@ class TestCakeMigration extends CakeMigration { /** * TestCallbackCakeMigration - * */ class TestCallbackCakeMigration { @@ -89,7 +87,6 @@ public function afterAction(&$Migration, $type, $data) { /** * CakeMigrationTest - * */ class CakeMigrationTest extends CakeTestCase { @@ -288,7 +285,7 @@ public function testCreateDropField() { $migration->run('down'); $this->fail('No exception triggered'); } catch (MigrationException $e) { - $this->assertEquals('Field "views" does not exists in "posts".', $e->getMessage()); + $this->assertEquals('Field "views" does not exist in "posts".', $e->getMessage()); } } diff --git a/Test/Fixture/SchemaMigrationsFixture.php b/Test/Fixture/SchemaMigrationsFixture.php index c09725a7..c17b4114 100644 --- a/Test/Fixture/SchemaMigrationsFixture.php +++ b/Test/Fixture/SchemaMigrationsFixture.php @@ -32,4 +32,4 @@ class SchemaMigrationsFixture extends CakeTestFixture { array('id' => '2', 'class' => 'ConvertVersionToClassNames', 'type' => 'migrations', 'created' => '2011-11-18 13:53:32') ); -} \ No newline at end of file +} diff --git a/Test/Fixture/test_migration.txt b/Test/Fixture/test_migration.txt index 54a56ef7..6e34ee3e 100644 --- a/Test/Fixture/test_migration.txt +++ b/Test/Fixture/test_migration.txt @@ -4,55 +4,45 @@ 'articles' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'user_id' => array('type' => 'integer', 'null' => true, 'default' => null, 'unsigned' => false), - 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'title' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB'), - ), - 'jumped_migrations' => array( - 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'class' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 33, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'type' => array('type' => 'string', 'null' => false, 'default' => null, 'length' => 50, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'created' => array('type' => 'datetime', 'null' => false, 'default' => null), - 'indexes' => array( - 'PRIMARY' => array('column' => 'id', 'unique' => 1), - ), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MEMORY'), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), ), 'posts' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), 'author_id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false), - 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'title' => array('type' => 'string', 'null' => false, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'body' => array('type' => 'text', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'published' => array('type' => 'string', 'null' => true, 'default' => 'N', 'length' => 1, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'InnoDB'), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'InnoDB'), ), 'users' => array( 'id' => array('type' => 'integer', 'null' => false, 'default' => null, 'unsigned' => false, 'key' => 'primary'), - 'user' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), - 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'latin1_swedish_ci', 'charset' => 'latin1'), + 'user' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), + 'password' => array('type' => 'string', 'null' => true, 'default' => null, 'collate' => 'utf8_general_ci', 'charset' => 'utf8'), 'created' => array('type' => 'datetime', 'null' => true, 'default' => null), 'updated' => array('type' => 'datetime', 'null' => true, 'default' => null), 'indexes' => array( 'PRIMARY' => array('column' => 'id', 'unique' => 1), ), - 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MEMORY'), + 'tableParameters' => array('charset' => 'utf8', 'collate' => 'utf8_general_ci', 'engine' => 'MEMORY'), ), ), ), 'down' => array( 'drop_table' => array( - 'articles', 'jumped_migrations', 'posts', 'users' + 'articles', 'posts', 'users' ), ), ); \ No newline at end of file diff --git a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php index 1e0cc5b6..89a35aae 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php +++ b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/001_schema_dump.php @@ -22,7 +22,7 @@ class M4af6d40056b04408808500cb58157726 extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -32,7 +32,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; diff --git a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php index 3b420f8e..1a619641 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php +++ b/Test/test_app/Plugin/TestMigrationPlugin/Config/Migration/002_another_migration_plugin_test_migration.php @@ -22,7 +22,7 @@ class AnotherMigrationPluginTestMigration extends CakeMigration { * Before migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function before($direction) { return true; @@ -32,7 +32,7 @@ public function before($direction) { * After migration callback * * @param string $direction Direction of migration process (up or down) - * @return boolean Should process continue + * @return bool Should process continue */ public function after($direction) { return true; diff --git a/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php b/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php index 457cf535..3a9de6b3 100644 --- a/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php +++ b/Test/test_app/Plugin/TestMigrationPlugin4/Config/Schema/schema.php @@ -63,5 +63,4 @@ public function after($event = array()) { 'PRIMARY' => array('column' => 'id', 'unique' => 1) ) ); - -} \ No newline at end of file +} diff --git a/View/Elements/migrations_panel.ctp b/View/Elements/migrations_panel.ctp index 7692b120..1b9b752f 100644 --- a/View/Elements/migrations_panel.ctp +++ b/View/Elements/migrations_panel.ctp @@ -62,46 +62,49 @@ if (document.getElementsByClassName == undefined) { return results; } } +setTimeout(function() { + DEBUGKIT.$(document).ready(function () { + DEBUGKIT.module('migrationsPanel'); + DEBUGKIT.migrationsPanel = function () { + var toolbar = DEBUGKIT.toolbar, + Element = DEBUGKIT.Util.Element, + Cookie = DEBUGKIT.Util.Cookie, + Collection = DEBUGKIT.Util.Collection, + Event = DEBUGKIT.Util.Event, + migrationsHidden = false; -DEBUGKIT.module('migrationsPanel'); -DEBUGKIT.migrationsPanel = function () { - var toolbar = DEBUGKIT.toolbar, - Element = DEBUGKIT.Util.Element, - Cookie = DEBUGKIT.Util.Cookie, - Collection = DEBUGKIT.Util.Collection, - Event = DEBUGKIT.Util.Event, - migrationsHidden = false; + return { + init: function () { + var button = document.getElementById('hide-migrations'), + self = this; - return { - init: function () { - var button = document.getElementById('hide-migrations'), - self = this; + Event.addEvent(button, 'click', function (event) { + event.preventDefault(); + self.toggleMigrations(); + }); - Event.addEvent(button, 'click', function (event) { - event.preventDefault(); - self.toggleMigrations(); - }); + var migrationsState = Cookie.read('migrationsDisplay'); + console.log(migrationsState); + if (migrationsState != 'show') { + migrationsHidden = false; + this.toggleMigrations(); + } + }, - var migrationsState = Cookie.read('migrationsDisplay'); - console.log(migrationsState); - if (migrationsState != 'show') { - migrationsHidden = false; - this.toggleMigrations(); - } - }, - - toggleMigrations: function () { - var display = migrationsHidden ? 'show' : 'hide'; - var arr = document.getElementsByClassName("migration-applied"); - for (i = 0; i < arr.length; i++) { - Element[display](arr[i]); - } - Cookie.write('migrationsDisplay', display); - migrationsHidden = !migrationsHidden; - return false; - } - }; -}(); -DEBUGKIT.loader.register(DEBUGKIT.migrationsPanel); + toggleMigrations: function () { + var display = migrationsHidden ? 'show' : 'hide'; + var arr = document.getElementsByClassName("migration-applied"); + for (i = 0; i < arr.length; i++) { + Element[display](arr[i]); + } + Cookie.write('migrationsDisplay', display); + migrationsHidden = !migrationsHidden; + return false; + } + }; + }(); + DEBUGKIT.loader.register(DEBUGKIT.migrationsPanel); + }); +}, 0); //]]> diff --git a/composer.json b/composer.json index 73aae702..9f458f0a 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "homepage": "http://cakedc.com", "license": "MIT", "authors": [ - { + { "name": "Cake Development Corporation", "email": "team@cakedc.com", "homepage": "http://cakedc.com" From 56e76b7f943521ece3cb72fff238ce4a26c2d0f2 Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 15:28:38 -0300 Subject: [PATCH 6/8] refs #272 removing an unnecessary command --- Console/Command/MigrationShell.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Console/Command/MigrationShell.php b/Console/Command/MigrationShell.php index d4776e46..66f51515 100644 --- a/Console/Command/MigrationShell.php +++ b/Console/Command/MigrationShell.php @@ -457,7 +457,6 @@ public function generate() { $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); } - $response = $this->in(__d('migrations', 'Do you want to compare the schema.php file to the database?'), array('y', 'n'), 'y'); if (strtolower($response) === 'y') { $this->_generateFromComparison($migration, $oldSchema, $comparison); $this->_migrationChanges($migration); From 9a78bf59162d1c7e6a383816d1e9134bd35e22fc Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 18:10:48 -0300 Subject: [PATCH 7/8] refs #272 fixing typography and code standard --- Console/Command/MigrationShell.php | 2 +- Docs/Documentation/Examples.md | 2 +- Lib/MigrationVersion.php | 9 +++++---- Test/Case/Console/Command/MigrationShellTest.php | 6 ++++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Console/Command/MigrationShell.php b/Console/Command/MigrationShell.php index 66f51515..7370baeb 100644 --- a/Console/Command/MigrationShell.php +++ b/Console/Command/MigrationShell.php @@ -183,7 +183,7 @@ public function getOptionParser() { 'help' => __('Skip certain migration.'))) ->addOption('jump-to', array( 'short' => 'j', - 'help' => __('Will jump to the migration and mark the others as executed.'))) + 'help' => __('Jump to a certain migration and mark the preceding migrations as executed.'))) ->addOption('compare', array( 'short' => 'm', 'boolean' => true, diff --git a/Docs/Documentation/Examples.md b/Docs/Documentation/Examples.md index c8b758c7..c54102f9 100644 --- a/Docs/Documentation/Examples.md +++ b/Docs/Documentation/Examples.md @@ -99,7 +99,7 @@ Remember this migrations will be set as executed. Jumping to certain migrations -------------------------------------------------- -If you want to jump to certain migration, you can use ```--jump-to``` or ```-j``` + migration name as the example below. +If you want to jump to a certain migration, you can use ```--jump-to``` or ```-j``` + migration name as in the example below. ``` cake Migrations.migration run all -j 1458963215_articles_table diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index 1663bc94..8ca3cc24 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -76,7 +76,7 @@ class MigrationVersion { public $skip = array(); /** - * Will jump to the migration. + * Jump to a certain migration. * * @var null|string */ @@ -406,10 +406,10 @@ public function run($options) { } /** - * jump method + * Jump to a certain migration and mark the preceding migrations as executed. * - * @param array $version version of a migration - * @param array $info migration info + * @param array $version Version of a migration to jump to. + * @param array $type migration type * @return void */ public function jump($version, $type) { @@ -419,6 +419,7 @@ public function jump($version, $type) { /** * Will return a version based in the migration name * + * @param array $mapping mapping of all migrations. * @return bool|string */ public function getVersionByName($mapping) { diff --git a/Test/Case/Console/Command/MigrationShellTest.php b/Test/Case/Console/Command/MigrationShellTest.php index 4dba0b63..fa8e1e8c 100644 --- a/Test/Case/Console/Command/MigrationShellTest.php +++ b/Test/Case/Console/Command/MigrationShellTest.php @@ -206,7 +206,8 @@ public function testRun() { 'version' => 1, 'dry' => false, 'precheck' => null, - 'skip' => array()))); + 'skip' => array())) + ); $this->Shell->args = array('up'); $this->assertTrue($this->Shell->run()); @@ -229,7 +230,8 @@ public function testRun() { 'version' => 1, 'dry' => false, 'precheck' => null, - 'skip' => array()))); + 'skip' => array())) + ); $this->Shell->args = array('down'); $this->assertTrue($this->Shell->run()); From 1cb39bcd11d65ae9c4ac1a0c88a3efed7ab9e690 Mon Sep 17 00:00:00 2001 From: Peter Moraes Date: Tue, 2 Aug 2016 18:15:40 -0300 Subject: [PATCH 8/8] refs #272 removing duplicated code --- Lib/MigrationVersion.php | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Lib/MigrationVersion.php b/Lib/MigrationVersion.php index 8ca3cc24..5d3d38d5 100644 --- a/Lib/MigrationVersion.php +++ b/Lib/MigrationVersion.php @@ -355,25 +355,20 @@ public function run($options) { break; } elseif (($direction === 'up' && $info['migrated'] === null) || ($direction === 'down' && $info['migrated'] !== null)) { - - $jumpVersion = $this->getVersionByName($mapping); - if ($version < $jumpVersion) { - $this->jump($version, $info['type']); - continue; - } + $type = $info['type']; $jumpVersion = $this->getVersionByName($mapping); if ($version < $jumpVersion) { - $this->jump($version, $info['type']); + $this->jump($version, $type); continue; } if (in_array($mapping[$version]['name'], $this->skip)) { - $this->setVersion($version, $info['type']); + $this->setVersion($version, $type); continue; } - $migration = $this->getMigration($info['name'], $info['class'], $info['type'], $options); + $migration = $this->getMigration($info['name'], $info['class'], $type, $options); $migration->Version = $this; $migration->info = $info; @@ -395,7 +390,7 @@ public function run($options) { return $errorMessage; } - $this->setVersion($version, $info['type'], ($direction === 'up')); + $this->setVersion($version, $type, ($direction === 'up')); } }