[Fusionforge-commits] FusionForge branch Branch_5_3 updated. 0a9afd540ea21bd7ec52e141530db2b3ee79f1e5

Sylvain Beucler beuc-inria at fusionforge.org
Wed Apr 16 17:27:23 CEST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, Branch_5_3 has been updated
       via  0a9afd540ea21bd7ec52e141530db2b3ee79f1e5 (commit)
      from  7b0b155edbd52c7c6a68624440777f213187a82e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0a9afd540ea21bd7ec52e141530db2b3ee79f1e5
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date:   Wed Apr 16 17:27:15 2014 +0200

    Upgrade scripts fixes: clean-up table before new contraints, precise 2 constraints columns, drop obsolete views that blocked other tables, don't choke if docman's filesize is incorrect

diff --git a/src/db/20120603-docman-file-moved-in-fs.php b/src/db/20120603-docman-file-moved-in-fs.php
old mode 100644
new mode 100755
index 288e0a6..5c0c8ae
--- a/src/db/20120603-docman-file-moved-in-fs.php
+++ b/src/db/20120603-docman-file-moved-in-fs.php
@@ -47,17 +47,20 @@ $ds = new DocumentStorage();
 $tmp = tempnam('/tmp', 'docman');
 
 while($row = db_fetch_array($res)) {
-	$res2 = db_query_params ('SELECT filesize, data FROM doc_data WHERE docid=$1', 
+	$res2 = db_query_params ('SELECT data FROM doc_data WHERE docid=$1',
 		array($row['docid'])) ;
 	$row2 = db_fetch_array($res2);
-	$ret = file_put_contents($tmp, base64_decode($row2['data']));
+	$data = base64_decode($row2['data']);
+	// Not using column 'filesize', since we saw 2 installs where it was wrong
+	$size = strlen($data); // strlen == nb of bytes, not chars
+	$ret = file_put_contents($tmp, $data);
 	if ($ret === false) {
 		echo "UPGRADE ERROR: file_put_contents($tmp) error: returned false\n";
 		$ds->rollback();
 		exit(1);
 	}
-	if ($ret != $row2['filesize']) {
-		echo "UPGRADE ERROR: file_put_contents($tmp) size error: ($ret != ".$row2['filesize'].")\n";
+	if ($ret != $size) {
+		echo "UPGRADE ERROR: file_put_contents($tmp) size error: ($ret != ".$size.")\n";
 		$ds->rollback();
 		exit(1);
 	}
diff --git a/src/db/20120605-drop-obsolete.sql b/src/db/20120605-drop-obsolete.sql
index 8431a8e..d36721f 100644
--- a/src/db/20120605-drop-obsolete.sql
+++ b/src/db/20120605-drop-obsolete.sql
@@ -1,6 +1,8 @@
 DROP TABLE user_group;
 DROP TABLE role_setting ;
 DROP TABLE role;
+DROP VIEW IF EXISTS users_with_cvsflags_vw;
+DROP VIEW IF EXISTS groups_with_svn_vw;
 
 DROP VIEW artifact_group_list_vw;
 CREATE VIEW artifact_group_list_vw AS
diff --git a/src/db/20120801-create-indices.sql b/src/db/20120801-create-indices.sql
index 215ab4f..b80d2d0 100644
--- a/src/db/20120801-create-indices.sql
+++ b/src/db/20120801-create-indices.sql
@@ -8,6 +8,7 @@ ALTER TABLE artifact_monitor DROP COLUMN id;
 ALTER TABLE artifact_monitor ADD FOREIGN KEY (user_id) REFERENCES users(user_id);
 DROP SEQUENCE artifact_monitor_id_seq;
 
+DELETE FROM docdata_monitored_docman WHERE doc_id NOT IN (SELECT docid FROM doc_data);
 ALTER TABLE docdata_monitored_docman DROP COLUMN monitor_id;
 ALTER TABLE docdata_monitored_docman ADD PRIMARY KEY (doc_id, user_id);
 ALTER TABLE docdata_monitored_docman ADD FOREIGN KEY (user_id) REFERENCES users(user_id);
@@ -26,6 +27,7 @@ ALTER TABLE forum_monitored_forums ADD FOREIGN KEY (user_id) REFERENCES users(us
 ALTER TABLE forum_monitored_forums ADD FOREIGN KEY (forum_id) REFERENCES forum_group_list(group_forum_id);
 DROP SEQUENCE forum_monitored_forums_pk_seq;
 
+DELETE FROM user_diary_monitor WHERE user_id NOT IN (SELECT user_id FROM users);
 DROP INDEX userdiarymon_useridmonitoredid;
 ALTER TABLE user_diary_monitor ADD FOREIGN KEY (user_id) REFERENCES users(user_id);
 ALTER TABLE user_diary_monitor ADD FOREIGN KEY (monitored_user) REFERENCES users(user_id);
diff --git a/src/db/20121026-add-constraints.sql b/src/db/20121026-add-constraints.sql
index b9709ff..5505f0d 100644
--- a/src/db/20121026-add-constraints.sql
+++ b/src/db/20121026-add-constraints.sql
@@ -8,6 +8,7 @@ ALTER TABLE user_diary ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASC
 ALTER TABLE user_bookmarks ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE survey_responses ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE survey_rating_response ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_cvs_user WHERE user_id NOT IN (SELECT user_id FROM users);
 ALTER TABLE stats_cvs_user ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE snippet_version ADD FOREIGN KEY (submitted_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE snippet_package_version ADD FOREIGN KEY (submitted_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
@@ -22,11 +23,13 @@ ALTER TABLE people_skill_inventory ADD FOREIGN KEY (user_id) REFERENCES users ON
 ALTER TABLE people_job ADD FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE news_bytes ADD FOREIGN KEY (submitted_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE forum_saved_place ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM filemodule_monitor WHERE user_id NOT IN (SELECT user_id FROM users);
 ALTER TABLE filemodule_monitor ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE doc_data ADD FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE doc_data ADD FOREIGN KEY (reserved_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE doc_data ADD FOREIGN KEY (locked_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE forum_pending_messages ADD FOREIGN KEY (posted_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM frs_dlstats_file WHERE user_id NOT IN (SELECT user_id FROM users);
 ALTER TABLE frs_dlstats_file ADD FOREIGN KEY (user_id) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 
 ALTER TABLE skills_data_idx ADD FOREIGN KEY (skills_data_id) REFERENCES skills_data ON DELETE CASCADE ON UPDATE CASCADE;
@@ -41,15 +44,22 @@ ALTER TABLE artifact_idx ADD FOREIGN KEY (artifact_id) REFERENCES artifact ON DE
 
 ALTER TABLE surveys ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE survey_questions ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_subd_pages WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE stats_subd_pages ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_project_months WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE stats_project_months ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_project_metric WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE stats_project_metric ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_project WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE stats_project ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE stats_cvs_group ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE roadmap ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM rep_group_act_weekly WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE rep_group_act_weekly ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM rep_group_act_monthly WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE rep_group_act_monthly ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE rep_group_act_daily ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM prweb_vhost WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE prweb_vhost ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE project_weekly_metric ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE project_sums_agg ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
@@ -60,11 +70,13 @@ ALTER TABLE db_images ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CAS
 ALTER TABLE doc_data_idx ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE people_job ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE news_bytes ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM stats_project_developers WHERE group_id NOT IN (SELECT group_id FROM groups);
 ALTER TABLE stats_project_developers ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE prdb_dbs ADD FOREIGN KEY (group_id) REFERENCES groups ON DELETE CASCADE ON UPDATE CASCADE;
 
 ALTER TABLE survey_questions ADD FOREIGN KEY (question_type) REFERENCES survey_question_types ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE project_history ADD FOREIGN KEY (project_task_id) REFERENCES project_task ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM project_dependencies WHERE is_dependent_on_task_id NOT IN (SELECT project_task_id FROM project_task);
 ALTER TABLE project_dependencies ADD FOREIGN KEY (project_task_id) REFERENCES project_task ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE project_dependencies ADD FOREIGN KEY (is_dependent_on_task_id) REFERENCES project_task ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE project_counts_agg ADD FOREIGN KEY (group_project_id) REFERENCES project_group_list ON DELETE CASCADE ON UPDATE CASCADE;
diff --git a/src/db/20121026-more-db-cleaning.sql b/src/db/20121026-more-db-cleaning.sql
index 96b7c0c..f95f02d 100644
--- a/src/db/20121026-more-db-cleaning.sql
+++ b/src/db/20121026-more-db-cleaning.sql
@@ -4,12 +4,13 @@ DROP SEQUENCE project_assigned_to_pk_seq;
 
 ALTER TABLE forum_saved_place DROP COLUMN saved_place_id;
 DROP SEQUENCE forum_saved_place_pk_seq;
-ALTER TABLE forum_saved_place ADD FOREIGN KEY (forum_id) REFERENCES forum ON DELETE CASCADE ON UPDATE CASCADE;
+DELETE FROM forum_saved_place WHERE forum_id NOT IN (SELECT msg_id FROM forum);
+ALTER TABLE forum_saved_place ADD FOREIGN KEY (forum_id) REFERENCES forum (msg_id) ON DELETE CASCADE ON UPDATE CASCADE;
 
 ALTER TABLE filemodule_monitor DROP COLUMN id;
 DROP SEQUENCE filemodule_monitor_pk_seq;
-ALTER TABLE filemodule_monitor ADD FOREIGN KEY (filemodule_id) REFERENCES frs_package ON DELETE CASCADE ON UPDATE CASCADE;
-
+DELETE FROM filemodule_monitor WHERE filemodule_id NOT IN (SELECT package_id FROM frs_package);
+ALTER TABLE filemodule_monitor ADD FOREIGN KEY (filemodule_id) REFERENCES frs_package (package_id) ON DELETE CASCADE ON UPDATE CASCADE;
 ALTER TABLE prdb_dbs ADD FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 
 ALTER TABLE trove_treesums DROP COLUMN trove_treesums_id;
@@ -17,4 +18,5 @@ DROP SEQUENCE trove_treesums_pk_seq;
 
 ALTER TABLE prdb_dbs ADD FOREIGN KEY (created_by) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;
 
+UPDATE mail_group_list SET list_admin=100 WHERE list_admin NOT IN (SELECT user_id FROM users);
 ALTER TABLE mail_group_list ADD FOREIGN KEY (list_admin) REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE;

-----------------------------------------------------------------------

Summary of changes:
 src/db/20120603-docman-file-moved-in-fs.php |   11 +++++++----
 src/db/20120605-drop-obsolete.sql           |    2 ++
 src/db/20120801-create-indices.sql          |    2 ++
 src/db/20121026-add-constraints.sql         |   12 ++++++++++++
 src/db/20121026-more-db-cleaning.sql        |    8 +++++---
 5 files changed, 28 insertions(+), 7 deletions(-)
 mode change 100644 => 100755 src/db/20120603-docman-file-moved-in-fs.php


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list