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(Feedback::tableName(), ['feedback_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'phone' => Schema::TYPE_STRING . '(64) DEFAULT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'answer_subject' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'answer_text' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $tableOptions)->execute(); }
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()); }