Skip to content

Commit

Permalink
Merge pull request #10 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 d8f0fbd + 193621c commit 9008ba1
Show file tree
Hide file tree
Showing 3 changed files with 43 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 options
php /vendor/bin/bluzman db:migrate
```

### Remove module
Expand Down
12 changes: 0 additions & 12 deletions data/migrations/20170317111112_module_options.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,5 @@ public function change()
'update' => 'CASCADE'
])
->create();

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

$privileges = $this->table('acl_privileges');
$privileges->insert($data)
->save();
}
}
42 changes: 42 additions & 0 deletions data/migrations/20170317111122_module_options_permissions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

use Phinx\Migration\AbstractMigration;

class ModuleOptionsPermissions extends AbstractMigration
{
/**
* Migrate Up.
*/
public function up()
{
$data = [
[
'roleId' => 2,
'module' => 'options',
'privilege' => 'Management'
],
[
'roleId' => 2,
'module' => 'api',
'privilege' => 'Options/Read'
],
[
'roleId' => 2,
'module' => 'api',
'privilege' => 'Options/Edit'
],
];

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

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

0 comments on commit 9008ba1

Please sign in to comment.