Пример #1
0
 public function upgrade($old_version)
 {
     switch ($old_version) {
         case '0.1':
             // There is no way to change the name of database field with w2p_Database_Query().
             db_exec("ALTER TABLE holiday CHANGE holiday_white holiday_type int(10) NOT NULL DEFAULT '0'");
             if (db_error()) {
                 return false;
             }
             $q = new w2p_Database_Query();
             $q->alterTable('holiday');
             $q->createDefinition('index holiday_start_end_date (holiday_start_date, holiday_end_date)');
             $q->exec();
             $q->clear();
             $q->alterTable('holiday');
             $q->createDefinition('index holiday_start_end_date (holiday_start_date, holiday_end_date)');
             $q->exec();
             $q->clear();
             $q->alterTable('holiday');
             $q->createDefinition('index holiday_user (holiday_user)');
             $q->exec();
             $q->clear();
             $q->alterTable('holiday');
             $q->createDefinition('index holiday_type (holiday_type)');
             $q->exec();
             $q->clear();
         default:
     }
     return true;
 }