diff --git a/app/Database/Migrations/20181026042034_create_user_sessions_table.php b/app/Database/Migrations/20181026042034_create_user_sessions_table.php deleted file mode 100644 index feecf31..0000000 --- a/app/Database/Migrations/20181026042034_create_user_sessions_table.php +++ /dev/null @@ -1,82 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'VARCHAR', - 'constraint' => 128, - 'null' => false, - ], - 'ip_address' => [ - 'type' => 'VARCHAR', - 'constraint' => 45, - 'null' => false, - ], - 'timestamp' => [ - 'type' => 'INT', - 'constraint' => 10, - 'unsigned' => true, - 'null' => false, - 'default' => 0, - ], - 'data' => [ - 'type' => 'TEXT', - 'null' => false, - 'default' => '', - ], - ]); - $this->forge->addKey('id', true); - $this->forge->addKey('timestamp'); - $this->forge->createTable($config->dbTableUserSessions, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableUserSessions, true); - } -} diff --git a/app/Database/Migrations/20181026110732_create_users_table.php b/app/Database/Migrations/20181026110732_create_users_table.php deleted file mode 100644 index 2cd9126..0000000 --- a/app/Database/Migrations/20181026110732_create_users_table.php +++ /dev/null @@ -1,104 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'email' => [ - 'type' => 'VARCHAR', - 'constraint' => 254, - ], - 'username' => [ - 'type' => 'VARCHAR', - 'constraint' => 150, - 'null' => true, - ], - 'password' => [ - 'type' => 'VARCHAR', - 'constraint' => 255, - ], - 'banned' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - '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, - ], - 'last_ip_address' => [ - 'type' => 'VARCHAR', - 'constraint' => 39, - 'default' => '', - ], - 'last_login' => [ - 'type' => 'DATETIME', - 'default' => null, - ], - 'deleted' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 0, - ], - ]); - $this->forge->addKey('id', true); - $this->forge->createTable($config->dbTableUsers, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableUsers, true); - } -} diff --git a/app/Database/Migrations/20181031062503_create_user_variables.php b/app/Database/Migrations/20181031062503_create_user_variables.php deleted file mode 100644 index 250c18c..0000000 --- a/app/Database/Migrations/20181031062503_create_user_variables.php +++ /dev/null @@ -1,83 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'user_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'data_key' => [ - 'type' => 'VARCHAR', - 'constraint' => 100, - ], - 'data_value' => [ - 'type' => 'TEXT', - ], - 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'system' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 0, - ], - ]); - $this->forge->addKey('id', true); - $this->forge->createTable($config->dbTableUserVariables, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableUserVariables, true); - } -} diff --git a/app/Database/Migrations/20181031063113_create_login_attempts.php b/app/Database/Migrations/20181031063113_create_login_attempts.php deleted file mode 100644 index 35b8723..0000000 --- a/app/Database/Migrations/20181031063113_create_login_attempts.php +++ /dev/null @@ -1,79 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'ip_address' => [ - 'type' => 'VARCHAR', - 'constraint' => 39, - 'default' => 0, - ], - 'user_agent' => [ - 'type' => 'TINYTEXT', - ], - 'count' => [ - 'type' => 'TINYINT', - 'constraint' => 2, - '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); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableLoginAttempts, true); - } -} diff --git a/app/Database/Migrations/20181031063642_create_login_tokens.php b/app/Database/Migrations/20181031063642_create_login_tokens.php deleted file mode 100644 index 4bc8a12..0000000 --- a/app/Database/Migrations/20181031063642_create_login_tokens.php +++ /dev/null @@ -1,80 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'user_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'default' => 0, - ], - 'random_hash' => [ - 'type' => 'VARCHAR', - 'constraint' => 255, - ], - 'selector_hash' => [ - '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); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableLoginTokens, true); - } -} diff --git a/app/Database/Migrations/20181031064211_create_groups.php b/app/Database/Migrations/20181031064211_create_groups.php deleted file mode 100644 index 5786ad7..0000000 --- a/app/Database/Migrations/20181031064211_create_groups.php +++ /dev/null @@ -1,78 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'name' => [ - 'type' => 'VARCHAR', - 'constraint' => 100, - ], - 'definition' => [ - 'type' => 'TEXT', - ], - 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'deleted' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 0, - ], - ]); - $this->forge->addKey('id', true); - $this->forge->createTable($config->dbTableGroups, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableGroups, true); - } -} diff --git a/app/Database/Migrations/20181031064311_create_group_variables.php b/app/Database/Migrations/20181031064311_create_group_variables.php deleted file mode 100644 index 5ddc4d9..0000000 --- a/app/Database/Migrations/20181031064311_create_group_variables.php +++ /dev/null @@ -1,83 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'group_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'data_key' => [ - 'type' => 'VARCHAR', - 'constraint' => 100, - ], - 'data_value' => [ - 'type' => 'TEXT', - ], - 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'system' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 0, - ], - ]); - $this->forge->addKey('id', true); - $this->forge->createTable($config->dbTableGroupVariables, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTableGroupVariables, true); - } -} diff --git a/app/Database/Migrations/20181031064431_create_group_to_user.php b/app/Database/Migrations/20181031064431_create_group_to_user.php deleted file mode 100644 index fb108d1..0000000 --- a/app/Database/Migrations/20181031064431_create_group_to_user.php +++ /dev/null @@ -1,68 +0,0 @@ -forge->addField([ - 'group_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'user_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => 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(); - $this->forge->dropTable($config->dbTableGroupToUser, true); - } -} diff --git a/app/Database/Migrations/20181031064550_create_group_to_group.php b/app/Database/Migrations/20181031064550_create_group_to_group.php deleted file mode 100644 index 6ab0915..0000000 --- a/app/Database/Migrations/20181031064550_create_group_to_group.php +++ /dev/null @@ -1,68 +0,0 @@ -forge->addField([ - 'group_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'subgroup_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => 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(); - $this->forge->dropTable($config->dbTableGroupToGroup, true); - } -} diff --git a/app/Database/Migrations/20181031064714_create_perms.php b/app/Database/Migrations/20181031064714_create_perms.php deleted file mode 100644 index 0298561..0000000 --- a/app/Database/Migrations/20181031064714_create_perms.php +++ /dev/null @@ -1,78 +0,0 @@ -forge->addField([ - 'id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - 'auto_increment' => true, - ], - 'name' => [ - 'type' => 'VARCHAR', - 'constraint' => 100, - ], - 'definition' => [ - 'type' => 'TEXT', - ], - 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'deleted' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 0, - ], - ]); - $this->forge->addKey('id', true); - $this->forge->createTable($config->dbTablePerms, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTablePerms, true); - } -} diff --git a/app/Database/Migrations/20181031065111_create_perm_to_user.php b/app/Database/Migrations/20181031065111_create_perm_to_user.php deleted file mode 100644 index 645c4ac..0000000 --- a/app/Database/Migrations/20181031065111_create_perm_to_user.php +++ /dev/null @@ -1,73 +0,0 @@ -forge->addField([ - 'perm_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'user_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'state' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 1, - ], - ]); - $this->forge->addKey(['perm_id', 'user_id'], true); - $this->forge->createTable($config->dbTablePermToUser, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTablePermToUser, true); - } -} diff --git a/app/Database/Migrations/20181031065240_create_perm_to_group.php b/app/Database/Migrations/20181031065240_create_perm_to_group.php deleted file mode 100644 index e9fe25d..0000000 --- a/app/Database/Migrations/20181031065240_create_perm_to_group.php +++ /dev/null @@ -1,73 +0,0 @@ -forge->addField([ - 'perm_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'group_id' => [ - 'type' => 'INT', - 'constraint' => 11, - 'unsigned' => true, - ], - 'state' => [ - 'type' => 'TINYINT', - 'constraint' => 1, - 'default' => 1, - ], - ]); - $this->forge->addKey(['perm_id', 'user_id'], true); - $this->forge->createTable($config->dbTablePermToGroup, true); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->forge->dropTable($config->dbTablePermToGroup, true); - } -} diff --git a/app/Database/Migrations/20181031072542_create_default_groups.php b/app/Database/Migrations/20181031072542_create_default_groups.php deleted file mode 100644 index afe2dba..0000000 --- a/app/Database/Migrations/20181031072542_create_default_groups.php +++ /dev/null @@ -1,70 +0,0 @@ - $config->groupAdmin, - 'definition' => 'Administators', - ], - [ - 'name' => $config->groupDefault, - 'definition' => 'Users', - ], - [ - 'name' => $config->groupPublic, - 'definition' => 'Guests', - ], - ]; - - $this->db->table($config->dbTableGroups)->insertBatch($data); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->db->table($config->dbTableGroups)->truncate(); - } -} diff --git a/app/Database/Migrations/20181031072914_create_default_users.php b/app/Database/Migrations/20181031072914_create_default_users.php deleted file mode 100644 index 9ce8fb0..0000000 --- a/app/Database/Migrations/20181031072914_create_default_users.php +++ /dev/null @@ -1,86 +0,0 @@ - 'admin', - 'email' => 'admin@example.com', - 'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), - ], - [ - 'username' => 'user', - 'email' => 'user@example.com', - 'password' => password_hash('password123456', $config->passwordHashAlgo, $config->passwordHashOptions), - ], - ]; - - $this->db->table($config->dbTableUsers)->insertBatch($data); - - $data = [ - [ - 'group_id' => 1, - 'user_id' => 1, - ], - [ - 'group_id' => 2, - 'user_id' => 1, - ], - [ - 'group_id' => 2, - 'user_id' => 2, - ], - ]; - - $this->db->table($config->dbTableGroupToUser)->insertBatch($data); - } - - //-------------------------------------------------------------------- - - /** - * Drops Table - * - * @return void - */ - public function down() - { - $config = new AauthConfig(); - $this->db->table($config->dbTableUsers)->truncate(); - $this->db->table($config->dbTableGroupToUser)->truncate(); - } -}