Skip to content

Commit

Permalink
Add migration to hopefully fix propagateNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Aug 27, 2018
1 parent fabde6f commit f4fc71f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/migrations/m180826_000000_propagate_nav_setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class m180826_000000_propagate_nav_setting extends Migration
{
public function safeUp()
{
$this->addColumn('{{%navigation_navs}}', 'propagateNodes', $this->boolean()->after('sortOrder')->defaultValue(false)->notNull());
$this->addColumn('{{%navigation_navs}}', 'propagateNodes', $this->boolean()->after('sortOrder')->notNull()->defaultValue(false));

return true;
}

public function safeDown()
Expand Down
23 changes: 23 additions & 0 deletions src/migrations/m180827_000000_propagate_nav_setting_additional.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
namespace verbb\navigation\migrations;

use craft\db\Migration;

class m180827_000000_propagate_nav_setting_additional extends Migration
{
public function safeUp()
{
if (!$this->db->columnExists('{{%navigation_navs}}', 'propagateNodes')) {
$this->addColumn('{{%navigation_navs}}', 'propagateNodes', $this->boolean()->after('sortOrder')->notNull()->defaultValue(false));
}

return true;
}

public function safeDown()
{
echo "m180826_000000_propagate_nav_setting cannot be reverted.\n";

return false;
}
}

0 comments on commit f4fc71f

Please sign in to comment.