forge->addField([ 'id' => [ 'type' => 'CHAR', 'constraint' => 36, 'null' => false, ], 'user_id' => [ 'type' => 'CHAR', 'constraint' => 36, 'null' => false, ], 'name' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'null' => false, ], 'description' => [ 'type' => 'TEXT', 'null' => true, ], 'color' => [ 'type' => 'VARCHAR', 'constraint' => 7, 'null' => true, 'comment' => 'Hex color for UI', ], 'created_at' => [ 'type' => 'DATETIME', 'null' => true, ], ]); $this->forge->addKey('id', true); $this->forge->addKey('user_id'); $this->forge->addForeignKey('user_id', 'users', 'id', 'CASCADE', 'CASCADE'); $this->forge->createTable('projects'); } public function down() { $this->forge->dropTable('projects'); } }