diff --git a/application/Database/Migrations/20181026042034_create_ci_sessions_table.php b/application/Database/Migrations/20181026042034_create_ci_sessions_table.php index f632d13..971f596 100644 --- a/application/Database/Migrations/20181026042034_create_ci_sessions_table.php +++ b/application/Database/Migrations/20181026042034_create_ci_sessions_table.php @@ -1,35 +1,65 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; +/** + * Create CI session table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_ci_sessions_table extends Migration { - + /** + * Create Table + * + * @return void + */ public function up() { $this->forge->addField([ 'id' => [ 'type' => 'VARCHAR', 'constraint' => 128, - 'null' => false + 'null' => false, ], 'ip_address' => [ 'type' => 'VARCHAR', 'constraint' => 45, - 'null' => false + 'null' => false, ], 'timestamp' => [ 'type' => 'INT', 'constraint' => 10, 'unsigned' => true, 'null' => false, - 'default' => 0 + 'default' => 0, ], 'data' => [ - 'type' => 'TEXT', - 'null' => false, - 'default' => '' + 'type' => 'TEXT', + 'null' => false, + 'default' => '', ], ]); $this->forge->addKey('id', true); @@ -39,6 +69,11 @@ class Migration_create_ci_sessions_table extends Migration //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $this->forge->dropTable('ci_sessions', true); diff --git a/application/Database/Migrations/20181026110732_create_users_table.php b/application/Database/Migrations/20181026110732_create_users_table.php index 8b9fb65..3cf308b 100644 --- a/application/Database/Migrations/20181026110732_create_users_table.php +++ b/application/Database/Migrations/20181026110732_create_users_table.php @@ -1,69 +1,104 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create users table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_users_table extends Migration { - + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], 'email' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 254, ], 'username' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 150, - 'null' => TRUE, + 'null' => true, ], 'password' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 60, ], 'banned' => [ - 'type' => 'TINYINT', + 'type' => 'TINYINT', 'constraint' => 1, - 'null' => TRUE, - 'default' => 0, + 'null' => true, + 'default' => 0, ], 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'last_activity' => [ - 'type' => 'DATETIME', - 'default' => NULL, + 'type' => 'DATETIME', + 'default' => null, ], 'last_ip_address' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 39, - 'default' => '', + 'default' => '', ], 'last_login' => [ - 'type' => 'DATETIME', - 'default' => NULL, + 'type' => 'DATETIME', + 'default' => null, ], 'deleted' => [ - 'type' => 'TINYINT', + 'type' => 'TINYINT', 'constraint' => 1, - 'default' => 0, + 'default' => 0, ], ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTableUsers, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTableUsers, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031062503_create_user_variables.php b/application/Database/Migrations/20181031062503_create_user_variables.php index da4aabd..7e77ba0 100644 --- a/application/Database/Migrations/20181031062503_create_user_variables.php +++ b/application/Database/Migrations/20181031062503_create_user_variables.php @@ -1,28 +1,59 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create user variables table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_user_variables extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], 'user_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], 'data_key' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 100, ], 'data_value' => [ @@ -31,17 +62,22 @@ class Migration_create_user_variables extends Migration 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'system' => [ - 'type' => 'TINYINT', + 'type' => 'TINYINT', 'constraint' => 1, - 'default' => 0, + 'default' => 0, ], ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTableUserVariables, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTableUserVariables, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031063113_create_login_attempts.php b/application/Database/Migrations/20181031063113_create_login_attempts.php index 0bf2732..00d51cf 100644 --- a/application/Database/Migrations/20181031063113_create_login_attempts.php +++ b/application/Database/Migrations/20181031063113_create_login_attempts.php @@ -1,40 +1,76 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create login attempts table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_login_attempts extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], 'ip_address' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 39, - 'default' => 0, + 'default' => 0, ], 'count' => [ - 'type' => 'TINYINT', + 'type' => 'TINYINT', 'constraint' => 2, - 'default' => 0, + 'default' => 0, ], 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTableLoginAttempts, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTableLoginAttempts, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031063642_create_login_tokens.php b/application/Database/Migrations/20181031063642_create_login_tokens.php index 7d2d85c..b6021b8 100644 --- a/application/Database/Migrations/20181031063642_create_login_tokens.php +++ b/application/Database/Migrations/20181031063642_create_login_tokens.php @@ -1,44 +1,80 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create login tokens table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_login_tokens extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], 'user_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'default' => 0, + 'default' => 0, ], 'random_hash' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 255, ], 'selector_hash' => [ - 'type' => 'VARCHAR', + 'type' => 'VARCHAR', 'constraint' => 255, ], 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'expires_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTableLoginTokens, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTableLoginTokens, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031064211_create_groups.php b/application/Database/Migrations/20181031064211_create_groups.php index 5f0e77a..3f4d5d2 100644 --- a/application/Database/Migrations/20181031064211_create_groups.php +++ b/application/Database/Migrations/20181031064211_create_groups.php @@ -1,35 +1,71 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create group tables + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_groups extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], - 'name' => [ - 'type' => 'VARCHAR', + 'name' => [ + 'type' => 'VARCHAR', 'constraint' => 100, ], 'definition' => [ 'type' => 'TEXT', ], ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTableGroups, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTableGroups, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031064431_create_group_to_user.php b/application/Database/Migrations/20181031064431_create_group_to_user.php index f40ac16..835761d 100644 --- a/application/Database/Migrations/20181031064431_create_group_to_user.php +++ b/application/Database/Migrations/20181031064431_create_group_to_user.php @@ -1,32 +1,68 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create group to user table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_group_to_user extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'group_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], - 'user_id' => [ - 'type' => 'INT', + 'user_id' => [ + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], ]); - $this->forge->addKey(['group_id','user_id'], TRUE); - $this->forge->createTable($config->dbTableGroupToUser, TRUE); + $this->forge->addKey(['group_id', 'user_id'], true); + $this->forge->createTable($config->dbTableGroupToUser, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031064550_create_group_to_group.php b/application/Database/Migrations/20181031064550_create_group_to_group.php index be5b30d..a772875 100644 --- a/application/Database/Migrations/20181031064550_create_group_to_group.php +++ b/application/Database/Migrations/20181031064550_create_group_to_group.php @@ -1,32 +1,68 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create group to group table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_group_to_group extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ - 'group_id' => [ - 'type' => 'INT', + 'group_id' => [ + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], 'subgroup_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], ]); - $this->forge->addKey(['group_id','subgroup_id'], TRUE); - $this->forge->createTable($config->dbTableGroupToGroup, TRUE); + $this->forge->addKey(['group_id', 'subgroup_id'], true); + $this->forge->createTable($config->dbTableGroupToGroup, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031064714_create_perms.php b/application/Database/Migrations/20181031064714_create_perms.php index 556772c..2f6c84e 100644 --- a/application/Database/Migrations/20181031064714_create_perms.php +++ b/application/Database/Migrations/20181031064714_create_perms.php @@ -1,35 +1,71 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create perms table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_perms extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => TRUE, - 'auto_increment' => TRUE, + 'id' => [ + 'type' => 'INT', + 'constraint' => 11, + 'unsigned' => true, + 'auto_increment' => true, ], - 'name' => [ - 'type' => 'VARCHAR', + 'name' => [ + 'type' => 'VARCHAR', 'constraint' => 100, ], 'definition' => [ 'type' => 'TEXT', ], ]); - $this->forge->addKey('id', TRUE); - $this->forge->createTable($config->dbTablePerms, TRUE); + $this->forge->addKey('id', true); + $this->forge->createTable($config->dbTablePerms, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031065111_create_perm_to_user.php b/application/Database/Migrations/20181031065111_create_perm_to_user.php index 57e7f06..6ecf874 100644 --- a/application/Database/Migrations/20181031065111_create_perm_to_user.php +++ b/application/Database/Migrations/20181031065111_create_perm_to_user.php @@ -1,32 +1,68 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create perm to user table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_perm_to_user extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ 'perm_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], 'user_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], ]); - $this->forge->addKey(['perm_id','user_id'], TRUE); - $this->forge->createTable($config->dbTablePermToUser, TRUE); + $this->forge->addKey(['perm_id', 'user_id'], true); + $this->forge->createTable($config->dbTablePermToUser, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031065240_create_perm_to_group.php b/application/Database/Migrations/20181031065240_create_perm_to_group.php index cfefccf..3ed7205 100644 --- a/application/Database/Migrations/20181031065240_create_perm_to_group.php +++ b/application/Database/Migrations/20181031065240_create_perm_to_group.php @@ -1,32 +1,68 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create perm to group table + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_perm_to_group extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); $this->forge->addField([ - 'perm_id' => [ - 'type' => 'INT', + 'perm_id' => [ + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], 'group_id' => [ - 'type' => 'INT', + 'type' => 'INT', 'constraint' => 11, - 'unsigned' => TRUE, + 'unsigned' => true, ], ]); - $this->forge->addKey(['perm_id','user_id'], TRUE); - $this->forge->createTable($config->dbTablePermToGroup, TRUE); + $this->forge->addKey(['perm_id', 'user_id'], true); + $this->forge->createTable($config->dbTablePermToGroup, true); } //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { $config = new AauthConfig(); diff --git a/application/Database/Migrations/20181031072542_create_default_groups.php b/application/Database/Migrations/20181031072542_create_default_groups.php index 0d6be7b..8d203f2 100644 --- a/application/Database/Migrations/20181031072542_create_default_groups.php +++ b/application/Database/Migrations/20181031072542_create_default_groups.php @@ -1,16 +1,46 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create default groups + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_default_groups extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); - - $data = [ + $data = [ [ 'name' => $config->adminGroup, 'definition' => 'Administators', @@ -30,8 +60,14 @@ class Migration_create_default_groups extends Migration //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { + $config = new AauthConfig(); $this->db->table($config->dbTableGroups)->truncate(); } } diff --git a/application/Database/Migrations/20181031072914_create_default_admin.php b/application/Database/Migrations/20181031072914_create_default_admin.php index 768a99d..ce8435f 100644 --- a/application/Database/Migrations/20181031072914_create_default_admin.php +++ b/application/Database/Migrations/20181031072914_create_default_admin.php @@ -1,16 +1,46 @@ + * @author Raphael Jackstadt + * @copyright 2014-2017 Emre Akay + * @copyright 2018 Magefly + * @license https://opensource.org/licenses/MIT MIT License + * @link https://github.com/magefly/CodeIgniter-Aauth + */ + namespace App\Database\Migrations; use CodeIgniter\Database\Migration; use Config\Aauth as AauthConfig; +/** + * Create default admin + * + * @package CodeIgniter-Aauth + * + * @codeCoverageIgnore + */ class Migration_create_default_admin extends Migration { + /** + * Create Table + * + * @return void + */ public function up() { $config = new AauthConfig(); - - $data = [ + $data = [ 'username' => 'admin', 'email' => 'admin@example.com', 'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), @@ -34,8 +64,14 @@ class Migration_create_default_admin extends Migration //-------------------------------------------------------------------- + /** + * Drops Table + * + * @return void + */ public function down() { + $config = new AauthConfig(); $this->db->table($config->dbTableUsers)->truncate(); $this->db->table($config->dbTableGroupToUser)->truncate(); }