| @@ 8-35 (lines=28) @@ | ||
| 5 | ||
| 6 | class NewsStatusColumnConversion extends AbstractMigration |
|
| 7 | { |
|
| 8 | public function up() |
|
| 9 | { |
|
| 10 | $newsTable = $this->table('news'); |
|
| 11 | $newsTable |
|
| 12 | ->addColumn('is_draft', 'boolean', [ |
|
| 13 | 'after' => 'editor', |
|
| 14 | 'null' => false, |
|
| 15 | 'default' => false, |
|
| 16 | 'comment' => 'Whether or not the news article is a draft', |
|
| 17 | ]) |
|
| 18 | ->addColumn('is_deleted', 'boolean', [ |
|
| 19 | 'after' => 'is_draft', |
|
| 20 | 'null' => false, |
|
| 21 | 'default' => false, |
|
| 22 | 'comment' => 'Whether or not the news article has been soft deleted', |
|
| 23 | ]) |
|
| 24 | ->update() |
|
| 25 | ; |
|
| 26 | ||
| 27 | $this->query("UPDATE news SET is_draft = 1 WHERE status = 'revision' OR status ='draft';"); |
|
| 28 | $this->query("UPDATE news SET is_deleted = 1 WHERE status = 'deleted' OR status = 'disabled';"); |
|
| 29 | ||
| 30 | $newsTable |
|
| 31 | ->removeColumn('parent_id') |
|
| 32 | ->removeColumn('status') |
|
| 33 | ->update() |
|
| 34 | ; |
|
| 35 | } |
|
| 36 | ||
| 37 | public function down() |
|
| 38 | { |
|
| @@ 7-33 (lines=27) @@ | ||
| 4 | ||
| 5 | class MapsStatusColumnConversion extends AbstractMigration |
|
| 6 | { |
|
| 7 | public function up() |
|
| 8 | { |
|
| 9 | $mapsTable = $this->table('maps'); |
|
| 10 | $mapsTable |
|
| 11 | ->addColumn('is_inactive', 'boolean', [ |
|
| 12 | 'after' => 'game_mode', |
|
| 13 | 'null' => false, |
|
| 14 | 'default' => false, |
|
| 15 | 'comment' => 'Whether or not this map has been marked as inactive, meaning a map is no longer in active rotation on servers', |
|
| 16 | ]) |
|
| 17 | ->addColumn('is_deleted', 'boolean', [ |
|
| 18 | 'after' => 'is_inactive', |
|
| 19 | 'null' => false, |
|
| 20 | 'default' => false, |
|
| 21 | 'comment' => 'Whether or not this map has been soft deleted' |
|
| 22 | ]) |
|
| 23 | ->update() |
|
| 24 | ; |
|
| 25 | ||
| 26 | $this->query("UPDATE maps SET is_inactive = 1 WHERE status = 'hidden' OR status = 'disabled';"); |
|
| 27 | $this->query("UPDATE maps SET is_deleted = 1 WHERE status = 'deleted';"); |
|
| 28 | ||
| 29 | $mapsTable |
|
| 30 | ->removeColumn('status') |
|
| 31 | ->update() |
|
| 32 | ; |
|
| 33 | } |
|
| 34 | ||
| 35 | public function down() |
|
| 36 | { |
|