Advertisement
Guest User

Untitled

a guest
Jun 28th, 2014
1,664
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.94 KB | None | 0 0
  1. public function safeUp()
  2. {
  3.     $tableOptions = null;
  4.     if ($this->db->driverName === 'mysql') {
  5.         $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB';
  6.     }
  7.  
  8.     $this->createTable('{{%lang}}', [
  9.         'id' => Schema::TYPE_PK,
  10.         'url' => Schema::TYPE_STRING . '(255) NOT NULL',
  11.         'local' => Schema::TYPE_STRING . '(255) NOT NULL',
  12.         'name' => Schema::TYPE_STRING . '(255) NOT NULL',
  13.         'default' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 0',
  14.         'date_update' => Schema::TYPE_INTEGER . ' NOT NULL',
  15.         'date_create' => Schema::TYPE_INTEGER . ' NOT NULL',
  16.     ], $tableOptions);
  17.  
  18.     $this->batchInsert('lang', ['url', 'local', 'name', 'default', 'date_update', 'date_create'], [
  19.         ['en', 'en-EN', 'English', 0, time(), time()],
  20.         ['ru', 'ru-RU', 'Русский', 1, time(), time()],
  21.     ]);
  22. }
  23.  
  24. public function safeDown()
  25. {
  26.     $this->dropTable('{{%lang}}');
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement