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

Alain Peyrat aljeux at libremir.placard.fr.eu.org
Fri May 15 21:56:09 CEST 2009


Author: aljeux
Date: 2009-05-15 21:56:09 +0200 (Fri, 15 May 2009)
New Revision: 7669

Modified:
   trunk/gforge/db/gforge.sql
   trunk/gforge/db/startpoint.php
   trunk/gforge/db/upgrade-db.php
   trunk/gforge/install.sh
Log:
Fix empty list of assignee in trackers and minor changes

Modified: trunk/gforge/db/gforge.sql
===================================================================
--- trunk/gforge/db/gforge.sql	2009-05-15 19:51:54 UTC (rev 7668)
+++ trunk/gforge/db/gforge.sql	2009-05-15 19:56:09 UTC (rev 7669)
@@ -1342,34 +1342,6 @@
 
 
 
-CREATE SEQUENCE artifact_perm_id_seq
-    START WITH 1
-    INCREMENT BY 1
-    MAXVALUE 2147483647
-    NO MINVALUE
-    CACHE 1;
-
-
-
-CREATE TABLE artifact_perm (
-    id integer DEFAULT nextval('"artifact_perm_id_seq"'::text) NOT NULL,
-    group_artifact_id integer NOT NULL,
-    user_id integer NOT NULL,
-    perm_level integer DEFAULT 0 NOT NULL
-);
-
-
-
-CREATE VIEW artifactperm_user_vw AS
-    SELECT ap.id, ap.group_artifact_id, ap.user_id, ap.perm_level, users.user_name, users.realname FROM artifact_perm ap, users WHERE (users.user_id = ap.user_id);
-
-
-
-CREATE VIEW artifactperm_artgrouplist_vw AS
-    SELECT agl.group_artifact_id, agl.name, agl.description, agl.group_id, ap.user_id, ap.perm_level FROM artifact_perm ap, artifact_group_list agl WHERE (ap.group_artifact_id = agl.group_artifact_id);
-
-
-
 CREATE SEQUENCE artifact_status_id_seq
     INCREMENT BY 1
     MAXVALUE 2147483647
@@ -2195,33 +2167,64 @@
 
 
 
-CREATE TABLE project_perm (
-    id serial NOT NULL,
-    group_project_id integer NOT NULL,
-    user_id integer NOT NULL,
-    perm_level integer DEFAULT 0 NOT NULL
+CREATE TABLE role_setting (
+    role_id integer NOT NULL,
+    section_name text NOT NULL,
+    ref_id integer NOT NULL,
+    value character varying(2) NOT NULL
 );
 
 
+CREATE VIEW artifact_perm AS
+       SELECT
+	0 AS id,
+	role_setting.ref_id AS group_artifact_id,
+	user_group.user_id,
+	role_setting.value::int AS perm_level
+       FROM role_setting, user_group
+       WHERE user_group.role_id = role_setting.role_id
+         AND role_setting.section_name='tracker';
 
-CREATE TABLE forum_perm (
-    id serial NOT NULL,
-    group_forum_id integer NOT NULL,
-    user_id integer NOT NULL,
-    perm_level integer DEFAULT 0 NOT NULL
-);
 
 
+CREATE VIEW artifactperm_artgrouplist_vw AS
+       SELECT
+	agl.group_artifact_id, agl.name, agl.description,
+	agl.group_id, ap.user_id, ap.perm_level
+       FROM artifact_perm ap, artifact_group_list agl
+       WHERE (ap.group_artifact_id = agl.group_artifact_id) ;
 
-CREATE TABLE role_setting (
-    role_id integer NOT NULL,
-    section_name text NOT NULL,
-    ref_id integer NOT NULL,
-    value character varying(2) NOT NULL
-);
 
+CREATE VIEW artifactperm_user_vw AS
+       SELECT
+	ap.id, ap.group_artifact_id, ap.user_id, ap.perm_level,
+	users.user_name, users.realname
+       FROM artifact_perm ap, users
+       WHERE (users.user_id = ap.user_id) ;
 
 
+CREATE VIEW project_perm AS
+       SELECT
+	0 AS id,
+	role_setting.ref_id AS group_project_id,
+	user_group.user_id,
+	role_setting.value::int AS perm_level
+       FROM role_setting, user_group
+       WHERE user_group.role_id = role_setting.role_id
+         AND role_setting.section_name='pm';
+
+
+CREATE VIEW forum_perm AS
+       SELECT
+	0 AS id,
+	role_setting.ref_id AS group_forum_id,
+	user_group.user_id,
+	role_setting.value::int AS perm_level
+       FROM role_setting, user_group
+       WHERE user_group.role_id = role_setting.role_id
+         AND role_setting.section_name='forum';
+
+
 CREATE TABLE artifact_extra_field_list (
     extra_field_id integer DEFAULT nextval('artifact_extra_field_list_extra_field_id_seq'::text) NOT NULL,
     group_artifact_id integer NOT NULL,
@@ -3463,11 +3466,6 @@
 
 
 
-COPY artifact_perm (id, group_artifact_id, user_id, perm_level) FROM stdin;
-\.
-
-
-
 COPY artifact_status (id, status_name) FROM stdin;
 1	Open
 2	Closed
@@ -4013,16 +4011,6 @@
 
 
 
-COPY project_perm (id, group_project_id, user_id, perm_level) FROM stdin;
-\.
-
-
-
-COPY forum_perm (id, group_forum_id, user_id, perm_level) FROM stdin;
-\.
-
-
-
 COPY role_setting (role_id, section_name, ref_id, value) FROM stdin;
 2	projectadmin	0	A
 2	frs	0	1
@@ -4535,10 +4523,6 @@
 
 
 
-CREATE UNIQUE INDEX artperm_groupartifactid_userid ON artifact_perm USING btree (group_artifact_id, user_id);
-
-
-
 CREATE INDEX art_groupartid ON artifact USING btree (group_artifact_id);
 
 
@@ -4755,10 +4739,6 @@
 
 
 
-CREATE INDEX projectperm_useridgroupprojid ON project_perm USING btree (user_id, group_project_id);
-
-
-
 CREATE INDEX projecttaskartifact_artidprojtaskid ON project_task_artifact USING btree (artifact_id, project_task_id);
 
 
@@ -5058,11 +5038,6 @@
 
 
 
-ALTER TABLE ONLY artifact_perm
-    ADD CONSTRAINT artifact_perm_pkey PRIMARY KEY (id);
-
-
-
 ALTER TABLE ONLY artifact_status
     ADD CONSTRAINT artifact_status_pkey PRIMARY KEY (id);
 
@@ -5178,11 +5153,6 @@
 
 
 
-ALTER TABLE ONLY forum_perm
-    ADD CONSTRAINT forum_perm_pkey PRIMARY KEY (group_forum_id, user_id);
-
-
-
 ALTER TABLE ONLY forum_saved_place
     ADD CONSTRAINT forum_saved_place_pkey PRIMARY KEY (user_id, forum_id);
 
@@ -5213,11 +5183,6 @@
 
 
 
-ALTER TABLE ONLY project_perm
-    ADD CONSTRAINT project_perm_id_key PRIMARY KEY (group_project_id, user_id);
-
-
-
 ALTER TABLE ONLY project_sums_agg
     ADD CONSTRAINT project_sums_agg_pkey PRIMARY KEY (group_id, "type");
 
@@ -5348,26 +5313,6 @@
 
 
 
-ALTER TABLE ONLY project_perm
-    ADD CONSTRAINT "$1" FOREIGN KEY (group_project_id) REFERENCES project_group_list(group_project_id) ON DELETE CASCADE;
-
-
-
-ALTER TABLE ONLY project_perm
-    ADD CONSTRAINT "$2" FOREIGN KEY (user_id) REFERENCES users(user_id) MATCH FULL;
-
-
-
-ALTER TABLE ONLY forum_perm
-    ADD CONSTRAINT "$1" FOREIGN KEY (group_forum_id) REFERENCES forum_group_list(group_forum_id) ON DELETE CASCADE;
-
-
-
-ALTER TABLE ONLY forum_perm
-    ADD CONSTRAINT "$2" FOREIGN KEY (user_id) REFERENCES users(user_id) MATCH FULL;
-
-
-
 ALTER TABLE ONLY project_task_external_order
     ADD CONSTRAINT "$1" FOREIGN KEY (project_task_id) REFERENCES project_task(project_task_id) MATCH FULL ON DELETE CASCADE;
 
@@ -5797,15 +5742,6 @@
 
 
 CREATE CONSTRAINT TRIGGER artifactperm_userid_fk
-    AFTER INSERT OR UPDATE ON artifact_perm
-    FROM users
-    NOT DEFERRABLE INITIALLY IMMEDIATE
-    FOR EACH ROW
-    EXECUTE PROCEDURE "RI_FKey_check_ins"('artifactperm_userid_fk', 'artifact_perm', 'users', 'FULL', 'user_id', 'user_id');
-
-
-
-CREATE CONSTRAINT TRIGGER artifactperm_userid_fk
     AFTER DELETE ON users
     FROM artifact_perm
     NOT DEFERRABLE INITIALLY IMMEDIATE
@@ -5824,15 +5760,6 @@
 
 
 CREATE CONSTRAINT TRIGGER artifactperm_groupartifactid_fk
-    AFTER INSERT OR UPDATE ON artifact_perm
-    FROM artifact_group_list
-    NOT DEFERRABLE INITIALLY IMMEDIATE
-    FOR EACH ROW
-    EXECUTE PROCEDURE "RI_FKey_check_ins"('artifactperm_groupartifactid_fk', 'artifact_perm', 'artifact_group_list', 'FULL', 'group_artifact_id', 'group_artifact_id');
-
-
-
-CREATE CONSTRAINT TRIGGER artifactperm_groupartifactid_fk
     AFTER DELETE ON artifact_group_list
     FROM artifact_perm
     NOT DEFERRABLE INITIALLY IMMEDIATE
@@ -7514,10 +7441,6 @@
 
 
 
-SELECT pg_catalog.setval('artifact_perm_id_seq', 1, false);
-
-
-
 SELECT pg_catalog.setval('artifact_status_id_seq', 3, true);
 
 
@@ -7606,14 +7529,6 @@
 
 
 
-SELECT pg_catalog.setval('project_perm_id_seq', 1, false);
-
-
-
-SELECT pg_catalog.setval('forum_perm_id_seq', 1, false);
-
-
-
 SELECT pg_catalog.setval('artifact_extra_field_elements_element_id_seq', 1, false);
 
 
@@ -7892,3 +7807,6 @@
 	sum(tasks_closed) AS tasks_closed
 	FROM rep_group_act_monthly
 	GROUP BY month;
+
+
+

Modified: trunk/gforge/db/startpoint.php
===================================================================
--- trunk/gforge/db/startpoint.php	2009-05-15 19:51:54 UTC (rev 7668)
+++ trunk/gforge/db/startpoint.php	2009-05-15 19:56:09 UTC (rev 7669)
@@ -67,10 +67,12 @@
 	$version  = trim($version);
 	$date = 0;
 	$versions = array('2.5', 'sfee3.3', 'sfee3.0', '2.6','3.0pre5', '3.0pre6', '3.0pre7', '3.0pre8', '3.0pre9',
-					'3.0b1', '3.0rc2', '3.0', '3.1', '3.21', '3.3', '4.0', '4.0.1', '4.0.2', '4.5.0.1','4.5.11', '4.6', '4.7');
+					'3.0b1', '3.0rc2', '3.0', '3.1', '3.21', '3.3', '4.0', '4.0.1', '4.0.2', '4.5.0.1','4.5.11',
+					'4.6', '4.7', '4.7.3');
 	$dates    = array('20001219', '20021001', '20021001', '20021001', '20021206', '20021210', '20021214', '20021230',
 					'20030115', '20030304',	'20030510', '20040511', '20031026', '20040108', '20040326', '20041025',
-					'20041107', '20041215','20050803','20050810', '20070924', '20070924');
+					'20041107', '20041215','20050803','20050810',
+					'20070924', '20070924', '20070924');
 
 	if (in_array($version, $versions)) {
 		$date = $dates[array_search($version, $versions)];

Modified: trunk/gforge/db/upgrade-db.php
===================================================================
--- trunk/gforge/db/upgrade-db.php	2009-05-15 19:51:54 UTC (rev 7668)
+++ trunk/gforge/db/upgrade-db.php	2009-05-15 19:56:09 UTC (rev 7669)
@@ -30,7 +30,7 @@
        ); 
 }
 
-$db_path = './';
+$db_path = dirname(__FILE__).'/';
 $date = -1;
 $version = '';
 
@@ -63,7 +63,7 @@
 }
 
 if (!apply_fixes($version)) {
-	show("ERROR applying fixes!\n");
+	show("ERROR applying fixes to version $version!\n");
 	exit();
 }
 
@@ -277,13 +277,13 @@
 		}
 	}
 	
-	// Patch for somre 3.0preX versions
+	// Patch for some 3.0preX versions
 	if ($filename == '20021216.sql') {
 		db_query("SELECT setval('themes_theme_id_key', (SELECT MAX(theme_id) FROM themes), true)");
 		show("Applying fix for some 3.0preX versions\n");
 	}
 	
-	db_commit();
+	//db_commit();
 	return true;
 }
 
@@ -347,6 +347,10 @@
 			$queries[] = "ALTER TABLE project_task ADD CONSTRAINT project_task_group_project_id_f CHECK (1 = 1)";
 			$queries[] = "INSERT INTO database_changes (filename) VALUES ('3.0pre7fixes')";
 		}
+	} else if ($version == '4.7') {
+		run_script(array('filename'=>'20070924-project-perm.sql','ext'=>'sql'));
+		run_script(array('filename'=>'20070924-forum-perm.sql','ext'=>'sql'));
+		run_script(array('filename'=>'20070924-artifact-perm.sql','ext'=>'sql'));
 	}
 
 	//db_begin();

Modified: trunk/gforge/install.sh
===================================================================
--- trunk/gforge/install.sh	2009-05-15 19:51:54 UTC (rev 7668)
+++ trunk/gforge/install.sh	2009-05-15 19:56:09 UTC (rev 7669)
@@ -26,6 +26,7 @@
 hostname=$1
 type="";
 msg="";
+version=4.7.3
 
 if [ -f "/etc/redhat-release" ]
 then
@@ -70,7 +71,7 @@
 	if [ $mode = "install" ]
 	then
 		php gforge-install-3-db.php
-		php /opt/gforge/db/startpoint.php 4.7
+		php /opt/gforge/db/startpoint.php $version
 
 		# Post installation fixes.
 		perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
@@ -99,7 +100,7 @@
 	if [ $mode = "install" ]
 	then
 		php gforge-install-3-db.php
-		php /opt/gforge/db/startpoint.php 4.7
+		php /opt/gforge/db/startpoint.php $version
 
 		# Post installation fixes.
 		#perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/apache2/httpd.conf




More information about the Fusionforge-commits mailing list