[Fusionforge-commits] r7751 - in trunk: . gforge/db

Roland Mas lolando at libremir.placard.fr.eu.org
Sun Jun 7 15:57:58 CEST 2009


Author: lolando
Date: 2009-06-07 15:57:58 +0200 (Sun, 07 Jun 2009)
New Revision: 7751

Modified:
   trunk/
   trunk/gforge/db/20050224-drop.sql
   trunk/gforge/db/20050224.sql
   trunk/gforge/db/20050822.sql
   trunk/gforge/db/20051003.sql
   trunk/gforge/db/20060216.sql
   trunk/gforge/db/upgrade-db.php
Log:
Merged from 4.8: fixed the upgrade path from GForge 4.0.2 to FusionForge 4.8


Property changes on: trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300,7355,7365-7366,7375-7376,7378,7395,7423-7426,7435,7458,7504,7567,7577,7623-7624,7638,7659-7660,7662,7665,7668,7674
/branches/Branch_4_8:7334-7335,7344-7345,7382,7387,7389-7390,7396,7398,7401-7402,7428-7429,7437,7440,7443,7449-7455,7459,7462,7466,7469-7470,7476-7477,7478,7480,7485,7490-7491,7492,7505,7540,7556-7558,7559-7560,7568,7570-7571,7573,7576,7580,7609-7610,7611,7613,7615,7618,7621-7622,7625-7627,7639,7658,7661,7663-7664,7666-7667,7673,7675,7678,7680,7685,7688-7689,7693,7700,7706-7708,7713,7725,7728-7729

   + /branches/Branch_4_7:6879,6881,6884,6897,6899,6902,6904,6906,6909,6911,6922,6932,6936,6939,6942,6944,6946-6948,6954,6956,6959,7000-7001,7012,7111,7130-7131,7133-7134,7138,7140-7142,7147-7148,7159-7160,7163,7168,7177,7179,7203,7205,7207,7210,7212,7251-7253,7255,7284,7287,7291,7293,7295-7296,7300,7355,7365-7366,7375-7376,7378,7395,7423-7426,7435,7458,7504,7567,7577,7623-7624,7638,7659-7660,7662,7665,7668,7674
/branches/Branch_4_8:7334-7335,7344-7345,7382,7387,7389-7390,7396,7398,7401-7402,7428-7429,7437,7440,7443,7449-7455,7459,7462,7466,7469-7470,7476-7477,7478,7480,7485,7490-7491,7492,7505,7540,7556-7558,7559-7560,7568,7570-7571,7573,7576,7580,7609-7610,7611,7613,7615,7618,7621-7622,7625-7627,7639,7658,7661,7663-7664,7666-7667,7673,7675,7678,7680,7685,7688-7689,7693,7700,7706-7708,7713,7725,7728-7730

Modified: svk:merge
   - 9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7001
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7012
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7291
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7458
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7623
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7624
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7335
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7344
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7345
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7396
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7402
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7455
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7459
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7469
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7470
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7476
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7480
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7505
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7540
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7557
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7559
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7560
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7580
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7609
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7615
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7618
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7621
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7622
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7626
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7627
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7708
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7713
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7725
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7729

   + 9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7001
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7012
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7291
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7458
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7623
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_7:7624
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7335
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7344
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7345
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7396
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7402
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7455
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7459
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7469
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7470
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7476
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7480
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7505
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7540
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7557
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7559
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7560
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7580
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7609
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7615
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7618
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7621
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7622
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7626
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7627
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7708
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7713
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7725
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7729
9d84d37e-dcb1-4aad-b103-6f3d92f53bf6:/branches/Branch_4_8:7730


Modified: trunk/gforge/db/20050224-drop.sql
===================================================================
--- trunk/gforge/db/20050224-drop.sql	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/20050224-drop.sql	2009-06-07 13:57:58 UTC (rev 7751)
@@ -1,8 +1,6 @@
 DROP INDEX docdata_groupid;
 DROP INDEX forumperm_useridgroupforumid;
-DROP INDEX forum_perm_id_key;
 DROP INDEX forumperm_groupforumiduserid;
 DROP INDEX group_cvs_history_id_key;
-DROP INDEX project_perm_id_key;
 DROP INDEX projecttaskartifact_projecttask;
 DROP INDEX supported_langu_language_id_key;

Modified: trunk/gforge/db/20050224.sql
===================================================================
--- trunk/gforge/db/20050224.sql	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/20050224.sql	2009-06-07 13:57:58 UTC (rev 7751)
@@ -92,6 +92,7 @@
 -- TODO DROP unnecessary sequence/id
 --
 ALTER TABLE forum_perm DROP CONSTRAINT forum_perm_id_key;
+DROP INDEX forum_perm_id_key;
 CREATE INDEX forumperm_useridgroupforumid ON forum_perm(user_id,group_forum_id);
 ALTER TABLE forum_perm ADD CONSTRAINT forum_perm_pkey PRIMARY KEY (group_forum_id, user_id);
 
@@ -169,6 +170,7 @@
 -- TODO DROP unnecessary sequence/id
 --
 ALTER TABLE project_perm DROP CONSTRAINT project_perm_id_key;
+DROP INDEX project_perm_id_key;
 DROP INDEX projectperm_groupprojiduserid;
 ALTER TABLE project_perm ADD CONSTRAINT project_perm_id_key PRIMARY KEY(group_project_id,user_id);
 CREATE INDEX projectperm_useridgroupprojid ON project_perm(user_id,group_project_id);

Modified: trunk/gforge/db/20050822.sql
===================================================================
--- trunk/gforge/db/20050822.sql	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/20050822.sql	2009-06-07 13:57:58 UTC (rev 7751)
@@ -82,21 +82,17 @@
 -- Data for Name: forum_attachmenttype; Type: TABLE DATA; Schema: public; Owner: gforge
 --
 
---COPY forum_attachmenttype (extension, mimetype, size, width, height, enabled, display) FROM stdin;
---compat for older version
-COPY forum_attachmenttype FROM stdin;
-gif	a:1:{i:0;s:23:"Content-type: image/gif";}	20000	620	280	1	0
-jpeg	a:1:{i:0;s:24:"Content-type: image/jpeg";}	20000	620	280	1	0
-jpg	a:1:{i:0;s:24:"Content-type: image/jpeg";}	100000	0	0	1	0
-jpe	a:1:{i:0;s:24:"Content-type: image/jpeg";}	20000	620	280	1	0
-txt	a:1:{i:0;s:24:"Content-type: plain/text";}	20000	0	0	1	2
-png	a:1:{i:0;s:23:"Content-type: image/png";}	20000	620	280	1	0
-doc	a:2:{i:0;s:20:"Accept-ranges: bytes";i:1;s:32:"Content-type: application/msword";}	20000	0	0	1	0
-pdf	a:1:{i:0;s:29:"Content-type: application/pdf";}	20000	0	0	1	0
-bmp	a:1:{i:0;s:26:"Content-type: image/bitmap";}	20000	620	280	1	0
-psd	a:1:{i:0;s:29:"Content-type: unknown/unknown";}	20000	0	0	1	0
-zip	a:1:{i:0;s:29:"Content-type: application/zip";}	100000	0	0	1	0
-\.
+INSERT INTO forum_attachmenttype VALUES ('gif', 'a:1:{i:0;s:23:"Content-type: image/gif";}', 20000, 620, 280, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('jpeg', 'a:1:{i:0;s:24:"Content-type: image/jpeg";}', 20000, 620, 280, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('jpg', 'a:1:{i:0;s:24:"Content-type: image/jpeg";}', 100000, 0, 0, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('jpe', 'a:1:{i:0;s:24:"Content-type: image/jpeg";}', 20000, 620, 280, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('png', 'a:1:{i:0;s:23:"Content-type: image/png";}', 20000, 620, 280, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('txt', 'a:1:{i:0;s:24:"Content-type: plain/text";}', 20000, 0, 0, 1, 2);
+INSERT INTO forum_attachmenttype VALUES ('doc', 'a:2:{i:0;s:20:"Accept-ranges: bytes";i:1;s:32:"Content-type: application/msword";}', 20000, 0, 0, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('pdf', 'a:1:{i:0;s:29:"Content-type: application/pdf";}', 20000, 0, 0, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('bmp', 'a:1:{i:0;s:26:"Content-type: image/bitmap";}', 20000, 620, 280, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('psd', 'a:1:{i:0;s:29:"Content-type: unknown/unknown";}', 20000, 0, 0, 1, 0);
+INSERT INTO forum_attachmenttype VALUES ('zip', 'a:1:{i:0;s:29:"Content-type: application/zip";}', 100000, 0, 0, 1, 0);
 
 
 --

Modified: trunk/gforge/db/20051003.sql
===================================================================
--- trunk/gforge/db/20051003.sql	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/20051003.sql	2009-06-07 13:57:58 UTC (rev 7751)
@@ -1,5 +1,5 @@
---ALTER TABLE plugin_cvstracker_data_master DROP COLUMN cvs_date;
---ALTER TABLE plugin_cvstracker_data_master ADD COLUMN cvs_date int;
---UPDATE plugin_cvstracker_data_master SET cvs_date=extract(epoch from now());
---ALTER TABLE plugin_cvstracker_data_master ALTER COLUMN cvs_date SET NOT NULL;
-
+ALTER TABLE plugin_cvstracker_data_master ADD COLUMN cvs_date_int int;
+UPDATE plugin_cvstracker_data_master SET cvs_date_int=extract(epoch from cvs_date);
+ALTER TABLE plugin_cvstracker_data_master DROP COLUMN cvs_date;
+ALTER TABLE plugin_cvstracker_data_master RENAME COLUMN cvs_date_int TO cvs_date;
+ALTER TABLE plugin_cvstracker_data_master ALTER COLUMN cvs_date SET NOT NULL;
\ No newline at end of file

Modified: trunk/gforge/db/20060216.sql
===================================================================
--- trunk/gforge/db/20060216.sql	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/20060216.sql	2009-06-07 13:57:58 UTC (rev 7751)
@@ -1,4 +1,8 @@
+DROP VIEW activity_vw;
+DROP RULE groupactivity_userdelete_rule ON users;
+DROP TABLE group_activity_monitor;
 
+
 CREATE VIEW activity_vw AS 
 SELECT 
 agl.group_id, 'trackeropen'::text AS section, agl.group_artifact_id AS ref_id,

Modified: trunk/gforge/db/upgrade-db.php
===================================================================
--- trunk/gforge/db/upgrade-db.php	2009-06-07 13:57:49 UTC (rev 7750)
+++ trunk/gforge/db/upgrade-db.php	2009-06-07 13:57:58 UTC (rev 7751)
@@ -183,7 +183,7 @@
 	
 	$content = preg_replace("/--(.*)/", '', $content);
 	
-	$parts = explode(';', $content);
+	$parts = explode(";\n", $content);
 	$queries = array();
 	$query_temp = '';
 	$is_function = false;
@@ -206,7 +206,7 @@
 		} else if (in_string($q, 'copy') && in_string($q, 'from stdin')) {
 			while (!in_string($q, '\.')) {
 				$i++;
-				$q = $q.';'.$parts[$i];
+				$q = $q.";\n".$parts[$i];
 			}
 			$aux = explode('\.', $q, 2);
 			$queries[] = ltrim($aux[0]."\\.\n");
@@ -230,7 +230,7 @@
 		if (in_string($query, 'drop table')) {
 			$aux = explode(' ', trim($query));
 			if (count($aux) == 3 || count($aux) == 4) { // PERFECT!
-				drop_table_if_exists($aux[2]);
+				drop_table_if_exists($aux[2], (count($aux) == 4) && preg_match('/CASCADE/i', trim($aux[3])));
 			} else {
 				print_r($aux);
 			}
@@ -258,6 +258,13 @@
 			} else {
 				print_r($aux);
 			}
+		} else if (in_string($query, 'drop index')) {
+			$aux = explode(' ', trim($query));
+			if (count($aux) == 3 || count($aux) == 4) { // PERFECT!
+				drop_index_if_exists($aux[2]);
+			} else {
+				print_r($aux);
+			}
 		} else {
 			$res = db_query($query);
 			if (!$res) {
@@ -376,23 +383,31 @@
 	return $result;
 }
 
-function drop_table_if_exists($name) {
-	$result = drop_if_exists($name, 'DROP TABLE', 'r');
+function drop_index_if_exists($name) {
+	$result = drop_if_exists($name, 'DROP INDEX', 'i');
 	return $result;
 }
 
-function drop_if_exists($name, $command, $kind) {
+function drop_table_if_exists($name, $cascade) {
+	if($cascade)  {
+		$result = drop_if_exists($name, 'DROP TABLE', 'r', 'CASCADE');
+	} else {
+		$result = drop_if_exists($name, 'DROP TABLE', 'r');
+	}
+	return $result;
+}
+
+function drop_if_exists($name, $command, $kind, $commandSuffix = '') {
 	// Strip "name" => name
 	if (preg_match('/^"(.*)"$/', $name, $match)) {
 		$name = $match[1];
-	}
 	$res = db_query("SELECT COUNT(*) AS exists FROM pg_class WHERE relname='$name' AND relkind='$kind'");
 	if (!$res) {
 		show("ERROR:".db_error()."\n");
 		return false;
 	}
 	if (db_result($res, 0, 'exists') != '0') {
-		$res = db_query("$command $name");
+		$res = db_query("$command $name $commandSuffix");
 		if (!$res) {
 			show("ERROR:".db_error()."\n");
 			//db_rollback();




More information about the Fusionforge-commits mailing list