Skip to content

Commit

Permalink
Merge 30241dc into bb78299
Browse files Browse the repository at this point in the history
  • Loading branch information
willkoua committed Jun 2, 2016
2 parents bb78299 + 30241dc commit 130934e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
38 changes: 38 additions & 0 deletions config/Migrations/20160603150448_update_mission_fields.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

use Phinx\Migration\AbstractMigration;

class UpdateMissionFields extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{

$table = $this->table('missions');
$table->addColumn('isCompleted', 'boolean', [
'default' => false,
'null' => false,
]);
$table->update();
}
}
39 changes: 39 additions & 0 deletions config/Migrations/20160603153447_update_user_isprofessor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

use Phinx\Migration\AbstractMigration;

class UpdateUserIsprofessor extends AbstractMigration
{
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* The following commands can be used in this method and Phinx will
* automatically reverse them when rolling back:
*
* createTable
* renameTable
* addColumn
* renameColumn
* addIndex
* addForeignKey
*
* Remember to call "create()" or "update()" and NOT "save()" when working
* with the Table class.
*/
public function change()
{
$this->execute('UPDATE users SET isProfessor = 0 WHERE users.isProfessor IS NULL ');

$table = $this->table('users');
$table->changeColumn('isProfessor', 'boolean', [
'default' => 0,
'null' => false
]);

}
}

0 comments on commit 130934e

Please sign in to comment.