[CS-Project-svn_notify] SF.net SVN: cs-project: [878] trunk/1.2
Brought to you by:
crazedsanity
From: <cra...@us...> - 2008-04-09 05:08:22
|
Revision: 878 http://cs-project.svn.sourceforge.net/cs-project/?rev=878&view=rev Author: crazedsanity Date: 2008-04-08 22:08:16 -0700 (Tue, 08 Apr 2008) Log Message: ----------- Upgrade scripts + fixes to upgrade system to allow for protected setup & such... Modified Paths: -------------- trunk/1.2/lib/config.class.php trunk/1.2/lib/site_config.php trunk/1.2/lib/upgradeClass.php trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php Added Paths: ----------- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql Copied: trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql (from rev 877, trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA2.sql) =================================================================== --- trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql (rev 0) +++ trunk/1.2/docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql 2008-04-09 05:08:16 UTC (rev 878) @@ -0,0 +1,67 @@ +-- +-- SVN INFORMATION::: +-- +-- SVN Signature::::::::: $Id$ +-- Last Committted Date:: $Date$ +-- Last Committed Path::: $HeadURL$ +-- + + + + + + +CREATE TABLE task_table ( + task_id serial NOT NULL PRIMARY KEY, + creator_contact_id integer NOT NULL REFERENCES contact_table(contact_id), + name text NOT NULL, + body text NOT NULL, + assigned_contact_id integer REFERENCES contact_table(contact_id), + created timestamp with time zone DEFAULT ('now'::text)::date NOT NULL, + updated timestamp with time zone, + deadline date, + started date, + status_id integer DEFAULT 0 NOT NULL REFERENCES status_table(status_id), + priority smallint DEFAULT 50 NOT NULL, + progress numeric DEFAULT 0 NOT NULL, + record_id integer NOT NULL REFERENCES record_table(record_id), + estimate_original numeric(10,2) DEFAULT 1 NOT NULL, + estimate_current numeric(10,2) DEFAULT 1 NOT NULL, + estimate_elapsed numeric(10,2) DEFAULT 0 NOT NULL +); + +-- Populate the table with existing todo data. + + +INSERT INTO task_table (task_id, creator_contact_id, name, body, assigned_contact_id, created, updated, deadline, started, status_id, priority, progress, record_id, estimate_original, estimate_current, estimate_elapsed) (SELECT todo_id, creator_contact_id, name, body, assigned_contact_id, created, updated, deadline, started, status_id, priority, progress, record_id, estimate_original, estimate_current, estimate_elapsed FROM todo_table); + + + + +CREATE TABLE task_comment_table ( + task_comment_id serial NOT NULL PRIMARY KEY, + task_id integer NOT NULL, + creator_contact_id integer NOT NULL REFERENCES contact_table(contact_id), + created timestamp with time zone DEFAULT now() NOT NULL, + updated timestamp with time zone, + subject text DEFAULT 'Comment'::text NOT NULL, + body text NOT NULL +); + +--Copy data into the table. +INSERT INTO task_comment_table (task_comment_id, task_id, creator_contact_id, created, updated, subject, body) (SELECT todo_comment_id, todo_id, creator_contact_id, created, updated, subject, body FROM todo_comment_table); + + + + +-- Fix foreign keys and such. +ALTER TABLE log_estimate_table RENAME todo_id TO task_id; +ALTER TABLE log_estimate_table DROP CONSTRAINT "log_estiate_table_todo_id_fkey"; +ALTER TABLE ONLY log_estimate_table ADD CONSTRAINT log_estimate_table_task_id_fkey FOREIGN KEY (task_id) REFERENCES task_table(task_id); + + + +-- GET RID OF THE OLD TABLES... +DROP TABLE todo_comment_table; +DROP TABLE todo_table; + Modified: trunk/1.2/lib/config.class.php =================================================================== --- trunk/1.2/lib/config.class.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/config.class.php 2008-04-09 05:08:16 UTC (rev 878) @@ -22,6 +22,9 @@ if(!is_null($fileName) && strlen($fileName)) { $this->fileName = $fileName; } + else { + $this->fileName = CONFIG_FILE_LOCATION; + } if(!file_exists($this->fileName)) { $this->fileExists = FALSE; Modified: trunk/1.2/lib/site_config.php =================================================================== --- trunk/1.2/lib/site_config.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/site_config.php 2008-04-09 05:08:16 UTC (rev 878) @@ -86,6 +86,17 @@ $configObj->do_setup_redirect(); } else { + //don't panic: we're going to check for upgrades, but this doesn't + // necessarily mean anything will ACTUALLY be upgraded. + $configObj->get_config_contents(NULL,TRUE,FALSE); + $upgrade = new upgrade; + if($upgrade->upgrade_in_progress()) { + throw new exception("Upgrade in progress... reload the page after a few minutes and it should be complete. :) "); + } + else { + $upgrade->check_versions(); + } + #read_config_file(TRUE); $configObj->get_config_contents(NULL,TRUE,TRUE); } } Modified: trunk/1.2/lib/upgradeClass.php =================================================================== --- trunk/1.2/lib/upgradeClass.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/lib/upgradeClass.php 2008-04-09 05:08:16 UTC (rev 878) @@ -791,7 +791,7 @@ } } - $this->gfObj->debug_print(__METHOD__ .": ('". $version ."', '". $checkIfHigher ."') retval=(". $retval .")"); + $this->gfObj->debug_print(__METHOD__ .": ('". $version ."', '". $checkIfHigher ."') retval=(". $retval .")", 1); return($retval); Modified: trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php =================================================================== --- trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-04-09 03:57:22 UTC (rev 877) +++ trunk/1.2/upgrade/upgradeTo1.2.0-ALPHA4.php 2008-04-09 05:08:16 UTC (rev 878) @@ -48,6 +48,16 @@ $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". base64_encode($this->fsObj->read($this->lastSQLFile)); $this->logsObj->log_by_class($details, 'system'); + + + + $this->gfObj->debug_print(__METHOD__ .": running SQL file..."); + $this->run_sql_file(dirname(__FILE__) .'/../docs/sql/upgrades/upgradeTo1.2.0-ALPHA4.sql'); + + $details = "Executed SQL file, '". $this->lastSQLFile ."'. Encoded contents::: ". + base64_encode($this->fsObj->read($this->lastSQLFile)); + $this->logsObj->log_by_class($details, 'system'); + }//end run_schema_changes() //========================================================================= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |