diff --git a/application/Database/Migrations/20181031062503_create_user_variables.php b/application/Database/Migrations/20181031062503_create_user_variables.php index 6d23aa0..da4aabd 100644 --- a/application/Database/Migrations/20181031062503_create_user_variables.php +++ b/application/Database/Migrations/20181031062503_create_user_variables.php @@ -29,10 +29,7 @@ class Migration_create_user_variables extends Migration 'type' => 'TEXT', ], 'created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', - 'updated_at' => [ - 'type' => 'DATETIME', - 'default' => NULL, - ], + 'updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP', 'system' => [ 'type' => 'TINYINT', 'constraint' => 1, diff --git a/application/Database/Migrations/20181031063642_create_login_tokens.php b/application/Database/Migrations/20181031063642_create_login_tokens.php new file mode 100644 index 0000000..7d2d85c --- /dev/null +++ b/application/Database/Migrations/20181031063642_create_login_tokens.php @@ -0,0 +1,47 @@ +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); + } + + //-------------------------------------------------------------------- + + public function down() + { + $config = new AauthConfig(); + $this->forge->dropTable($config->dbTableLoginTokens, true); + } +}