Skip to content

Commit

Permalink
Merge pull request #11 from bluzphp/develop
Browse files Browse the repository at this point in the history
Fixed migrations (divided into structure and data migrations)
  • Loading branch information
Anton authored Oct 13, 2017
2 parents 5eca667 + 1a8cf1e commit f0ed0b0
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ To install the module run the command:

```bash
php /vendor/bin/bluzman module:install categories
php /vendor/bin/bluzman db:migrate
```

### Remove module
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,5 @@ public function change()
])
->addIndex(['parentId', 'alias'], ['unique' => true, 'name' => 'UNIQUE_categories_alias'])
->create();

$data = [
[
'roleId' => 2,
'module' => 'categories',
'privilege' => 'Management'
]
];

$privileges = $this->table('acl_privileges');
$privileges->insert($data)
->save();
}
}
39 changes: 39 additions & 0 deletions data/migrations/20170317111412_module_categories_permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php
/**
* @copyright Bluz PHP Team
* @link https://github.com/bluzphp/skeleton
*/

use Phinx\Migration\AbstractMigration;

/**
* CreateCategoriesTable
*/
class ModuleCategoriesPermissions extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$data = [
[
'roleId' => 2,
'module' => 'categories',
'privilege' => 'Management'
]
];

$privileges = $this->table('acl_privileges');
$privileges->insert($data)
->save();
}

/**
* Migrate Down.
*/
public function down()
{
$this->execute('DELETE FROM acl_privileges WHERE module = "categories"');
}
}

0 comments on commit f0ed0b0

Please sign in to comment.