forked from science-ation/science-ation
Create science fair conferences for all past years that the system knows about
Also add a temporary year field to the conferences table, to make migration easier (easier to find a conference id for a given science fair year)
This commit is contained in:
parent
054c62dfa8
commit
6c4a54fe94
@ -1 +1 @@
|
||||
187
|
||||
188
|
||||
|
24
db/db.update.188.php
Normal file
24
db/db.update.188.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?
|
||||
function db_update_188_pre()
|
||||
{
|
||||
}
|
||||
|
||||
function db_update_188_post()
|
||||
{
|
||||
global $config;
|
||||
$q=mysql_query("SELECT * FROM config WHERE var='fairname' AND year>0 ORDER BY year");
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo " Creating conference: $r->val $r->year\n";
|
||||
mysql_query("INSERT INTO conferences (`name`,`type`,`status`,`year`) VALUES ('".mysql_real_escape_string($r->val." ".$r->year)."',
|
||||
'sciencefair',
|
||||
'ended',
|
||||
'$r->year')");
|
||||
}
|
||||
//but wait, the current fairyear is still running
|
||||
echo " Setting science fair conference for {$config['FAIRYEAR']} to running\n";
|
||||
mysql_query("UPDATE conferences SET status='running' WHERE year='{$config['FAIRYEAR']}'");
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
2
db/db.update.188.sql
Normal file
2
db/db.update.188.sql
Normal file
@ -0,0 +1,2 @@
|
||||
ALTER TABLE `conferences` ADD `year` INT NULL DEFAULT NULL COMMENT 'used for migration only, this field will be dropped!';
|
||||
|
Loading…
Reference in New Issue
Block a user