You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.1 KiB
37 lines
1.1 KiB
<?php |
|
|
|
namespace Tests\Support\Database\Migrations; |
|
|
|
use CodeIgniter\Database\Migration; |
|
|
|
class ExampleMigration extends Migration |
|
{ |
|
protected $DBGroup = 'tests'; |
|
|
|
public function up() |
|
{ |
|
$this->forge->addField('id'); |
|
$this->forge->addField([ |
|
'name' => ['type' => 'varchar', 'constraint' => 31], |
|
'uid' => ['type' => 'varchar', 'constraint' => 31], |
|
'class' => ['type' => 'varchar', 'constraint' => 63], |
|
'icon' => ['type' => 'varchar', 'constraint' => 31], |
|
'summary' => ['type' => 'varchar', 'constraint' => 255], |
|
'created_at' => ['type' => 'datetime', 'null' => true], |
|
'updated_at' => ['type' => 'datetime', 'null' => true], |
|
'deleted_at' => ['type' => 'datetime', 'null' => true], |
|
]); |
|
|
|
$this->forge->addKey('name'); |
|
$this->forge->addKey('uid'); |
|
$this->forge->addKey(['deleted_at', 'id']); |
|
$this->forge->addKey('created_at'); |
|
|
|
$this->forge->createTable('factories'); |
|
} |
|
|
|
public function down() |
|
{ |
|
$this->forge->dropTable('factories'); |
|
} |
|
}
|
|
|