forge->addField([ 'id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, 'auto_increment' => true, ], 'task_id' => [ 'type' => 'INT', 'constraint' => 11, 'unsigned' => true, ], 'title' => [ 'type' => 'VARCHAR', 'constraint' => 255, ], 'is_completed' => [ 'type' => 'BOOLEAN', 'default' => false, ], 'order_index' => [ 'type' => 'INT', 'constraint' => 11, 'default' => 0, ], 'created_at' => [ 'type' => 'DATETIME', 'null' => true, ], 'updated_at' => [ 'type' => 'DATETIME', 'null' => true, ], ]); $this->forge->addKey('id', true); $this->forge->addForeignKey('task_id', 'tasks', 'id', 'CASCADE', 'CASCADE'); $this->forge->createTable('task_subtasks'); } public function down() { $this->forge->dropTable('task_subtasks'); } }