Exemplo n.º 1
0
 public function dbInstall()
 {
     $db = Yii::$app->db;
     $tableOptions = null;
     if ($db->driverName === 'mysql') {
         $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=MyISAM';
     }
     $db->createCommand()->createTable(Subscriber::tableName(), ['subscriber_id' => 'pk', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $tableOptions)->execute();
     $db->createCommand()->createTable(History::tableName(), ['history_id' => 'pk', 'subject' => Schema::TYPE_STRING . '(128) NOT NULL', 'body' => Schema::TYPE_TEXT . ' NOT NULL', 'sent' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $tableOptions)->execute();
 }
Exemplo n.º 2
0
 public function down()
 {
     $this->dropTable(models\Admin::tableName());
     $this->dropTable(models\LoginForm::tableName());
     $this->dropTable(models\Module::tableName());
     $this->dropTable(models\Photo::tableName());
     $this->dropTable(models\Setting::tableName());
     $this->dropTable(Carousel::tableName());
     $this->dropTable(catalog\models\Category::tableName());
     $this->dropTable(catalog\models\Item::tableName());
     $this->dropTable(article\models\Category::tableName());
     $this->dropTable(article\models\Item::tableName());
     $this->dropTable(Feedback::tableName());
     $this->dropTable(File::tableName());
     $this->dropTable(gallery\models\Category::tableName());
     $this->dropTable(Guestbook::tableName());
     $this->dropTable(News::tableName());
     $this->dropTable(Page::tableName());
     $this->dropTable(Subscriber::tableName());
     $this->dropTable(History::tableName());
     $this->dropTable(Text::tableName());
 }