diff options
author | Chris Cornutt <enygma@phpdeveloper.org> | 2015-01-24 11:02:53 +0100 |
---|---|---|
committer | Chris Cornutt <enygma@phpdeveloper.org> | 2015-01-24 11:02:53 +0100 |
commit | 2458f4f00d771ae50d3c7eb65cda695b197ade41 (patch) | |
tree | 778916caf597fc95bc33f295882710dc8597dc7a | |
parent | a019f4e2f3097a298bf7697dd4a395ae1a749f50 (diff) | |
download | gatekeeper-2458f4f00d771ae50d3c7eb65cda695b197ade41.zip gatekeeper-2458f4f00d771ae50d3c7eb65cda695b197ade41.tar.gz gatekeeper-2458f4f00d771ae50d3c7eb65cda695b197ade41.tar.bz2 |
adding migration to correctly add indexes
-rw-r--r-- | migrations/20150124094757_fix_unique_indexes.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/migrations/20150124094757_fix_unique_indexes.php b/migrations/20150124094757_fix_unique_indexes.php new file mode 100644 index 0000000..cd18f66 --- /dev/null +++ b/migrations/20150124094757_fix_unique_indexes.php @@ -0,0 +1,28 @@ +<?php + +use Phinx\Migration\AbstractMigration; + +class FixUniqueIndexes extends AbstractMigration +{ + /** + * Migrate Up. + */ + public function up() + { + $this->execute('create unique index permissionid_userid on user_permission(permission_id, user_id)'); + $this->execute('create unique index groupid_userid on user_group(user_id, group_id)'); + $this->execute('create unique index permissionid_parentid on permission_parent(permission_id, parent_id)'); + $this->execute('create unique index permissionid_groupid on group_permission(permission_id, group_id)'); + } + + /** + * Migrate Down. + */ + public function down() + { + $this->execute('drop index permissionid_userid on user_permission'); + $this->execute('drop index groupid_userid on user_group'); + $this->execute('drop index permissionid_parentid on permission_parent'); + $this->execute('drop index permissionid_groupid on group_permission'); + } +}
\ No newline at end of file |