Browse Source

updated Migrations

- changed codestandard to CodeIgniter4 (phpcs)
- added document doc & class doc
- added fuctions docs
v3-dev
REJack 7 years ago
parent
commit
5a05050f0d
  1. 45
      application/Database/Migrations/20181026042034_create_ci_sessions_table.php
  2. 53
      application/Database/Migrations/20181026110732_create_users_table.php
  3. 46
      application/Database/Migrations/20181031062503_create_user_variables.php
  4. 44
      application/Database/Migrations/20181031063113_create_login_attempts.php
  5. 44
      application/Database/Migrations/20181031063642_create_login_tokens.php
  6. 44
      application/Database/Migrations/20181031064211_create_groups.php
  7. 44
      application/Database/Migrations/20181031064431_create_group_to_user.php
  8. 44
      application/Database/Migrations/20181031064550_create_group_to_group.php
  9. 44
      application/Database/Migrations/20181031064714_create_perms.php
  10. 44
      application/Database/Migrations/20181031065111_create_perm_to_user.php
  11. 44
      application/Database/Migrations/20181031065240_create_perm_to_group.php
  12. 38
      application/Database/Migrations/20181031072542_create_default_groups.php
  13. 38
      application/Database/Migrations/20181031072914_create_default_admin.php

45
application/Database/Migrations/20181026042034_create_ci_sessions_table.php

@ -1,35 +1,65 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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' => ''
'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);

53
application/Database/Migrations/20181026110732_create_users_table.php

@ -1,12 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -15,8 +45,8 @@ class Migration_create_users_table extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'email' => [
'type' => 'VARCHAR',
@ -25,7 +55,7 @@ class Migration_create_users_table extends Migration
'username' => [
'type' => 'VARCHAR',
'constraint' => 150,
'null' => TRUE,
'null' => true,
],
'password' => [
'type' => 'VARCHAR',
@ -34,14 +64,14 @@ class Migration_create_users_table extends Migration
'banned' => [
'type' => 'TINYINT',
'constraint' => 1,
'null' => TRUE,
'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,
'default' => null,
],
'last_ip_address' => [
'type' => 'VARCHAR',
@ -50,7 +80,7 @@ class Migration_create_users_table extends Migration
],
'last_login' => [
'type' => 'DATETIME',
'default' => NULL,
'default' => null,
],
'deleted' => [
'type' => 'TINYINT',
@ -58,12 +88,17 @@ class Migration_create_users_table extends Migration
'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();

46
application/Database/Migrations/20181031062503_create_user_variables.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,13 +44,13 @@ class Migration_create_user_variables extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'user_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'unsigned' => true,
],
'data_key' => [
'type' => 'VARCHAR',
@ -36,12 +67,17 @@ class Migration_create_user_variables extends Migration
'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();

44
application/Database/Migrations/20181031063113_create_login_attempts.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,8 +44,8 @@ class Migration_create_login_attempts extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'ip_address' => [
'type' => 'VARCHAR',
@ -29,12 +60,17 @@ class Migration_create_login_attempts extends Migration
'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();

44
application/Database/Migrations/20181031063642_create_login_tokens.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,8 +44,8 @@ class Migration_create_login_tokens extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'user_id' => [
'type' => 'INT',
@ -33,12 +64,17 @@ class Migration_create_login_tokens extends Migration
'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();

44
application/Database/Migrations/20181031064211_create_groups.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,8 +44,8 @@ class Migration_create_groups extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'name' => [
'type' => 'VARCHAR',
@ -24,12 +55,17 @@ class Migration_create_groups extends Migration
'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();

44
application/Database/Migrations/20181031064431_create_group_to_user.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,20 +44,25 @@ class Migration_create_group_to_user extends Migration
'group_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'unsigned' => true,
],
'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();

44
application/Database/Migrations/20181031064550_create_group_to_group.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,20 +44,25 @@ class Migration_create_group_to_group extends Migration
'group_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'unsigned' => true,
],
'subgroup_id' => [
'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();

44
application/Database/Migrations/20181031064714_create_perms.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,8 +44,8 @@ class Migration_create_perms extends Migration
'id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'auto_increment' => TRUE,
'unsigned' => true,
'auto_increment' => true,
],
'name' => [
'type' => 'VARCHAR',
@ -24,12 +55,17 @@ class Migration_create_perms extends Migration
'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();

44
application/Database/Migrations/20181031065111_create_perm_to_user.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,20 +44,25 @@ class Migration_create_perm_to_user extends Migration
'perm_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'unsigned' => true,
],
'user_id' => [
'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();

44
application/Database/Migrations/20181031065240_create_perm_to_group.php

@ -1,11 +1,42 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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();
@ -13,20 +44,25 @@ class Migration_create_perm_to_group extends Migration
'perm_id' => [
'type' => 'INT',
'constraint' => 11,
'unsigned' => TRUE,
'unsigned' => true,
],
'group_id' => [
'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();

38
application/Database/Migrations/20181031072542_create_default_groups.php

@ -1,15 +1,45 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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 = [
[
'name' => $config->adminGroup,
@ -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();
}
}

38
application/Database/Migrations/20181031072914_create_default_admin.php

@ -1,15 +1,45 @@
<?php
/**
* CodeIgniter-Aauth
*
* Aauth is a User Authorization Library for CodeIgniter 4.x, which aims to make
* easy some essential jobs such as login, permissions and access operations.
* Despite ease of use, it has also very advanced features like groupping,
* access management, public access etc..
*
* @package CodeIgniter-Aauth
* @author Magefly Team
* @author Jacob Tomlinson
* @author Tim Swagger (Renowne, LLC) <tim@renowne.com>
* @author Raphael Jackstadt <info@rejack.de>
* @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 = [
'username' => 'admin',
'email' => 'admin@example.com',
@ -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();
}

Loading…
Cancel
Save