Created
October 16, 2020 13:18
-
-
Save blogcacanid/f8bef7040f1b359fe4795638bb409354 to your computer and use it in GitHub Desktop.
2020_XXXX_users.php Login Dan Register System CodeIgniter 4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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