Browse Source

updated Migrations

v3-dev
REJack 7 years ago
parent
commit
9997568460
  1. 40
      application/Database/Migrations/20181026110732_create_users_table.php
  2. 26
      application/Database/Migrations/20181031062503_create_user_variables.php
  3. 16
      application/Database/Migrations/20181031063113_create_login_attempts.php
  4. 12
      application/Database/Migrations/20181031064211_create_groups.php
  5. 10
      application/Database/Migrations/20181031064431_create_group_to_user.php
  6. 10
      application/Database/Migrations/20181031064550_create_group_to_group.php
  7. 12
      application/Database/Migrations/20181031064714_create_perms.php
  8. 10
      application/Database/Migrations/20181031065111_create_perm_to_user.php
  9. 10
      application/Database/Migrations/20181031065240_create_perm_to_group.php

40
application/Database/Migrations/20181026110732_create_users_table.php

@ -12,51 +12,51 @@ class Migration_create_users_table extends Migration
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => array( 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
'auto_increment' => TRUE, 'auto_increment' => TRUE,
), ],
'email' => array( 'email' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 254, 'constraint' => 254,
), ],
'username' => array( 'username' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 150, 'constraint' => 150,
'null' => TRUE, 'null' => TRUE,
), ],
'password' => array( 'password' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 60, 'constraint' => 60,
), ],
'banned' => array( 'banned' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'null' => TRUE, 'null' => TRUE,
'default' => 0, 'default' => 0,
), ],
'created_datetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_datetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'last_activity' => array( 'last_activity' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => NULL, 'default' => NULL,
), ],
'last_ip_address' => array( 'last_ip_address' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 39, 'constraint' => 39,
'default' => '', 'default' => '',
), ],
'last_login' => array( 'last_login' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => NULL, 'default' => NULL,
), ],
'deleted' => array( 'deleted' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'default' => 0, 'default' => 0,
), ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', TRUE);
$this->forge->createTable($config->dbTableUsers, TRUE); $this->forge->createTable($config->dbTableUsers, TRUE);

26
application/Database/Migrations/20181031062503_create_user_variables.php

@ -10,34 +10,34 @@ class Migration_create_user_variables extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => array( 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
'auto_increment' => TRUE, 'auto_increment' => TRUE,
), ],
'user_id' => array( 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
'data_key' => array( 'data_key' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
), ],
'data_value' => array( 'data_value' => [
'type' => 'TEXT', 'type' => 'TEXT',
), ],
'created_datetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_datetime' => array( 'updated_at' => [
'type' => 'DATETIME', 'type' => 'DATETIME',
'default' => NULL, 'default' => NULL,
), ],
'system' => array( 'system' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 1, 'constraint' => 1,
'default' => 0, 'default' => 0,
), ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', TRUE);
$this->forge->createTable($config->dbTableUserVariables, TRUE); $this->forge->createTable($config->dbTableUserVariables, TRUE);

16
application/Database/Migrations/20181031063113_create_login_attempts.php

@ -10,24 +10,24 @@ class Migration_create_login_attempts extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => array( 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
'auto_increment' => TRUE, 'auto_increment' => TRUE,
), ],
'ip_address' => array( 'ip_address' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 39, 'constraint' => 39,
'default' => 0, 'default' => 0,
), ],
'count' => array( 'count' => [
'type' => 'TINYINT', 'type' => 'TINYINT',
'constraint' => 2, 'constraint' => 2,
'default' => 0, 'default' => 0,
), ],
'created_datetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
'updated_datetime DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', TRUE);
$this->forge->createTable($config->dbTableLoginAttempts, TRUE); $this->forge->createTable($config->dbTableLoginAttempts, TRUE);

12
application/Database/Migrations/20181031064211_create_groups.php

@ -10,19 +10,19 @@ class Migration_create_groups extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => array( 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
'auto_increment' => TRUE, 'auto_increment' => TRUE,
), ],
'name' => array( 'name' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
), ],
'definition' => array( 'definition' => [
'type' => 'TEXT', 'type' => 'TEXT',
), ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', TRUE);
$this->forge->createTable($config->dbTableGroups, TRUE); $this->forge->createTable($config->dbTableGroups, TRUE);

10
application/Database/Migrations/20181031064431_create_group_to_user.php

@ -10,18 +10,18 @@ class Migration_create_group_to_user extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'group_id' => array( 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
'user_id' => array( 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
]); ]);
$this->forge->addKey(array('group_id','user_id'), TRUE); $this->forge->addKey(['group_id','user_id'], TRUE);
$this->forge->createTable($config->dbTableGroupToUser, TRUE); $this->forge->createTable($config->dbTableGroupToUser, TRUE);
} }

10
application/Database/Migrations/20181031064550_create_group_to_group.php

@ -10,18 +10,18 @@ class Migration_create_group_to_group extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'group_id' => array( 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
'subgroup_id' => array( 'subgroup_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
]); ]);
$this->forge->addKey(array('group_id','subgroup_id'), TRUE); $this->forge->addKey(['group_id','subgroup_id'], TRUE);
$this->forge->createTable($config->dbTableGroupToGroup, TRUE); $this->forge->createTable($config->dbTableGroupToGroup, TRUE);
} }

12
application/Database/Migrations/20181031064714_create_perms.php

@ -10,19 +10,19 @@ class Migration_create_perms extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'id' => array( 'id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
'auto_increment' => TRUE, 'auto_increment' => TRUE,
), ],
'name' => array( 'name' => [
'type' => 'VARCHAR', 'type' => 'VARCHAR',
'constraint' => 100, 'constraint' => 100,
), ],
'definition' => array( 'definition' => [
'type' => 'TEXT', 'type' => 'TEXT',
), ],
]); ]);
$this->forge->addKey('id', TRUE); $this->forge->addKey('id', TRUE);
$this->forge->createTable($config->dbTablePerms, TRUE); $this->forge->createTable($config->dbTablePerms, TRUE);

10
application/Database/Migrations/20181031065111_create_perm_to_user.php

@ -10,18 +10,18 @@ class Migration_create_perm_to_user extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'perm_id' => array( 'perm_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
'user_id' => array( 'user_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
]); ]);
$this->forge->addKey(array('perm_id','user_id'), TRUE); $this->forge->addKey(['perm_id','user_id'], TRUE);
$this->forge->createTable($config->dbTablePermToUser, TRUE); $this->forge->createTable($config->dbTablePermToUser, TRUE);
} }

10
application/Database/Migrations/20181031065240_create_perm_to_group.php

@ -10,18 +10,18 @@ class Migration_create_perm_to_group extends Migration
{ {
$config = new AauthConfig(); $config = new AauthConfig();
$this->forge->addField([ $this->forge->addField([
'perm_id' => array( 'perm_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
'group_id' => array( 'group_id' => [
'type' => 'INT', 'type' => 'INT',
'constraint' => 11, 'constraint' => 11,
'unsigned' => TRUE, 'unsigned' => TRUE,
), ],
]); ]);
$this->forge->addKey(array('perm_id','user_id'), TRUE); $this->forge->addKey(['perm_id','user_id'], TRUE);
$this->forge->createTable($config->dbTablePermToGroup, TRUE); $this->forge->createTable($config->dbTablePermToGroup, TRUE);
} }

Loading…
Cancel
Save