blob: 03a744cb1358716a4aa6e1c64aa9d3611b96ce91 (
plain)
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
28
29
30
31
32
33
34
|
<?php
class StEP00111Admission extends Migration
{
public function description ()
{
return 'creates table admission groups';
}
public function up ()
{
$this->announce(" creating table `admission_group`...");
DBManager::get()->exec( "CREATE TABLE IF NOT EXISTS `admission_group` (
`group_id` varchar(32) NOT NULL,
`name` varchar(255) NOT NULL,
`status` tinyint(3) unsigned NOT NULL,
`chdate` int(10) unsigned NOT NULL,
`mkdate` int(10) unsigned NOT NULL,
PRIMARY KEY (`group_id`)
) ENGINE=MyISAM");
$this->announce(" fill table with existing groups...");
DBManager::get()->exec("INSERT IGNORE INTO admission_group
(group_id, status, chdate,mkdate)
SELECT DISTINCT admission_group,0, UNIX_TIMESTAMP(),UNIX_TIMESTAMP() FROM seminare WHERE admission_group <> ''");
$this->announce("done.");
}
public function down ()
{
$this->announce(" removing table `admission_group`...");
DBManager::get()->exec("DROP TABLE IF EXISTS `admission_group` ");
$this->announce("done.");
}
}
|