"Fossies" - the Fresh Open Source Software Archive

Member "4.6.1/db/migrations/09_step_00111_admission.php" (8 Apr 2021, 1322 Bytes) of package /linux/www/studip-4.6.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 <?php
    2 class StEP00111Admission extends Migration
    3 {
    4     public function description ()
    5     {
    6         return 'creates table admission groups';
    7     }
    8 
    9     public function up ()
   10     {
   11         $this->announce(" creating table `admission_group`...");
   12         
   13         DBManager::get()->exec( "CREATE TABLE IF NOT EXISTS `admission_group` (
   14                           `group_id` varchar(32) NOT NULL,
   15                           `name` varchar(255) NOT NULL,
   16                           `status` tinyint(3) unsigned NOT NULL,
   17                           `chdate` int(10) unsigned NOT NULL,
   18                           `mkdate` int(10) unsigned NOT NULL,
   19                           PRIMARY KEY  (`group_id`)
   20                         ) ENGINE=MyISAM");
   21         $this->announce(" fill table with existing groups...");
   22         DBManager::get()->exec("INSERT IGNORE INTO admission_group 
   23                         (group_id, status, chdate,mkdate)
   24                         SELECT DISTINCT admission_group,0, UNIX_TIMESTAMP(),UNIX_TIMESTAMP() FROM seminare WHERE admission_group <> ''");
   25         $this->announce("done.");
   26     }
   27     
   28     public function down ()
   29     {
   30         $this->announce(" removing table `admission_group`...");
   31         DBManager::get()->exec("DROP TABLE IF EXISTS `admission_group` ");
   32         $this->announce("done.");
   33     }
   34 }