Skip to content

Instantly share code, notes, and snippets.

@minons1
Created June 26, 2021 18:59
Show Gist options
  • Save minons1/f3d51a71a55b661c87abdecd4947ea3f to your computer and use it in GitHub Desktop.
Save minons1/f3d51a71a55b661c87abdecd4947ea3f to your computer and use it in GitHub Desktop.
Class CreateBlogTable extends Migration
{
public function up()
{
$this->forge->addField([
'blog_id' => [
'type' => 'INT',
'constraint' => 5,
'unsigned' => true,
'auto_increment' => true,
],
'blog_title' => [
'type' => 'VARCHAR',
'constraint' => '100',
],
'blog_description' => [
'type' => 'TEXT',
'null' => true,
],
'created_at' => [
'type' => 'DATETIME',
'null' => true,
],
'updated_at' => [
'type' => 'DATETIME',
'null' => true,
],
]);
$this->forge->addKey('blog_id', true);
$this->forge->createTable('blog', true);
}
public function down()
{
$this->forge->dropTable('blog');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment