We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
Is it possible to have an exemple of up () migration method when using Module Migrations ?
up ()
<?php /** @var Pimple\Container $container */ $container['phpmig.sets'] = function ($container) { return array( 'cms' => array( 'adapter' => new Adapter\File\Flat('modules/migrationLogs/cms_migrations.log'), 'migrations_path' => 'migrations/cms' ), 'blog' => array( 'adapter' => new Adapter\File\Flat('modules/migrationLogs/blog_migrations.log'), 'migrations_path' => 'migrations/blog' ) ); };
class AddRatingToLolCats extends Migration { /** * Do the migration */ public function up() { $sql = "ALTER TABLE `lol_cats` ADD COLUMN `rating` INT(10) UNSIGNED NULL"; ????????????????? }
The text was updated successfully, but these errors were encountered:
I find a solution studying source code. I had connection in my 'phpmig.sets'
foreach($dbParams as $dbParam => $friendlyName) { $parametersSet[$friendlyName] = array( 'adapter' => new Adapter\PDO\Sql( new PDO( 'mysql:host=' . $ini_array[$dbParam . '.params.host'] . ';dbname=' . $ini_array[$dbParam . '.params.dbname'], $ini_array[$dbParam . '.params.username'], $ini_array[$dbParam . '.params.password']) , 'migrations' ), new Adapter\File\Flat(__DIR__ . DIRECTORY_SEPARATOR . 'migrations/log/' . $friendlyName . '_migrations.log'), 'migrations_path' => 'migrations/' . $friendlyName, 'connection' => new PDO('mysql:host=' . $ini_array[$dbParam . '.params.host'] . ';dbname=' . $ini_array[$dbParam . '.params.dbname'], $ini_array[$dbParam . '.params.username'], $ini_array[$dbParam . '.params.password']) ); }
Then, I can use it in up method like this
$sql = "CREATE TABLE `test` (id INT,data VARCHAR(100));"; if (!$this->getContainer()['phpmig.connection']->query($sql)) { die('error'); }
Sorry, something went wrong.
No branches or pull requests
Hello,
Is it possible to have an exemple of
up ()
migration method when using Module Migrations ?The text was updated successfully, but these errors were encountered: