From 6c4a54fe9453fffc284ad6eeff95f2d9e4db69a6 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 17 Jun 2010 20:03:45 +0000 Subject: [PATCH] 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) --- db/db.code.version.txt | 2 +- db/db.update.188.php | 24 ++++++++++++++++++++++++ db/db.update.188.sql | 2 ++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 db/db.update.188.php create mode 100644 db/db.update.188.sql diff --git a/db/db.code.version.txt b/db/db.code.version.txt index 9870ccc..e702a30 100644 --- a/db/db.code.version.txt +++ b/db/db.code.version.txt @@ -1 +1 @@ -187 +188 diff --git a/db/db.update.188.php b/db/db.update.188.php new file mode 100644 index 0000000..f215380 --- /dev/null +++ b/db/db.update.188.php @@ -0,0 +1,24 @@ +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']}'"); + + +} + +?> diff --git a/db/db.update.188.sql b/db/db.update.188.sql new file mode 100644 index 0000000..98e6082 --- /dev/null +++ b/db/db.update.188.sql @@ -0,0 +1,2 @@ +ALTER TABLE `conferences` ADD `year` INT NULL DEFAULT NULL COMMENT 'used for migration only, this field will be dropped!'; +