Skip to content

Instantly share code, notes, and snippets.

@mdmunir
Created April 14, 2016 05:57
Show Gist options
  • Save mdmunir/4836f472888e2611d245543593cf3448 to your computer and use it in GitHub Desktop.
Save mdmunir/4836f472888e2611d245543593cf3448 to your computer and use it in GitHub Desktop.
<?php
use yii\db\Migration;
class m160414_015201_contact_info extends Migration
{
public function up()
{
$tableOptions = null;
if ($this->db->driverName === 'mysql') {
// http://stackoverflow.com/questions/766809/whats-the-difference-between-utf8-general-ci-and-utf8-unicode-ci
$tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB';
}
$this->createTable('{{%contact_info}}', [
'id' => $this->primaryKey(),
'name' => $this->string(64)->notNull(),
'email' => $this->string(64),
'phone' => $this->string(32),
'keterangan' => $this->string(128),
], $tableOptions);
}
public function down()
{
$this->dropTable('{{%contact_info}}');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment