Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Database\Migrations;
- use CodeIgniter\Database\Migration;
- class Users extends Migration
- {
- public function up()
- {
- $this->forge->addField([
- 'id' => [
- 'type' => 'INT',
- 'constraint' => 5,
- 'unsigned' => true,
- 'auto_increment' => true,
- ],
- 'username' => [
- 'type' => 'VARCHAR',
- 'constraint' => '25',
- ],
- 'password' => [
- 'type' => 'VARCHAR',
- 'constraint' => '65',
- ],
- 'name' => [
- 'type' => 'VARCHAR',
- 'constraint' => '75',
- 'null' => true,
- ],
- 'job' => [
- 'type' => 'VARCHAR',
- 'constraint' => '75',
- 'null' => true,
- ],
- 'phone' => [
- 'type' => 'VARCHAR',
- 'constraint' => '15',
- 'null' => true,
- ],
- 'email' => [
- 'type' => 'VARCHAR',
- 'constraint' => '75',
- 'null' => true,
- ],
- 'level' => [
- 'type' => 'VARCHAR',
- 'constraint' => '15',
- ],
- 'active' => [
- 'type' => 'ENUM',
- 'constraint' => ['Y', 'N'],
- 'default' => 'N',
- ],
- 'photo' => [
- 'type' => 'VARCHAR',
- 'constraint' => '75',
- 'null' => true,
- ],
- ]);
- $this->forge->addKey('id', true);
- $this->forge->createTable('users');
- }
- public function down()
- {
- $this->forge->dropTable('users');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement