Oops commit the db files too

This commit is contained in:
james 2009-10-02 17:24:53 +00:00
parent 01fde584be
commit 9bb5465ac2
2 changed files with 49 additions and 0 deletions

19
db/db.update.142.php Normal file
View File

@ -0,0 +1,19 @@
<?
function db_update_142_post() {
$q=mysql_query("SELECT * FROM config WHERE var='FISCALYEAR'");
if(mysql_num_rows($q)) {
//great its there, do nothing, it must have been inserted by the installer when doing a fresh install
}
else {
//its not there.. this must be an update to an existing system, so lets insert it
//try to guess a fiscal that makes sense
$month=date("m");
if($month>6) $fiscalyearsuggest=date("Y")+1;
else $fiscalyearsuggest=date("Y");
mysql_query("INSERT INTO `config` ( `var` , `val` , `category` , `type` , `type_values` , `ord` , `description` , `year`) VALUES ( 'FISCALYEAR', '$fiscalyearsuggest', 'Special', '', '', '0', 'The current fiscal year that the fundraising module is using', '0')");
}
}
?>

30
db/db.update.142.sql Normal file
View File

@ -0,0 +1,30 @@
CREATE TABLE `fundraising_campaigns` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`name` VARCHAR( 128 ) NOT NULL ,
`type` VARCHAR( 64 ) NOT NULL ,
`startdate` DATE NOT NULL,
`enddate` DATE NOT NULL,
`active` ENUM( 'no', 'yes' ) NOT NULL ,
`target` INT NOT NULL,
`fundraising_goals_id` INT UNSIGNED NOT NULL,
`fiscalyear` INT NOT NULL
) ENGINE = MYISAM ;
CREATE TABLE `fundraising_campaigns_segments` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`fundraising_campaigns_id` INT UNSIGNED NOT NULL ,
`segment` VARCHAR( 128 ) NOT NULL
) ENGINE = MYISAM ;
RENAME TABLE `sponsorships_levels` TO `fundraising_donor_levels`;
ALTER TABLE `fundraising_donor_levels` CHANGE `year` `fiscalyear` INT( 11 ) NOT NULL DEFAULT '0';
RENAME TABLE `fundraising` TO `fundraising_goals`;
ALTER TABLE `fundraising_goals` CHANGE `year` `fiscalyear` INT( 11 ) NOT NULL DEFAULT '0';
RENAME TABLE `sponsors_logs` TO `fundraising_donor_logs`;
RENAME TABLE `sponsorships` TO `fundraising_donations`;
ALTER TABLE `fundraising_donations` CHANGE `year` `fiscalyear` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `fundraising_goals` CHANGE `goal` `budget` INT( 10 ) UNSIGNED NOT NULL DEFAULT '0';
ALTER TABLE `fundraising_goals` CHANGE `type` `goal` VARCHAR( 32 ) NOT NULL;
ALTER TABLE `fundraising_donations` CHANGE `fundraising_type` `fundraising_goal` VARCHAR( 32 ) NOT NULL;
ALTER TABLE `fundraising_goals` ADD `deadline` DATE NOT NULL;
ALTER TABLE `fundraising_donations` ADD `fundraising_campaigns_id` INT NOT NULL AFTER `fundraising_goal`;