/**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 0');
     $db->query(NULL, 'DROP TABLE roles_users');
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 1');
     $db->query(NULL, 'DROP TABLE roles');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE IF EXISTS `oauth2_access_tokens`;');
     $db->query(NULL, 'DROP TABLE IF EXISTS `oauth2_auth_codes`;');
     $db->query(NULL, 'DROP TABLE IF EXISTS `oauth2_clients`;');
     $db->query(NULL, 'DROP TABLE IF EXISTS `oauth2_refresh_tokens`;');
 }
 /**
  * Run queries needed to apply this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function up(Kohana_Database $db)
 {
     $db->query(NULL, 'ALTER TABLE `forum_topics` DROP `total`;');
     $db->query(NULL, 'ALTER TABLE `forum_topics` DROP `status`;');
     $db->query(NULL, 'ALTER TABLE `forum_topics` ADD `replies` INT(10)  UNSIGNED  NOT NULL  AFTER `locked`;');
     $db->query(NULL, 'ALTER TABLE `forum_topics` ADD `views` INT(10)  UNSIGNED  NOT NULL  AFTER `replies`;');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE roles;');
     $db->query(NULL, 'DROP TABLE roles_users;');
     $db->query(NULL, 'DROP TABLE users;');
     $db->query(NULL, 'DROP TABLE user_tokens;');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 0');
     $db->query(NULL, 'DROP TABLE IF EXISTS `users_avatars`;');
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 1');
     $db->query(NULL, 'DROP TABLE `avatars`;');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE `quill_locations`');
     $db->query(NULL, 'DROP TABLE `quill_categories`');
     $db->query(NULL, 'DROP TABLE `quill_topics`');
     $db->query(NULL, 'DROP TABLE `quill_replies`');
 }
 /**
  * Run queries needed to apply this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function up(Kohana_Database $db)
 {
     $db->query(NULL, "ALTER TABLE `users` DROP `avatar_id`");
     $db->query(NULL, "ALTER TABLE `users` DROP `points`");
     $db->query(NULL, "ALTER TABLE `users` DROP `post_count`");
     $db->query(NULL, "ALTER TABLE `users` DROP `avatar`");
     $db->query(NULL, "ALTER TABLE `users` DROP `signature`");
     $db->query(NULL, "ALTER TABLE `users` DROP `about`");
     $db->query(NULL, "ALTER TABLE `users` DROP `gravatar`");
     $db->query(NULL, "ALTER TABLE `users` MODIFY COLUMN `title_id` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `last_login`");
 }
Esempio n. 8
0
 /**
  * Creates a new select query which includes all fields in the migrations
  * table plus a `id` field which is a combination of the timestamp and the
  * description
  *
  * @return Database_Query_Builder_Select
  */
 protected function _select()
 {
     $group = $this->_db->quote_column('group');
     $timestamp = $this->_db->quote_column('timestamp');
     $id = $this->_db->quote_column('id');
     $colon = $this->_db->quote(':');
     return DB::select('*')->from($this->_table);
 }
 /**
  * Checks to see if the minion migrations table exists and attempts to
  * create it if it doesn't
  *
  * @return boolean
  */
 public function ensure_table_exists()
 {
     $query = $this->_db->query(Database::SELECT, "SHOW TABLES like '" . $this->_table . "'");
     if (!count($query)) {
         $sql = file_get_contents(Kohana::find_file('', 'minion_schema', 'sql'));
         $this->_db->query(NULL, $sql);
     }
 }
Esempio n. 10
0
 /**
  * Checks to see if the minion migrations table exists and attempts to
  * create it if it doesn't
  *
  * @return boolean
  */
 public function ensure_table_exists()
 {
     $table = $this->_db->table_prefix() . $this->_table;
     $query = $this->_db->query(\Gleez\Database\Database::SELECT, "SHOW TABLES like '" . $table . "'");
     if (!count($query)) {
         $sql = View::factory('minion/db/schema')->set('table_name', $table)->render();
         $this->_db->query(NULL, $sql);
     }
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE forum_categories');
     $db->query(NULL, 'DROP TABLE forum_polls');
     $db->query(NULL, 'DROP TABLE forum_poll_options');
     $db->query(NULL, 'DROP TABLE forum_poll_votes');
     $db->query(NULL, 'DROP TABLE forum_topics');
     $db->query(NULL, 'DROP TABLE forum_posts');
 }
Esempio n. 12
0
 /**
  * @param null $name
  *
  * @return Database
  * @throws ErrorException
  */
 protected static function _instance($name = NULL)
 {
     if (!class_exists('Kohana_Database')) {
         throw new ErrorException('Kohana_Database module not loaded');
     }
     $name = static::instanceName($name);
     if (!array_key_exists($name, static::$transactions)) {
         static::$transactions[$name] = FALSE;
     }
     return Kohana_Database::instance($name);
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 0');
     $db->query(NULL, 'DROP TABLE `user_notifications` ');
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 1');
     $db->query(NULL, 'DROP TABLE `user_notification_icons` ');
     $db->query(NULL, 'DROP TABLE `logs` ');
 }
 /**
  * Run queries needed to apply this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function up(Kohana_Database $db)
 {
     $db->query(NULL, "ALTER TABLE `forum_poll_options` CHANGE `votes` `votes` INT(11)  UNSIGNED  NOT NULL");
     $db->query(NULL, "ALTER TABLE `forum_polls` CHANGE `votes` `votes` INT(11)  UNSIGNED  NOT NULL;");
     $db->query(NULL, "ALTER TABLE `forum_posts` CHANGE `updated` `updated` INT(10)  UNSIGNED  NOT NULL;");
     $db->query(NULL, "ALTER TABLE `forum_posts` CHANGE `created` `created` INT(10)  UNSIGNED  NOT NULL;");
     $db->query(NULL, "ALTER TABLE `forum_topics` CHANGE `created` `created` INT(10)  UNSIGNED  NOT NULL;");
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'ALTER TABLE  `oauth2_clients` CHANGE  `client_id`  `client_id` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL');
     $db->query(NULL, 'ALTER TABLE  `oauth2_clients` CHANGE  `client_secret`  `client_secret` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL');
     $db->query(NULL, 'ALTER TABLE  `oauth2_access_tokens` CHANGE  `client_id`  `client_id` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL');
     $db->query(NULL, 'ALTER TABLE  `oauth2_auth_codes` CHANGE  `client_id`  `client_id` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL');
     $db->query(NULL, 'ALTER TABLE  `oauth2_refresh_tokens` CHANGE  `client_id`  `client_id` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL');
 }
Esempio n. 16
0
Kohana::init(array('base_url' => '/', 'index_file' => ''));
/**
 * Attach the file write to logging. Multiple writers are supported.
 */
Kohana::$log->attach(new Log_File(APPPATH . 'logs'));
/**
 * Attach a file reader to config. Multiple readers are supported.
 */
Kohana::$config->attach(new Config_File());
// Sessions & Cookies
Session::$default = 'native';
/**
 * Enable modules. Modules are referenced by a relative or absolute path.
 */
Kohana::modules(array('auth' => MODPATH . 'auth', 'cache' => MODPATH . 'cache', 'database' => MODPATH . 'database', 'orm' => MODPATH . 'orm', 'email' => MODPATH . 'email'));
Kohana::$config->attach(new Config_Database(array('instance' => Kohana_Database::instance(), 'table_name' => 'config')));
/**
 * Set the routes. Each route must have a minimum of a name, a URI and a set of
 * defaults for the URI.
 */
// Админ роут по-умолчанию
Route::set('admin', 'admin(/<controller>(/<action>(/<id>)))', array('id' => '.+'))->defaults(array('directory' => 'admin', 'controller' => 'main', 'action' => 'index'));
// Если сайт оффлайн
Route::set('offline', 'offline')->defaults(array('directory' => 'site', 'controller' => 'main', 'action' => 'offline'));
// Обработчик ошибок
Route::set('error', 'error/<action>(/<message>)', array('action' => '[0-9]++', 'message' => '.+'))->defaults(array('controller' => 'error'));
// Роут каталога
Route::set('catalias', 'c/<catalias>', array('catalias' => '.+'))->defaults(array('directory' => 'site', 'controller' => 'catalog', 'action' => 'index'));
// Роут страницы БЕЗ каталога
Route::set('pagealias', '(<catalias>/)<pagealias>', array('catalias' => '.+', 'pagealias' => '.+'))->defaults(array('directory' => 'site', 'controller' => 'page', 'action' => 'index'));
// Роут по-умолчанию
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query('NULL', 'DROP TABLE users');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE roles_users, roles, user_tokens,
         tags_tasks, tags, tasks, users');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, "UPDATE `mg`.`items` SET `name` = 'Blocks' WHERE `items`.`id` =21");
     $db->query(NULL, "UPDATE `mg`.`items` SET `name` = 'Cards' WHERE `items`.`id` =23");
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, "ALTER TABLE shop_restocks CHANGE id id INT( 11 ) NOT NULL");
     $db->query(NULL, "ALTER TABLE shop_restocks DROP PRIMARY KEY");
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 0');
     $db->query(NULL, "DROP TABLE IF EXISTS `items`, `item_types`, `user_items`, `item_recipes`, `item_recipe_materials`");
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 1');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'ALTER TABLE `messages` DROP COLUMN `read`, DROP COLUMN `sent`');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'ALTER TABLE `payment_packages` DROP `rewards`');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 0');
     $db->query(NULL, 'DROP TABLE `user_trades`, `user_trade_bids`;');
     $db->query(NULL, ' SET FOREIGN_KEY_CHECKS = 1');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'ALTER TABLE `users` DROP COLUMN cached_properties');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE user_properties');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE `shops` ');
     $db->query(NULL, 'DROP TABLE `shop_inventories` ');
     $db->query(NULL, 'DROP TABLE `shop_restocks` ');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, "DELETE FROM `shop_inventories` WHERE id IN(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27)");
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE user_timezones');
 }
 /**
  * Run queries needed to remove this migration
  *
  * @param Kohana_Database $db Database connection
  */
 public function down(Kohana_Database $db)
 {
     $db->query(NULL, 'DROP TABLE messages');
 }