[ 'type' => 'INT', 'unsigned' => true, 'auto_increment' => true, ], 'locale' => [ 'type' => 'VARCHAR', 'constraint' => 255, 'default' => 'es', ], 'page_id' => [ 'type' => 'INT', 'unsigned' => true, ], 'editor_data' => [ 'type' => 'LONGTEXT', 'null' => true, ], 'published_data' => [ 'type' => 'LONGTEXT', 'null' => true, ], 'published_by' => [ 'type' => 'INT', 'unsigned' => true, 'null' => true, 'constraint' => 10, ], 'last_edit_by' => [ 'type' => 'INT', 'unsigned' => true, 'null' => true, 'constraint' => 10, ], ]; public function up() { $this->forge->addField($this->COLUMNS); $currenttime = new RawSql('CURRENT_TIMESTAMP'); $this->forge->addField([ 'published_at' => [ 'type' => 'TIMESTAMP', 'null' => true, ], 'created_at' => [ 'type' => 'TIMESTAMP', 'default' => $currenttime, ], 'updated_at' => [ 'type' => 'TIMESTAMP', 'null' => true, ], 'deleted_at' => [ 'type' => 'TIMESTAMP', 'null' => true, ], ]); $this->forge->addPrimaryKey('id'); $this->forge->addForeignKey('page_id','wiki_pages','id'); $this->forge->addForeignKey('published_by','users','id'); $this->forge->addForeignKey('last_edit_by','users','id'); $this->forge->createTable("wiki_contents"); } public function down() { $this->forge->dropTable("wiki_contents"); } }