Skip to content

Instantly share code, notes, and snippets.

@blogcacanid
Created October 16, 2020 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blogcacanid/f8bef7040f1b359fe4795638bb409354 to your computer and use it in GitHub Desktop.
Save blogcacanid/f8bef7040f1b359fe4795638bb409354 to your computer and use it in GitHub Desktop.
2020_XXXX_users.php Login Dan Register System CodeIgniter 4
<?php namespace App\Database\Migrations;
use CodeIgniter\Database\Migration;
class Users extends Migration
{
public function up() {
$this->forge->addField([
'id' => [
'type' => 'INT',
'unsigned' => TRUE,
'auto_increment' => TRUE
],
'name' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => FALSE,
],
'email' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => FALSE,
'unique' => TRUE,
],
'password' => [
'type' => 'VARCHAR',
'constraint' => 255,
'null' => FALSE,
],
'created_at' => [
'type' => 'datetime',
'null' => TRUE
],
'updated_at' => [
'type' => 'datetime',
'null' => TRUE
]
]);
$this->forge->addKey('id', TRUE);
$this->forge->createTable('users');
}
public function down() {
$this->forge->dropTable('users');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment