예제 #1
0
 public function up()
 {
     //ADMINS
     $this->createTable(models\Admin::tableName(), ['admin_id' => 'pk', 'username' => Schema::TYPE_STRING . '(32) NOT NULL', 'password' => Schema::TYPE_STRING . '(64) NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(128) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('access_token', models\Admin::tableName(), 'access_token', true);
     //LOGINFORM
     $this->createTable(models\LoginForm::tableName(), ['log_id' => 'pk', 'username' => Schema::TYPE_STRING . '(128) NOT NULL', 'password' => Schema::TYPE_STRING . '(128) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'user_agent' => Schema::TYPE_STRING . '(1024) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'success' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //MODULES
     $this->createTable(models\Module::tableName(), ['module_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'icon' => Schema::TYPE_STRING . '(32) NOT NULL', 'settings' => Schema::TYPE_TEXT . ' NOT NULL', 'notice' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('name', models\Module::tableName(), 'name', true);
     //PHOTOS
     $this->createTable(models\Photo::tableName(), ['photo_id' => 'pk', 'model' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'thumb' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_STRING . '(1024) NOT NULL', 'order_num' => Schema::TYPE_INTEGER . " NOT NULL"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('model_item', models\Photo::tableName(), ['model', 'item_id']);
     //SEOTEXT
     $this->createTable(models\SeoText::tableName(), ['seotext_id' => 'pk', 'model' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'h1' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'keywords' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'description' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('model_item', models\SeoText::tableName(), ['model', 'item_id'], true);
     //SETTINGS
     $this->createTable(models\Setting::tableName(), ['setting_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'value' => Schema::TYPE_STRING . '(1024) NOT NULL', 'visibility' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('name', models\Setting::tableName(), 'name', true);
     //CAROUSEL MODULE
     $this->createTable(Carousel::tableName(), ['carousel_id' => 'pk', 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //CATALOG MODULE
     $this->createTable(catalog\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'fields' => Schema::TYPE_TEXT . ' NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', catalog\models\Category::tableName(), 'slug', true);
     $this->createTable(catalog\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER . ' NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'data' => Schema::TYPE_TEXT . ' NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'created_at' => Schema::TYPE_DATETIME . " DEFAULT NULL", 'updated_at' => Schema::TYPE_DATETIME . " DEFAULT NULL", 'created_by' => Schema::TYPE_INTEGER . " DEFAULT NULL", 'updated_by' => Schema::TYPE_INTEGER . " DEFAULT NULL"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', catalog\models\Item::tableName(), 'slug', true);
     //FEEDBACK MODULE
     $this->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' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //FILE MODULE
     $this->createTable(File::tableName(), ['file_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'file' => Schema::TYPE_STRING . '(255) NOT NULL', 'size' => Schema::TYPE_INTEGER . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'downloads' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', File::tableName(), 'slug', true);
     //GALLERY MODULE
     $this->createTable(Album::tableName(), ['album_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', Album::tableName(), 'slug', true);
     //GUESTBOOK MODULE
     $this->createTable(Guestbook::tableName(), ['guestbook_id' => 'pk', 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //NEWS MODULE
     $this->createTable(News::tableName(), ['news_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'created_by' => Schema::TYPE_INTEGER . " DEFAULT NULL", 'updated_by' => Schema::TYPE_INTEGER . " DEFAULT NULL"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', News::tableName(), 'slug', true);
     //ARTICLE MODULE
     $this->createTable(article\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', article\models\Category::tableName(), 'slug', true);
     $this->createTable(article\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER . ' NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'thumb' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'created_by' => Schema::TYPE_INTEGER . " DEFAULT NULL", 'updated_by' => Schema::TYPE_INTEGER . " DEFAULT NULL"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', article\models\Item::tableName(), 'slug', true);
     //PAGE MODULE
     $this->createTable(Page::tableName(), ['page_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', Page::tableName(), 'slug', true);
     //FAQ MODULE
     $this->createTable(Faq::tableName(), ['faq_id' => 'pk', 'question' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' NOT NULL', 'order_num' => Schema::TYPE_INTEGER . ' NOT NULL', 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //SUBSCRIBE MODULE
     $this->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'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('email', Subscriber::tableName(), 'email', true);
     $this->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'"], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     //TEXT MODULE
     $this->createTable(Text::tableName(), ['text_id' => 'pk', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], 'ENGINE=MyISAM DEFAULT CHARSET=utf8');
     $this->createIndex('slug', Text::tableName(), 'slug', true);
     //INSERT VERSION
     $this->delete(models\Setting::tableName(), ['name' => 'easyii_version']);
     $this->insert(models\Setting::tableName(), ['name' => 'easyii_version', 'value' => self::VERSION, 'title' => 'EasyiiCMS version', 'visibility' => models\Setting::VISIBLE_NONE]);
 }
예제 #2
0
 public function actionDelete($id)
 {
     if ($model = Faq::findOne($id)) {
         $model->delete();
     } else {
         $this->error = Yii::t('easyii', 'Not found');
     }
     return $this->formatResponse(Yii::t('easyii/faq', 'Entry deleted'));
 }
예제 #3
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(Faq::tableName(), ['faq_id' => 'pk', 'question' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' NOT NULL', 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $tableOptions)->execute();
 }
예제 #4
0
 public function api_items()
 {
     return Data::cache(FaqModel::CACHE_KEY, 3600, function () {
         $items = [];
         foreach (FaqModel::find()->select(['faq_id', 'question', 'answer'])->status(FaqModel::STATUS_ON)->sort()->all() as $item) {
             $items[] = new FaqObject($item);
         }
         return $items;
     });
 }
예제 #5
0
파일: Faq.php 프로젝트: radiegtya/easyii
 public function api_all()
 {
     $data = Data::cache(FaqModel::CACHE_KEY, 3600, function () {
         return FaqModel::find()->select(['faq_id', 'question', 'answer'])->status(FaqModel::STATUS_ON)->sort()->asArray()->all();
     });
     $result = [];
     foreach ($data as $entry) {
         $result[] = $this->parseEntry($entry);
     }
     return $result;
 }
 public function insertFaq()
 {
     if (Faq::find()->count()) {
         return '`<b>' . Faq::tableName() . '</b>` table is not empty, skipping...';
     }
     $this->db->createCommand('TRUNCATE TABLE `' . Faq::tableName() . '`')->query();
     (new Faq(['question' => 'Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it?', 'answer' => 'But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure']))->save();
     (new Faq(['question' => 'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum?', 'answer' => 'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta <a href="http://easyiicms.com/">sunt explicabo</a>.']))->save();
     (new Faq(['question' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 'answer' => 't enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.']))->save();
     return 'Faq data inserted.';
 }
예제 #7
0
 public function up()
 {
     //ADMINS
     $this->createTable(models\Admin::tableName(), ['admin_id' => 'pk', 'username' => Schema::TYPE_STRING . '(32) NOT NULL', 'password' => Schema::TYPE_STRING . '(64) NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(128) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine);
     //$this->createIndex('access_token', models\Admin::tableName(), 'access_token', true);
     //LOGINFORM
     $this->createTable(models\LoginForm::tableName(), ['log_id' => 'pk', 'username' => Schema::TYPE_STRING . '(128) NOT NULL', 'password' => Schema::TYPE_STRING . '(128) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'user_agent' => Schema::TYPE_STRING . '(1024) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'success' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine);
     //MODULES
     $this->createTable(models\Module::tableName(), ['module_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'icon' => Schema::TYPE_STRING . '(32) NOT NULL', 'settings' => Schema::TYPE_TEXT . ' NOT NULL', 'notice' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine);
     //$this->createIndex('name', models\Module::tableName(), 'name', true);
     //PHOTOS
     $this->createTable(models\Photo::tableName(), ['photo_id' => 'pk', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_STRING . '(1024) NOT NULL', 'order_num' => Schema::TYPE_INTEGER . " NOT NULL"], $this->engine);
     //$this->createIndex('model_item', models\Photo::tableName(), ['class', 'item_id']);
     //SEOTEXT
     $this->createTable(models\SeoText::tableName(), ['seotext_id' => 'pk', 'class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'h1' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'keywords' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'description' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine);
     //$this->createIndex('model_item', models\SeoText::tableName(), ['class', 'item_id'], true);
     //SETTINGS
     $this->createTable(models\Setting::tableName(), ['setting_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'value' => Schema::TYPE_STRING . '(1024) NOT NULL', 'visibility' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine);
     //$this->createIndex('name', models\Setting::tableName(), 'name', true);
     //CAROUSEL MODULE
     $this->createTable(Carousel::tableName(), ['carousel_id' => 'pk', 'image' => Schema::TYPE_STRING . '(128) NOT NULL', 'link' => Schema::TYPE_STRING . '(255) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //CATALOG MODULE
     $this->createTable(catalog\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'fields' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', catalog\models\Category::tableName(), 'slug', true);
     $this->createTable(catalog\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER, 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'description' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'available' => Schema::TYPE_INTEGER . " DEFAULT '1'", 'price' => Schema::TYPE_FLOAT . " DEFAULT '0'", 'discount' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'data' => Schema::TYPE_TEXT . ' NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', catalog\models\Item::tableName(), 'slug', true);
     $this->createTable(catalog\models\ItemData::tableName(), ['data_id' => 'pk', 'item_id' => Schema::TYPE_INTEGER, 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'value' => Schema::TYPE_STRING . '(1024) DEFAULT NULL'], $this->engine);
     //$this->createIndex('item_id_name', catalog\models\ItemData::tableName(), ['item_id', 'name']);
     //$this->createIndex('value', catalog\models\ItemData::tableName(), 'value(300)');
     //SHOPCART MODULE
     $this->createTable(shopcart\models\Order::tableName(), ['order_id' => 'pk', 'name' => Schema::TYPE_STRING . '(64) NOT NULL', 'address' => Schema::TYPE_STRING . '(255) NOT NULL', 'phone' => Schema::TYPE_STRING . '(64) NOT NULL', 'email' => Schema::TYPE_STRING . '(128) NOT NULL', 'comment' => Schema::TYPE_STRING . '(1024) NOT NULL', 'remark' => Schema::TYPE_STRING . '(1024) NOT NULL', 'access_token' => Schema::TYPE_STRING . '(32) NOT NULL', 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine);
     $this->createTable(shopcart\models\Good::tableName(), ['good_id' => 'pk', 'order_id' => Schema::TYPE_INTEGER, 'item_id' => Schema::TYPE_INTEGER, 'count' => Schema::TYPE_INTEGER, 'options' => Schema::TYPE_STRING . '(255) NOT NULL', 'price' => Schema::TYPE_FLOAT . " DEFAULT '0'", 'discount' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine);
     //FEEDBACK MODULE
     $this->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'"], $this->engine);
     //FILE MODULE
     $this->createTable(File::tableName(), ['file_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'file' => Schema::TYPE_STRING . '(255) NOT NULL', 'size' => Schema::TYPE_INTEGER . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'downloads' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'order_num' => Schema::TYPE_INTEGER], $this->engine);
     //$this->createIndex('slug', File::tableName(), 'slug', true);
     //GALLERY MODULE
     $this->createTable(gallery\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', gallery\models\Category::tableName(), 'slug', true);
     //GUESTBOOK MODULE
     $this->createTable(Guestbook::tableName(), ['guestbook_id' => 'pk', 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'title' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' DEFAULT NULL', 'email' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'ip' => Schema::TYPE_STRING . '(16) NOT NULL', 'new' => Schema::TYPE_BOOLEAN . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '0'"], $this->engine);
     //NEWS MODULE
     $this->createTable(News::tableName(), ['news_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', News::tableName(), 'slug', true);
     //ARTICLE MODULE
     $this->createTable(article\models\Category::tableName(), ['category_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'order_num' => Schema::TYPE_INTEGER, 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'tree' => Schema::TYPE_INTEGER, 'lft' => Schema::TYPE_INTEGER, 'rgt' => Schema::TYPE_INTEGER, 'depth' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', article\models\Category::tableName(), 'slug', true);
     $this->createTable(article\models\Item::tableName(), ['item_id' => 'pk', 'category_id' => Schema::TYPE_INTEGER, 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'image' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'short' => Schema::TYPE_STRING . '(1024) DEFAULT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL', 'time' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'views' => Schema::TYPE_INTEGER . " DEFAULT '0'", 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //$this->createIndex('slug', article\models\Item::tableName(), 'slug', true);
     //PAGE MODULE
     $this->createTable(Page::tableName(), ['page_id' => 'pk', 'title' => Schema::TYPE_STRING . '(128) NOT NULL', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine);
     //$this->createIndex('slug', Page::tableName(), 'slug', true);
     //FAQ MODULE
     $this->createTable(Faq::tableName(), ['faq_id' => 'pk', 'question' => Schema::TYPE_TEXT . ' NOT NULL', 'answer' => Schema::TYPE_TEXT . ' NOT NULL', 'order_num' => Schema::TYPE_INTEGER, 'status' => Schema::TYPE_BOOLEAN . " DEFAULT '1'"], $this->engine);
     //SUBSCRIBE MODULE
     $this->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'"], $this->engine);
     //$this->createIndex('email', Subscriber::tableName(), 'email', true);
     $this->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'"], $this->engine);
     //TEXT MODULE
     $this->createTable(Text::tableName(), ['text_id' => 'pk', 'text' => Schema::TYPE_TEXT . ' NOT NULL', 'slug' => Schema::TYPE_STRING . '(128) DEFAULT NULL'], $this->engine);
     //$this->createIndex('slug', Text::tableName(), 'slug', true);
     //Tags
     $this->createTable(models\Tag::tableName(), ['tag_id' => 'pk', 'name' => Schema::TYPE_STRING . '(128) NOT NULL', 'frequency' => Schema::TYPE_INTEGER . " DEFAULT '0'"], $this->engine);
     //$this->createIndex('name', models\Tag::tableName(), 'name', true);
     $this->createTable(models\TagAssign::tableName(), ['class' => Schema::TYPE_STRING . '(128) NOT NULL', 'item_id' => Schema::TYPE_INTEGER . " NOT NULL", 'tag_id' => Schema::TYPE_INTEGER . " NOT NULL"], $this->engine);
     //$this->createIndex('class', models\TagAssign::tableName(), 'class');
     //$this->createIndex('item_tag', models\TagAssign::tableName(), ['item_id', 'tag_id']);
     //INSERT VERSION
     $this->delete(models\Setting::tableName(), ['name' => 'easyii_version']);
     $this->insert(models\Setting::tableName(), ['name' => 'easyii_version', 'value' => self::VERSION, 'title' => 'EasyiiCMS version', 'visibility' => models\Setting::VISIBLE_NONE]);
 }