summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Cornutt <enygma@phpdeveloper.org>2015-05-08 18:34:14 -0400
committerChris Cornutt <enygma@phpdeveloper.org>2015-05-08 18:34:14 -0400
commit3d9ac1c82505c03f6d6db38f92e1638c9d6c3018 (patch)
treeeae0e8e433153ab6e884161290446e82a9e556de
parent6830c420ad121d972c7e790401dc73940c25759e (diff)
downloadgatekeeper-3d9ac1c82505c03f6d6db38f92e1638c9d6c3018.zip
gatekeeper-3d9ac1c82505c03f6d6db38f92e1638c9d6c3018.tar.gz
gatekeeper-3d9ac1c82505c03f6d6db38f92e1638c9d6c3018.tar.bz2
updating all migrations to work with new table prefix handling
-rw-r--r--migrations/20141211092209_create_user_table.php15
-rw-r--r--migrations/20141211204500_create_group_table.php10
-rw-r--r--migrations/20141211205817_create_group_user_table.php10
-rw-r--r--migrations/20141212101534_create_permissions_table.php10
-rw-r--r--migrations/20141213161408_create_user_permission_table.php10
-rw-r--r--migrations/20141214082627_create_group_permission_table.php10
-rw-r--r--migrations/20141216132116_create_throttle_table.php10
-rw-r--r--migrations/20150109213039_create_group_parent_xref.php10
-rw-r--r--migrations/20150111162554_create_permission_parent_xref.php10
-rw-r--r--migrations/20150124094757_fix_unique_indexes.php20
-rw-r--r--migrations/20150202164329_create_auth_token_table.php10
-rw-r--r--migrations/20150218151720_create_security_questions_table.php10
12 files changed, 67 insertions, 68 deletions
diff --git a/migrations/20141211092209_create_user_table.php b/migrations/20141211092209_create_user_table.php
index d8857af..629a7d0 100644
--- a/migrations/20141211092209_create_user_table.php
+++ b/migrations/20141211092209_create_user_table.php
@@ -1,15 +1,16 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateUserTable extends AbstractMigration
+class CreateUserTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'users';
+
/**
* Migrate Up, create the user table
*/
public function up()
{
- $users = $this->table('users');
+ $tableName = $this->getTableName();
+ $users = $this->table($tableName);
$users->addColumn('username', 'string', array('limit' => 20))
->addColumn('password', 'string', array('limit' => 100))
->addColumn('email', 'string', array('limit' => 100))
@@ -22,8 +23,8 @@ class CreateUserTable extends AbstractMigration
->save();
// Manually add these as there seems to be a bug in Phinx...
- $this->execute('alter table users add password_reset_code VARCHAR(100)');
- $this->execute('alter table users add password_reset_code_timeout DATETIME');
+ $this->execute('alter table '.$tableName.' add password_reset_code VARCHAR(100)');
+ $this->execute('alter table '.$tableName.' add password_reset_code_timeout DATETIME');
}
/**
@@ -31,6 +32,6 @@ class CreateUserTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('users');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141211204500_create_group_table.php b/migrations/20141211204500_create_group_table.php
index db84097..53c94c0 100644
--- a/migrations/20141211204500_create_group_table.php
+++ b/migrations/20141211204500_create_group_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateGroupTable extends AbstractMigration
+class CreateGroupTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'groups';
+
/**
* Migrate Up.
*/
public function up()
{
- $groups = $this->table('groups');
+ $groups = $this->table($this->getTableName());
$groups->addColumn('description', 'string', array('limit' => 20))
->addColumn('created', 'datetime')
->addColumn('updated', 'datetime', array('default' => null))
@@ -23,6 +23,6 @@ class CreateGroupTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('groups');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141211205817_create_group_user_table.php b/migrations/20141211205817_create_group_user_table.php
index b4c4faa..3137194 100644
--- a/migrations/20141211205817_create_group_user_table.php
+++ b/migrations/20141211205817_create_group_user_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateGroupUserTable extends AbstractMigration
+class CreateGroupUserTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'user_group';
+
/**
* Migrate Up.
*/
public function up()
{
- $groups = $this->table('user_group');
+ $groups = $this->table($this->getTableName());
$groups->addColumn('group_id', 'integer')
->addColumn('user_id', 'integer')
->addColumn('created', 'datetime')
@@ -23,6 +23,6 @@ class CreateGroupUserTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('user_group');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141212101534_create_permissions_table.php b/migrations/20141212101534_create_permissions_table.php
index 013fcd5..f6d55a6 100644
--- a/migrations/20141212101534_create_permissions_table.php
+++ b/migrations/20141212101534_create_permissions_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreatePermissionsTable extends AbstractMigration
+class CreatePermissionsTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'permissions';
+
/**
* Migrate Up.
*/
public function up()
{
- $groups = $this->table('permissions');
+ $groups = $this->table($this->getTableName());
$groups->addColumn('name', 'string', array('limit' => 100))
->addColumn('description', 'text')
->addColumn('created', 'datetime')
@@ -23,6 +23,6 @@ class CreatePermissionsTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('permissions');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141213161408_create_user_permission_table.php b/migrations/20141213161408_create_user_permission_table.php
index 21cf2fb..b9e5e8b 100644
--- a/migrations/20141213161408_create_user_permission_table.php
+++ b/migrations/20141213161408_create_user_permission_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateUserPermissionTable extends AbstractMigration
+class CreateUserPermissionTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'user_permission';
+
/**
* Migrate Up.
*/
public function up()
{
- $permissions = $this->table('user_permission');
+ $permissions = $this->table($this->getTableName());
$permissions->addColumn('permission_id', 'integer')
->addColumn('user_id', 'integer')
->addColumn('created', 'datetime')
@@ -23,6 +23,6 @@ class CreateUserPermissionTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('user_group');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141214082627_create_group_permission_table.php b/migrations/20141214082627_create_group_permission_table.php
index bccd6a5..ccb12c8 100644
--- a/migrations/20141214082627_create_group_permission_table.php
+++ b/migrations/20141214082627_create_group_permission_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateGroupPermissionTable extends AbstractMigration
+class CreateGroupPermissionTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'group_permission';
+
/**
* Migrate Up.
*/
public function up()
{
- $permissions = $this->table('group_permission');
+ $permissions = $this->table($this->getTableName());
$permissions->addColumn('permission_id', 'integer')
->addColumn('group_id', 'integer')
->addColumn('created', 'datetime')
@@ -23,6 +23,6 @@ class CreateGroupPermissionTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('group_permission');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20141216132116_create_throttle_table.php b/migrations/20141216132116_create_throttle_table.php
index b882cf7..c244c18 100644
--- a/migrations/20141216132116_create_throttle_table.php
+++ b/migrations/20141216132116_create_throttle_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateThrottleTable extends AbstractMigration
+class CreateThrottleTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'throttle';
+
/**
* Migrate Up.
*/
public function up()
{
- $throttle = $this->table('throttle');
+ $throttle = $this->table($this->getTableName());
$throttle->addColumn('user_id', 'integer')
->addColumn('attempts', 'integer')
->addColumn('status', 'string')
@@ -25,6 +25,6 @@ class CreateThrottleTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('throttle');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20150109213039_create_group_parent_xref.php b/migrations/20150109213039_create_group_parent_xref.php
index c2957ca..612e148 100644
--- a/migrations/20150109213039_create_group_parent_xref.php
+++ b/migrations/20150109213039_create_group_parent_xref.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateGroupParentXref extends AbstractMigration
+class CreateGroupParentXref extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'group_parent';
+
/**
* Migrate Up.
*/
public function up()
{
- $groupXref = $this->table('group_parent');
+ $groupXref = $this->table($this->getTableName());
$groupXref->addColumn('group_id', 'integer')
->addColumn('parent_id', 'integer')
->addColumn('created', 'datetime')
@@ -22,6 +22,6 @@ class CreateGroupParentXref extends AbstractMigration
*/
public function down()
{
- $this->dropTable('group_parent');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20150111162554_create_permission_parent_xref.php b/migrations/20150111162554_create_permission_parent_xref.php
index 7f35327..21d157e 100644
--- a/migrations/20150111162554_create_permission_parent_xref.php
+++ b/migrations/20150111162554_create_permission_parent_xref.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreatePermissionParentXref extends AbstractMigration
+class CreatePermissionParentXref extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'permission_parent';
+
/**
* Migrate Up.
*/
public function up()
{
- $permissionXref = $this->table('permission_parent');
+ $permissionXref = $this->table($this->getTableName());
$permissionXref->addColumn('permission_id', 'integer')
->addColumn('parent_id', 'integer')
->addColumn('created', 'datetime')
@@ -22,6 +22,6 @@ class CreatePermissionParentXref extends AbstractMigration
*/
public function down()
{
- $this->dropTable('permission_parent');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20150124094757_fix_unique_indexes.php b/migrations/20150124094757_fix_unique_indexes.php
index cd18f66..d2d7a67 100644
--- a/migrations/20150124094757_fix_unique_indexes.php
+++ b/migrations/20150124094757_fix_unique_indexes.php
@@ -1,18 +1,16 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class FixUniqueIndexes extends AbstractMigration
+class FixUniqueIndexes extends \Psecio\Gatekeeper\PhinxMigration
{
/**
* 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)');
+ $this->execute('create unique index permissionid_userid on '.$this->getPrefix().'user_permission(permission_id, user_id)');
+ $this->execute('create unique index groupid_userid on '.$this->getPrefix().'user_group(user_id, group_id)');
+ $this->execute('create unique index permissionid_parentid on '.$this->getPrefix().'permission_parent(permission_id, parent_id)');
+ $this->execute('create unique index permissionid_groupid on '.$this->getPrefix().'group_permission(permission_id, group_id)');
}
/**
@@ -20,9 +18,9 @@ class FixUniqueIndexes extends AbstractMigration
*/
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');
+ $this->execute('drop index permissionid_userid on '.$this->getPrefix().'user_permission');
+ $this->execute('drop index groupid_userid on '.$this->getPrefix().'user_group');
+ $this->execute('drop index permissionid_parentid on '.$this->getPrefix().'permission_parent');
+ $this->execute('drop index permissionid_groupid on '.$this->getPrefix().'group_permission');
}
} \ No newline at end of file
diff --git a/migrations/20150202164329_create_auth_token_table.php b/migrations/20150202164329_create_auth_token_table.php
index 5979d06..ebcb084 100644
--- a/migrations/20150202164329_create_auth_token_table.php
+++ b/migrations/20150202164329_create_auth_token_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateAuthTokenTable extends AbstractMigration
+class CreateAuthTokenTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'auth_tokens';
+
/**
* Migrate Up.
*/
public function up()
{
- $tokens = $this->table('auth_tokens');
+ $tokens = $this->table($this->getTableName());
$tokens->addColumn('token', 'string', array('limit' => 100))
->addColumn('user_id', 'integer')
->addColumn('expires', 'datetime')
@@ -23,6 +23,6 @@ class CreateAuthTokenTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('auth_tokens');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file
diff --git a/migrations/20150218151720_create_security_questions_table.php b/migrations/20150218151720_create_security_questions_table.php
index ae0a070..4bf5a9d 100644
--- a/migrations/20150218151720_create_security_questions_table.php
+++ b/migrations/20150218151720_create_security_questions_table.php
@@ -1,15 +1,15 @@
<?php
-use Phinx\Migration\AbstractMigration;
-
-class CreateSecurityQuestionsTable extends AbstractMigration
+class CreateSecurityQuestionsTable extends \Psecio\Gatekeeper\PhinxMigration
{
+ protected $tableName = 'security_questions';
+
/**
* Migrate Up.
*/
public function up()
{
- $tokens = $this->table('security_questions');
+ $tokens = $this->table($this->getTableName());
$tokens->addColumn('question', 'string')
->addColumn('answer', 'string', array('limit' => 100))
->addColumn('user_id', 'integer')
@@ -23,6 +23,6 @@ class CreateSecurityQuestionsTable extends AbstractMigration
*/
public function down()
{
- $this->dropTable('security_questions');
+ $this->dropTable($this->getTableName());
}
} \ No newline at end of file