[Fusionforge-commits] r7802 - in branches/Branch_4_8/gforge: db deb-specific
Guillaume Smet
gsmet at libremir.placard.fr.eu.org
Wed Jun 10 22:22:42 CEST 2009
Author: gsmet
Date: 2009-06-10 22:22:42 +0200 (Wed, 10 Jun 2009)
New Revision: 7802
Added:
branches/Branch_4_8/gforge/db/20021213-1.sql
branches/Branch_4_8/gforge/db/20021213-2-doc_data-migrate.php
branches/Branch_4_8/gforge/db/20021223-1-drops.sql
branches/Branch_4_8/gforge/db/20021223-2.sql
branches/Branch_4_8/gforge/db/20030102-1-drops.sql
branches/Branch_4_8/gforge/db/20030102-2.sql
branches/Branch_4_8/gforge/db/20030113-1-drops.sql
branches/Branch_4_8/gforge/db/20030113-2.sql
branches/Branch_4_8/gforge/db/20050224-1-drop.sql
branches/Branch_4_8/gforge/db/20050224-2.sql
branches/Branch_4_8/gforge/db/20050325-2.sql
branches/Branch_4_8/gforge/db/20050325-3.php
branches/Branch_4_8/gforge/db/20050325-4-drop.sql
branches/Branch_4_8/gforge/db/20050325-5.sql
branches/Branch_4_8/gforge/db/20050822-1-drops.sql
branches/Branch_4_8/gforge/db/20050822-2.sql
branches/Branch_4_8/gforge/db/20060216-1-drops.sql
branches/Branch_4_8/gforge/db/20060216-2-debian-nocommit.sql
branches/Branch_4_8/gforge/db/20060216-2.sql
Removed:
branches/Branch_4_8/gforge/db/20021213.sql
branches/Branch_4_8/gforge/db/20021213_doc_data-migrate.php
branches/Branch_4_8/gforge/db/20021223-drops.sql
branches/Branch_4_8/gforge/db/20021223.sql
branches/Branch_4_8/gforge/db/20030102-drops.sql
branches/Branch_4_8/gforge/db/20030102.sql
branches/Branch_4_8/gforge/db/20030113-drops.sql
branches/Branch_4_8/gforge/db/20030113.sql
branches/Branch_4_8/gforge/db/20050224-drop.sql
branches/Branch_4_8/gforge/db/20050224.sql
branches/Branch_4_8/gforge/db/20050325-1.sql
branches/Branch_4_8/gforge/db/20050325-2.php
branches/Branch_4_8/gforge/db/20050325-3-drop.sql
branches/Branch_4_8/gforge/db/20050325-3.sql
branches/Branch_4_8/gforge/db/20050822-drops.sql
branches/Branch_4_8/gforge/db/20050822.sql
branches/Branch_4_8/gforge/db/20060216-drops.sql
branches/Branch_4_8/gforge/db/20060216-nocommit.sql
branches/Branch_4_8/gforge/db/20060216.sql
Modified:
branches/Branch_4_8/gforge/db/upgrade-db.php
branches/Branch_4_8/gforge/deb-specific/db-upgrade.pl
Log:
changed the upgrade path so that it's fully deterministic:
* renamed the upgrade scripts using the following conventions:
- scripts containing debian are ignored by upgrade-db.php
- if there are several scripts with a given date, add an additional number (eg 20050224-1-drops.sql, 20050224-2.sql)
* fixed upgrade-db.php to order upgrade scripts by the full name of the script
* updated the db-upgrade.pl accordingly
Copied: branches/Branch_4_8/gforge/db/20021213-1.sql (from rev 7727, branches/Branch_4_8/gforge/db/20021213.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20021213-1.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20021213-1.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,10 @@
+--
+-- Making docman binary safe
+--
+alter table doc_data add column filename text;
+alter table doc_data add column filetype text;
+
+--
+-- NOTE THE doc_data-migration.php SCRIPT
+--
+
Property changes on: branches/Branch_4_8/gforge/db/20021213-1.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20021213.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20021213-2-doc_data-migrate.php (from rev 7728, branches/Branch_4_8/gforge/db/20021213_doc_data-migrate.php)
===================================================================
--- branches/Branch_4_8/gforge/db/20021213-2-doc_data-migrate.php (rev 0)
+++ branches/Branch_4_8/gforge/db/20021213-2-doc_data-migrate.php 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,43 @@
+#! /usr/bin/php5
+<?php
+
+/**
+ * Data migration for the doc_manager - between pre6 and pre7
+ *
+ * Copyright 2002 (c) GFORGE LLC
+ */
+
+require_once dirname(__FILE__).'/../www/env.inc.php';
+require $gfwww.'include/squal_pre.php';
+
+// drop and recreate page cache
+//
+//SELECT * FROM doc_data WHERE filename is null;
+db_begin();
+
+$res=db_query("SELECT * FROM doc_data WHERE filename IS NULL");
+if (!$res) {
+ echo db_error();
+ db_rollback();
+ exit();
+}
+$rows=db_numrows($res);
+
+for ($i=0; $i<$rows; $i++) {
+
+ $res2=db_query("UPDATE doc_data
+ SET
+ data='". base64_encode( util_unconvert_htmlspecialchars( db_result($res,$i,'data') )) ."',
+ filename='file".db_result($res,$i,'docid').".html',
+ filetype='text/html'
+ WHERE docid='".db_result($res,$i,'docid')."'");
+ if (!$res2 || db_affected_rows($res2) < 1) {
+ echo 'DB ERROR'.db_error();
+ db_rollback();
+ exit;
+ }
+}
+
+db_commit();
+echo "SUCCESS\n";
+?>
Property changes on: branches/Branch_4_8/gforge/db/20021213-2-doc_data-migrate.php
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20021213.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20021213.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20021213.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,10 +0,0 @@
---
--- Making docman binary safe
---
-alter table doc_data add column filename text;
-alter table doc_data add column filetype text;
-
---
--- NOTE THE doc_data-migration.php SCRIPT
---
-
Deleted: branches/Branch_4_8/gforge/db/20021213_doc_data-migrate.php
===================================================================
--- branches/Branch_4_8/gforge/db/20021213_doc_data-migrate.php 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20021213_doc_data-migrate.php 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,43 +0,0 @@
-#! /usr/bin/php5
-<?php
-
-/**
- * Data migration for the doc_manager - between pre6 and pre7
- *
- * Copyright 2002 (c) GFORGE LLC
- */
-
-require_once dirname(__FILE__).'/../www/env.inc.php';
-require $gfwww.'include/squal_pre.php';
-
-// drop and recreate page cache
-//
-//SELECT * FROM doc_data WHERE filename is null;
-db_begin();
-
-$res=db_query("SELECT * FROM doc_data WHERE filename IS NULL");
-if (!$res) {
- echo db_error();
- db_rollback();
- exit();
-}
-$rows=db_numrows($res);
-
-for ($i=0; $i<$rows; $i++) {
-
- $res2=db_query("UPDATE doc_data
- SET
- data='". base64_encode( util_unconvert_htmlspecialchars( db_result($res,$i,'data') )) ."',
- filename='file".db_result($res,$i,'docid').".html',
- filetype='text/html'
- WHERE docid='".db_result($res,$i,'docid')."'");
- if (!$res2 || db_affected_rows($res2) < 1) {
- echo 'DB ERROR'.db_error();
- db_rollback();
- exit;
- }
-}
-
-db_commit();
-echo "SUCCESS\n";
-?>
Copied: branches/Branch_4_8/gforge/db/20021223-1-drops.sql (from rev 7727, branches/Branch_4_8/gforge/db/20021223-drops.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20021223-1-drops.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20021223-1-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,13 @@
+ALTER TABLE project_task DROP CONSTRAINT "project_task_group_project_id_f" RESTRICT;
+DROP TABLE project_category;
+DROP SEQUENCE project_categor_category_id_seq;
+DROP VIEW project_task_vw;
+DROP TABLE project_task_artifact;
+DROP TABLE project_group_forum;
+DROP TABLE project_group_doccat;
+DROP VIEW project_depend_vw;
+DROP VIEW project_dependon_vw;
+DROP VIEW project_history_user_vw;
+DROP VIEW project_message_user_vw;
+DROP TRIGGER projtask_update_depend_trig ON project_task;
+DROP TRIGGER projtask_insert_depend_trig ON project_task;
Property changes on: branches/Branch_4_8/gforge/db/20021223-1-drops.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20021223-drops.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20021223-2.sql (from rev 7727, branches/Branch_4_8/gforge/db/20021223.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20021223-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20021223-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,235 @@
+--
+-- rename old "date" fields to be SQL compliant
+--
+alter table project_history rename column date to mod_date;
+
+--
+-- Change project_task to delete on removal of project
+--
+
+ALTER TABLE project_task
+ ADD CONSTRAINT projecttask_groupprojectid_fk FOREIGN KEY (group_project_id)
+ REFERENCES project_group_list(group_project_id) ON DELETE CASCADE;
+
+--
+-- Add email address to send all task updates to
+--
+ALTER TABLE project_group_list ADD COLUMN send_all_posts_to text;
+
+
+--
+-- Each task can be assigned a category
+--
+CREATE SEQUENCE "project_categor_category_id_seq" ;
+CREATE TABLE project_category (
+category_id integer DEFAULT nextval('project_categor_category_id_seq'::text) NOT NULL,
+group_project_id int
+ CONSTRAINT projcat_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
+category_name text,
+ CONSTRAINT "project_category_pkey" Primary Key ("category_id")
+);
+CREATE INDEX projectcategory_groupprojectid ON project_category(group_project_id);
+INSERT INTO project_category VALUES ('100','1','None');
+SELECT SETVAL('project_categor_category_id_seq',100);
+
+--
+-- Add category_id
+--
+ALTER TABLE project_task ADD COLUMN category_id int REFERENCES project_category(category_id);
+UPDATE project_task SET category_id=100;
+
+--
+-- Convenience view required for ProjectTask object
+--
+CREATE VIEW project_task_vw AS
+SELECT project_task.*,project_category.category_name,project_status.status_name
+FROM project_task
+FULL JOIN project_category ON (project_category.category_id=project_task.category_id)
+NATURAL JOIN project_status;
+
+--
+-- Each task can have multiple artifacts associated with it
+--
+CREATE TABLE project_task_artifact (
+project_task_id int
+ CONSTRAINT projtaskartifact_projtaskid_fk REFERENCES project_task(project_task_id) ON DELETE CASCADE,
+artifact_id int
+ CONSTRAINT projtaskartifact_artifactid_fk REFERENCES artifact(artifact_id) ON DELETE CASCADE);
+CREATE INDEX projecttaskartifact_projecttaskid ON project_task_artifact (project_task_id);
+CREATE INDEX projecttaskartifact_artifactid ON project_task_artifact (artifact_id);
+
+--
+-- Relation to forums dedicated to this project
+--
+CREATE TABLE project_group_forum (
+group_project_id int
+ CONSTRAINT projgroupforum_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
+group_forum_id int
+ CONSTRAINT projgroupforum_groupforumid_fk REFERENCES forum_group_list(group_forum_id) ON DELETE CASCADE);
+CREATE INDEX projectgroupforum_groupprojectid ON project_group_forum(group_project_id);
+CREATE INDEX projectgroupforum_groupforumid ON project_group_forum(group_forum_id);
+
+--
+-- Relation to a category of docs for this project
+--
+CREATE TABLE project_group_doccat (
+group_project_id int
+ CONSTRAINT projgroupdoccat_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
+doc_group_id int
+ CONSTRAINT projgroupdoccat_docgroupid_fk REFERENCES doc_groups(doc_group) ON DELETE CASCADE);
+CREATE INDEX projectgroupdoccat_groupprojectid ON project_group_forum(group_project_id);
+CREATE INDEX projectgroupdoccat_groupgroupid ON project_group_doccat(doc_group_id);
+
+--
+--
+--
+CREATE VIEW project_depend_vw AS
+ SELECT pt.project_task_id,pd.is_dependent_on_task_id,pt.end_date,pt.start_date
+ FROM project_task pt NATURAL JOIN project_dependencies pd;
+
+CREATE VIEW project_dependon_vw AS
+ SELECT pd.project_task_id,pd.is_dependent_on_task_id,pt.end_date,pt.start_date
+ FROM project_task pt FULL JOIN project_dependencies pd ON (pd.is_dependent_on_task_id=pt.project_task_id);
+
+CREATE VIEW project_history_user_vw AS
+ SELECT users.realname,users.email,users.user_name,project_history.*
+ FROM users,project_history
+ WHERE project_history.mod_by=users.user_id;
+
+--
+-- Move project messages into separate table from project_history
+--
+CREATE TABLE project_messages (
+project_message_id SERIAL,
+project_task_id INT NOT NULL REFERENCES project_task(project_task_id) ON DELETE CASCADE,
+body text,
+posted_by INT NOT NULL REFERENCES users(user_id),
+postdate int NOT NULL);
+
+--BEGIN;
+INSERT INTO project_messages (project_task_id,body,posted_by,postdate)
+ SELECT project_task_id,old_value,mod_by,mod_date
+ FROM project_history
+ WHERE field_name='details';
+
+DELETE FROM project_history WHERE field_name='details';
+
+--COMMIT;
+
+CREATE VIEW project_message_user_vw AS
+ SELECT users.realname,users.email,users.user_name,project_messages.*
+ FROM users,project_messages
+ WHERE project_messages.posted_by=users.user_id;
+--
+-- Remove all existing dependencies, as they may be problematic.
+--
+DELETE FROM project_dependencies;
+
+--
+-- Function to enforce dependencies in the table structure
+--
+
+CREATE OR REPLACE FUNCTION projtask_update_depend () RETURNS OPAQUE AS '
+DECLARE
+ dependent RECORD;
+ dependon RECORD;
+ delta INTEGER;
+BEGIN
+ --
+ -- See if tasks that are dependent on us are OK
+ -- See if the end date has changed
+ --
+ IF NEW.end_date > OLD.end_date THEN
+ --
+ -- If the end date pushed back, push back dependent tasks
+ --
+ FOR dependent IN SELECT * FROM project_depend_vw WHERE is_dependent_on_task_id=NEW.project_task_id LOOP
+ --
+ -- Some dependent tasks may not start immediately
+ --
+ IF dependent.start_date > OLD.end_date THEN
+ IF dependent.start_date < NEW.end_date THEN
+ delta := NEW.end_date-dependent.start_date;
+ UPDATE project_task
+ SET start_date=start_date+delta,
+ end_date=end_date+delta
+ WHERE project_task_id=dependent.project_task_id;
+ END IF;
+ ELSE
+ IF dependent.start_date = OLD.end_date THEN
+ delta := NEW.end_date-OLD.end_date;
+ UPDATE project_task
+ SET start_date=start_date+delta,
+ end_date=end_date+delta
+ WHERE project_task_id=dependent.project_task_id;
+ END IF;
+ END IF;
+ END LOOP;
+ ELSIF NEW.end_date < OLD.end_date THEN
+ --
+ -- If the end date moved up, move up dependent tasks
+ --
+ FOR dependent IN SELECT * FROM project_depend_vw WHERE is_dependent_on_task_id=NEW.project_task_id LOOP
+ IF dependent.start_date = OLD.end_date THEN
+ --
+ -- dependent task was constrained by us - bring it forward
+ --
+ delta := OLD.end_date-NEW.end_date;
+ UPDATE project_task
+ SET start_date=start_date-delta,
+ end_date=end_date-delta
+ WHERE project_task_id=dependent.project_task_id;
+ END IF;
+ END LOOP;
+ END IF;
+--
+-- MAY WISH TO INSERT AUDIT TRAIL HERE FOR CHANGED begin/end DATES
+--
+ RETURN NEW;
+END;
+' LANGUAGE 'plpgsql';
+
+
+CREATE TRIGGER projtask_update_depend_trig AFTER UPDATE ON project_task
+ FOR EACH ROW EXECUTE PROCEDURE projtask_update_depend();
+
+
+--
+-- Function to enforce dependencies in the table structure
+--
+CREATE OR REPLACE FUNCTION projtask_insert_depend () RETURNS OPAQUE AS '
+DECLARE
+ dependon RECORD;
+ delta INTEGER;
+BEGIN
+ --
+ -- ENFORCE START/END DATE logic
+ --
+ IF NEW.start_date >= NEW.end_date THEN
+ RAISE EXCEPTION ''START DATE CANNOT BE AFTER END DATE'';
+ END IF;
+ --
+ -- First make sure we start on or after end_date of tasks
+ -- that we depend on
+ --
+ FOR dependon IN SELECT * FROM project_dependon_vw
+ WHERE project_task_id=NEW.project_task_id LOOP
+ --
+ -- See if the task we are dependon on
+ -- ends after we are supposed to start
+ --
+ IF dependon.end_date > NEW.start_date THEN
+ delta := dependon.end_date-NEW.start_date;
+ RAISE NOTICE ''Bumping Back: % Delta: % '',NEW.project_task_id,delta;
+ NEW.start_date := NEW.start_date+delta;
+ NEW.end_date := NEW.end_date+delta;
+ END IF;
+
+ END LOOP;
+ RETURN NEW;
+END;
+' LANGUAGE 'plpgsql';
+
+CREATE TRIGGER projtask_insert_depend_trig BEFORE INSERT OR UPDATE ON project_task
+ FOR EACH ROW EXECUTE PROCEDURE projtask_insert_depend();
+
Property changes on: branches/Branch_4_8/gforge/db/20021223-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20021223.sql: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
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20021223-drops.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20021223-drops.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20021223-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,13 +0,0 @@
-ALTER TABLE project_task DROP CONSTRAINT "project_task_group_project_id_f" RESTRICT;
-DROP TABLE project_category;
-DROP SEQUENCE project_categor_category_id_seq;
-DROP VIEW project_task_vw;
-DROP TABLE project_task_artifact;
-DROP TABLE project_group_forum;
-DROP TABLE project_group_doccat;
-DROP VIEW project_depend_vw;
-DROP VIEW project_dependon_vw;
-DROP VIEW project_history_user_vw;
-DROP VIEW project_message_user_vw;
-DROP TRIGGER projtask_update_depend_trig ON project_task;
-DROP TRIGGER projtask_insert_depend_trig ON project_task;
Deleted: branches/Branch_4_8/gforge/db/20021223.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20021223.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20021223.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,235 +0,0 @@
---
--- rename old "date" fields to be SQL compliant
---
-alter table project_history rename column date to mod_date;
-
---
--- Change project_task to delete on removal of project
---
-
-ALTER TABLE project_task
- ADD CONSTRAINT projecttask_groupprojectid_fk FOREIGN KEY (group_project_id)
- REFERENCES project_group_list(group_project_id) ON DELETE CASCADE;
-
---
--- Add email address to send all task updates to
---
-ALTER TABLE project_group_list ADD COLUMN send_all_posts_to text;
-
-
---
--- Each task can be assigned a category
---
-CREATE SEQUENCE "project_categor_category_id_seq" ;
-CREATE TABLE project_category (
-category_id integer DEFAULT nextval('project_categor_category_id_seq'::text) NOT NULL,
-group_project_id int
- CONSTRAINT projcat_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
-category_name text,
- CONSTRAINT "project_category_pkey" Primary Key ("category_id")
-);
-CREATE INDEX projectcategory_groupprojectid ON project_category(group_project_id);
-INSERT INTO project_category VALUES ('100','1','None');
-SELECT SETVAL('project_categor_category_id_seq',100);
-
---
--- Add category_id
---
-ALTER TABLE project_task ADD COLUMN category_id int REFERENCES project_category(category_id);
-UPDATE project_task SET category_id=100;
-
---
--- Convenience view required for ProjectTask object
---
-CREATE VIEW project_task_vw AS
-SELECT project_task.*,project_category.category_name,project_status.status_name
-FROM project_task
-FULL JOIN project_category ON (project_category.category_id=project_task.category_id)
-NATURAL JOIN project_status;
-
---
--- Each task can have multiple artifacts associated with it
---
-CREATE TABLE project_task_artifact (
-project_task_id int
- CONSTRAINT projtaskartifact_projtaskid_fk REFERENCES project_task(project_task_id) ON DELETE CASCADE,
-artifact_id int
- CONSTRAINT projtaskartifact_artifactid_fk REFERENCES artifact(artifact_id) ON DELETE CASCADE);
-CREATE INDEX projecttaskartifact_projecttaskid ON project_task_artifact (project_task_id);
-CREATE INDEX projecttaskartifact_artifactid ON project_task_artifact (artifact_id);
-
---
--- Relation to forums dedicated to this project
---
-CREATE TABLE project_group_forum (
-group_project_id int
- CONSTRAINT projgroupforum_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
-group_forum_id int
- CONSTRAINT projgroupforum_groupforumid_fk REFERENCES forum_group_list(group_forum_id) ON DELETE CASCADE);
-CREATE INDEX projectgroupforum_groupprojectid ON project_group_forum(group_project_id);
-CREATE INDEX projectgroupforum_groupforumid ON project_group_forum(group_forum_id);
-
---
--- Relation to a category of docs for this project
---
-CREATE TABLE project_group_doccat (
-group_project_id int
- CONSTRAINT projgroupdoccat_projgroupid_fk REFERENCES project_group_list(group_project_id) ON DELETE CASCADE,
-doc_group_id int
- CONSTRAINT projgroupdoccat_docgroupid_fk REFERENCES doc_groups(doc_group) ON DELETE CASCADE);
-CREATE INDEX projectgroupdoccat_groupprojectid ON project_group_forum(group_project_id);
-CREATE INDEX projectgroupdoccat_groupgroupid ON project_group_doccat(doc_group_id);
-
---
---
---
-CREATE VIEW project_depend_vw AS
- SELECT pt.project_task_id,pd.is_dependent_on_task_id,pt.end_date,pt.start_date
- FROM project_task pt NATURAL JOIN project_dependencies pd;
-
-CREATE VIEW project_dependon_vw AS
- SELECT pd.project_task_id,pd.is_dependent_on_task_id,pt.end_date,pt.start_date
- FROM project_task pt FULL JOIN project_dependencies pd ON (pd.is_dependent_on_task_id=pt.project_task_id);
-
-CREATE VIEW project_history_user_vw AS
- SELECT users.realname,users.email,users.user_name,project_history.*
- FROM users,project_history
- WHERE project_history.mod_by=users.user_id;
-
---
--- Move project messages into separate table from project_history
---
-CREATE TABLE project_messages (
-project_message_id SERIAL,
-project_task_id INT NOT NULL REFERENCES project_task(project_task_id) ON DELETE CASCADE,
-body text,
-posted_by INT NOT NULL REFERENCES users(user_id),
-postdate int NOT NULL);
-
---BEGIN;
-INSERT INTO project_messages (project_task_id,body,posted_by,postdate)
- SELECT project_task_id,old_value,mod_by,mod_date
- FROM project_history
- WHERE field_name='details';
-
-DELETE FROM project_history WHERE field_name='details';
-
---COMMIT;
-
-CREATE VIEW project_message_user_vw AS
- SELECT users.realname,users.email,users.user_name,project_messages.*
- FROM users,project_messages
- WHERE project_messages.posted_by=users.user_id;
---
--- Remove all existing dependencies, as they may be problematic.
---
-DELETE FROM project_dependencies;
-
---
--- Function to enforce dependencies in the table structure
---
-
-CREATE OR REPLACE FUNCTION projtask_update_depend () RETURNS OPAQUE AS '
-DECLARE
- dependent RECORD;
- dependon RECORD;
- delta INTEGER;
-BEGIN
- --
- -- See if tasks that are dependent on us are OK
- -- See if the end date has changed
- --
- IF NEW.end_date > OLD.end_date THEN
- --
- -- If the end date pushed back, push back dependent tasks
- --
- FOR dependent IN SELECT * FROM project_depend_vw WHERE is_dependent_on_task_id=NEW.project_task_id LOOP
- --
- -- Some dependent tasks may not start immediately
- --
- IF dependent.start_date > OLD.end_date THEN
- IF dependent.start_date < NEW.end_date THEN
- delta := NEW.end_date-dependent.start_date;
- UPDATE project_task
- SET start_date=start_date+delta,
- end_date=end_date+delta
- WHERE project_task_id=dependent.project_task_id;
- END IF;
- ELSE
- IF dependent.start_date = OLD.end_date THEN
- delta := NEW.end_date-OLD.end_date;
- UPDATE project_task
- SET start_date=start_date+delta,
- end_date=end_date+delta
- WHERE project_task_id=dependent.project_task_id;
- END IF;
- END IF;
- END LOOP;
- ELSIF NEW.end_date < OLD.end_date THEN
- --
- -- If the end date moved up, move up dependent tasks
- --
- FOR dependent IN SELECT * FROM project_depend_vw WHERE is_dependent_on_task_id=NEW.project_task_id LOOP
- IF dependent.start_date = OLD.end_date THEN
- --
- -- dependent task was constrained by us - bring it forward
- --
- delta := OLD.end_date-NEW.end_date;
- UPDATE project_task
- SET start_date=start_date-delta,
- end_date=end_date-delta
- WHERE project_task_id=dependent.project_task_id;
- END IF;
- END LOOP;
- END IF;
---
--- MAY WISH TO INSERT AUDIT TRAIL HERE FOR CHANGED begin/end DATES
---
- RETURN NEW;
-END;
-' LANGUAGE 'plpgsql';
-
-
-CREATE TRIGGER projtask_update_depend_trig AFTER UPDATE ON project_task
- FOR EACH ROW EXECUTE PROCEDURE projtask_update_depend();
-
-
---
--- Function to enforce dependencies in the table structure
---
-CREATE OR REPLACE FUNCTION projtask_insert_depend () RETURNS OPAQUE AS '
-DECLARE
- dependon RECORD;
- delta INTEGER;
-BEGIN
- --
- -- ENFORCE START/END DATE logic
- --
- IF NEW.start_date >= NEW.end_date THEN
- RAISE EXCEPTION ''START DATE CANNOT BE AFTER END DATE'';
- END IF;
- --
- -- First make sure we start on or after end_date of tasks
- -- that we depend on
- --
- FOR dependon IN SELECT * FROM project_dependon_vw
- WHERE project_task_id=NEW.project_task_id LOOP
- --
- -- See if the task we are dependon on
- -- ends after we are supposed to start
- --
- IF dependon.end_date > NEW.start_date THEN
- delta := dependon.end_date-NEW.start_date;
- RAISE NOTICE ''Bumping Back: % Delta: % '',NEW.project_task_id,delta;
- NEW.start_date := NEW.start_date+delta;
- NEW.end_date := NEW.end_date+delta;
- END IF;
-
- END LOOP;
- RETURN NEW;
-END;
-' LANGUAGE 'plpgsql';
-
-CREATE TRIGGER projtask_insert_depend_trig BEFORE INSERT OR UPDATE ON project_task
- FOR EACH ROW EXECUTE PROCEDURE projtask_insert_depend();
-
Copied: branches/Branch_4_8/gforge/db/20030102-1-drops.sql (from rev 7727, branches/Branch_4_8/gforge/db/20030102-drops.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20030102-1-drops.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20030102-1-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1 @@
+DROP VIEW docdata_vw;
Property changes on: branches/Branch_4_8/gforge/db/20030102-1-drops.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20030102-drops.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20030102-2.sql (from rev 7727, branches/Branch_4_8/gforge/db/20030102.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20030102-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20030102-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,49 @@
+--
+-- Add a group_id column to relate docs to a group
+--
+ALTER TABLE doc_data ADD COLUMN group_id INT;
+UPDATE doc_data SET group_id=(SELECT group_id FROM doc_groups WHERE doc_group=doc_data.doc_group);
+UPDATE doc_data SET stateid=4 WHERE stateid=100;
+--
+-- Add fkey constraints
+--
+ALTER TABLE doc_data ADD CONSTRAINT docdata_groupid
+ FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE CASCADE;
+ALTER TABLE doc_data ADD CONSTRAINT docdata_docgroupid
+ FOREIGN KEY (doc_group) REFERENCES doc_groups(doc_group);
+ALTER TABLE doc_data ADD CONSTRAINT docdata_stateid
+ FOREIGN KEY (stateid) REFERENCES doc_states(stateid);
+ALTER TABLE doc_groups ADD CONSTRAINT docgroups_groupid
+ FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE CASCADE;
+--
+-- Re-use old columns in the groups table
+--
+ALTER TABLE groups RENAME COLUMN new_task_address TO new_doc_address;
+ALTER TABLE groups RENAME COLUMN send_all_tasks TO send_all_docs;
+--BEGIN;
+UPDATE groups SET new_doc_address='',send_all_docs='0';
+--COMMIT;
+
+--
+-- Create a convenience view for selecting from docman
+--
+CREATE VIEW docdata_vw AS
+SELECT users.user_name,users.realname,users.email,
+ d.group_id,d.docid,d.stateid,d.title,d.updatedate,d.createdate,d.created_by,
+ d.doc_group,d.description,d.language_id,d.filename,d.filetype,
+ doc_states.name AS state_name,
+ doc_groups.groupname AS group_name,
+ sl.name as language_name
+FROM doc_data d
+NATURAL JOIN doc_states
+NATURAL JOIN doc_groups
+JOIN supported_languages sl ON (sl.language_id=d.language_id)
+JOIN users ON (users.user_id=d.created_by);
+
+--
+-- NEW VIEW FOR TRACKER
+--
+CREATE VIEW artifact_group_list_vw AS
+SELECT agl.*,aca.count,aca.open_count
+ FROM artifact_group_list agl
+ LEFT JOIN artifact_counts_agg aca USING (group_artifact_id);
Property changes on: branches/Branch_4_8/gforge/db/20030102-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20030102.sql: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
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20030102-drops.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20030102-drops.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20030102-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1 +0,0 @@
-DROP VIEW docdata_vw;
Deleted: branches/Branch_4_8/gforge/db/20030102.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20030102.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20030102.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,49 +0,0 @@
---
--- Add a group_id column to relate docs to a group
---
-ALTER TABLE doc_data ADD COLUMN group_id INT;
-UPDATE doc_data SET group_id=(SELECT group_id FROM doc_groups WHERE doc_group=doc_data.doc_group);
-UPDATE doc_data SET stateid=4 WHERE stateid=100;
---
--- Add fkey constraints
---
-ALTER TABLE doc_data ADD CONSTRAINT docdata_groupid
- FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE CASCADE;
-ALTER TABLE doc_data ADD CONSTRAINT docdata_docgroupid
- FOREIGN KEY (doc_group) REFERENCES doc_groups(doc_group);
-ALTER TABLE doc_data ADD CONSTRAINT docdata_stateid
- FOREIGN KEY (stateid) REFERENCES doc_states(stateid);
-ALTER TABLE doc_groups ADD CONSTRAINT docgroups_groupid
- FOREIGN KEY (group_id) REFERENCES groups(group_id) ON DELETE CASCADE;
---
--- Re-use old columns in the groups table
---
-ALTER TABLE groups RENAME COLUMN new_task_address TO new_doc_address;
-ALTER TABLE groups RENAME COLUMN send_all_tasks TO send_all_docs;
---BEGIN;
-UPDATE groups SET new_doc_address='',send_all_docs='0';
---COMMIT;
-
---
--- Create a convenience view for selecting from docman
---
-CREATE VIEW docdata_vw AS
-SELECT users.user_name,users.realname,users.email,
- d.group_id,d.docid,d.stateid,d.title,d.updatedate,d.createdate,d.created_by,
- d.doc_group,d.description,d.language_id,d.filename,d.filetype,
- doc_states.name AS state_name,
- doc_groups.groupname AS group_name,
- sl.name as language_name
-FROM doc_data d
-NATURAL JOIN doc_states
-NATURAL JOIN doc_groups
-JOIN supported_languages sl ON (sl.language_id=d.language_id)
-JOIN users ON (users.user_id=d.created_by);
-
---
--- NEW VIEW FOR TRACKER
---
-CREATE VIEW artifact_group_list_vw AS
-SELECT agl.*,aca.count,aca.open_count
- FROM artifact_group_list agl
- LEFT JOIN artifact_counts_agg aca USING (group_artifact_id);
Copied: branches/Branch_4_8/gforge/db/20030113-1-drops.sql (from rev 7727, branches/Branch_4_8/gforge/db/20030113-drops.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20030113-1-drops.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20030113-1-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,4 @@
+DROP VIEW stats_project_vw;
+DROP VIEW stats_project_all_vw;
+DROP VIEW stats_site_vw;
+DROP VIEW stats_site_all_vw;
Property changes on: branches/Branch_4_8/gforge/db/20030113-1-drops.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20030113-drops.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20030113-2.sql (from rev 7727, branches/Branch_4_8/gforge/db/20030113.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20030113-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20030113-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,122 @@
+DROP TABLE stats_site_all;
+DROP TABLE stats_site_last_30;
+DROP TABLE stats_project_all;
+DROP TABLE stats_project_developers_last30;
+DROP TABLE stats_project_last_30;
+
+CREATE VIEW stats_project_vw AS
+SELECT spd.group_id,
+ spd.month,
+ spd.day,
+ spd.developers,
+ spm.ranking AS group_ranking,
+ spm.percentile AS group_metric,
+ salbg.count AS logo_showings,
+ fdga.downloads,
+ sasbg.count AS site_views,
+ ssp.pages AS subdomain_views,
+ (coalesce(sasbg.count,0) + coalesce(ssp.pages,0))::int AS page_views,
+ sp.file_releases,
+ sp.msg_posted,
+ sp.msg_uniq_auth,
+ sp.bugs_opened,
+ sp.bugs_closed,
+ sp.support_opened,
+ sp.support_closed,
+ sp.patches_opened,
+ sp.patches_closed,
+ sp.artifacts_opened,
+ sp.artifacts_closed,
+ sp.tasks_opened,
+ sp.tasks_closed,
+ sp.help_requests,
+ scg.checkouts AS cvs_checkouts,
+ scg.commits AS cvs_commits,
+ scg.adds AS cvs_adds
+FROM stats_project_developers spd
+ LEFT JOIN stats_project sp USING (month,day,group_id)
+ LEFT JOIN stats_project_metric spm USING (month,day,group_id)
+ LEFT JOIN stats_cvs_group scg USING (month,day,group_id)
+ LEFT JOIN stats_agg_site_by_group sasbg USING (month,day,group_id)
+ LEFT JOIN stats_agg_logo_by_group salbg USING (month,day,group_id)
+ LEFT JOIN stats_subd_pages ssp USING (month,day,group_id)
+ LEFT JOIN frs_dlstats_group_vw fdga USING (month,day,group_id)
+;
+
+CREATE VIEW stats_project_all_vw AS
+SELECT group_id,
+ AVG(developers)::int AS developers,
+ AVG(group_ranking)::int AS group_ranking,
+ AVG(group_metric)::float AS group_metric,
+ SUM(logo_showings) AS logo_showings,
+ SUM(downloads) AS downloads,
+ SUM(site_views) AS site_views,
+ SUM(subdomain_views) AS subdomain_views,
+ SUM(page_views) AS page_views,
+ SUM(file_releases) AS file_releases,
+ SUM(msg_posted) AS msg_posted,
+ AVG(msg_uniq_auth)::int AS msg_uniq_auth,
+ SUM(bugs_opened) AS bugs_opened,
+ SUM(bugs_closed) AS bugs_closed,
+ SUM(support_opened) AS support_opened,
+ SUM(support_closed) AS support_closed,
+ SUM(patches_opened) AS patches_opened,
+ SUM(patches_closed) AS patches_closed,
+ SUM(artifacts_opened) AS artifacts_opened,
+ SUM(artifacts_closed) AS artifacts_closed,
+ SUM(tasks_opened) AS tasks_opened,
+ SUM(tasks_closed) AS tasks_closed,
+ SUM(help_requests) AS help_requests,
+ SUM(cvs_checkouts) AS cvs_checkouts,
+ SUM(cvs_commits) AS cvs_commits,
+ SUM(cvs_adds) AS cvs_adds
+ FROM stats_project_months
+ GROUP BY group_id;
+
+CREATE VIEW stats_site_vw AS
+SELECT p.month,
+ p.day,
+ sspbd.site_page_views,
+ SUM(p.downloads) AS downloads,
+ SUM(p.subdomain_views) AS subdomain_views,
+ SUM(p.msg_posted) AS msg_posted,
+ SUM(p.bugs_opened) AS bugs_opened,
+ SUM(p.bugs_closed) AS bugs_closed,
+ SUM(p.support_opened) AS support_opened,
+ SUM(p.support_closed) AS support_closed,
+ SUM(p.patches_opened) AS patches_opened,
+ SUM(p.patches_closed) AS patches_closed,
+ SUM(artifacts_opened) AS artifacts_opened,
+ SUM(artifacts_closed) AS artifacts_closed,
+ SUM(p.tasks_opened) AS tasks_opened,
+ SUM(p.tasks_closed) AS tasks_closed,
+ SUM(p.help_requests) AS help_requests,
+ SUM(p.cvs_checkouts) AS cvs_checkouts,
+ SUM(p.cvs_commits) AS cvs_commits,
+ SUM(p.cvs_adds) AS cvs_adds
+ FROM stats_project_vw p, stats_site_pages_by_day sspbd
+ WHERE p.month=sspbd.month AND p.day=sspbd.day
+ GROUP BY p.month, p.day, sspbd.site_page_views;
+
+
+CREATE VIEW stats_site_all_vw AS
+SELECT
+ SUM(site_page_views) AS site_page_views,
+ SUM(downloads) AS downloads,
+ SUM(subdomain_views) AS subdomain_views,
+ SUM(msg_posted) AS msg_posted,
+ SUM(bugs_opened) AS bugs_opened,
+ SUM(bugs_closed) AS bugs_closed,
+ SUM(support_opened) AS support_opened,
+ SUM(support_closed) AS support_closed,
+ SUM(patches_opened) AS patches_opened,
+ SUM(patches_closed) AS patches_closed,
+ SUM(artifacts_opened) AS artifacts_opened,
+ SUM(artifacts_closed) AS artifacts_closed,
+ SUM(tasks_opened) AS tasks_opened,
+ SUM(tasks_closed) AS tasks_closed,
+ SUM(help_requests) AS help_requests,
+ SUM(cvs_checkouts) AS cvs_checkouts,
+ SUM(cvs_commits) AS cvs_commits,
+ SUM(cvs_adds) AS cvs_adds
+ FROM stats_site_months;
Property changes on: branches/Branch_4_8/gforge/db/20030113-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20030113.sql: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
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20030113-drops.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20030113-drops.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20030113-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,4 +0,0 @@
-DROP VIEW stats_project_vw;
-DROP VIEW stats_project_all_vw;
-DROP VIEW stats_site_vw;
-DROP VIEW stats_site_all_vw;
Deleted: branches/Branch_4_8/gforge/db/20030113.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20030113.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20030113.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,122 +0,0 @@
-DROP TABLE stats_site_all;
-DROP TABLE stats_site_last_30;
-DROP TABLE stats_project_all;
-DROP TABLE stats_project_developers_last30;
-DROP TABLE stats_project_last_30;
-
-CREATE VIEW stats_project_vw AS
-SELECT spd.group_id,
- spd.month,
- spd.day,
- spd.developers,
- spm.ranking AS group_ranking,
- spm.percentile AS group_metric,
- salbg.count AS logo_showings,
- fdga.downloads,
- sasbg.count AS site_views,
- ssp.pages AS subdomain_views,
- (coalesce(sasbg.count,0) + coalesce(ssp.pages,0))::int AS page_views,
- sp.file_releases,
- sp.msg_posted,
- sp.msg_uniq_auth,
- sp.bugs_opened,
- sp.bugs_closed,
- sp.support_opened,
- sp.support_closed,
- sp.patches_opened,
- sp.patches_closed,
- sp.artifacts_opened,
- sp.artifacts_closed,
- sp.tasks_opened,
- sp.tasks_closed,
- sp.help_requests,
- scg.checkouts AS cvs_checkouts,
- scg.commits AS cvs_commits,
- scg.adds AS cvs_adds
-FROM stats_project_developers spd
- LEFT JOIN stats_project sp USING (month,day,group_id)
- LEFT JOIN stats_project_metric spm USING (month,day,group_id)
- LEFT JOIN stats_cvs_group scg USING (month,day,group_id)
- LEFT JOIN stats_agg_site_by_group sasbg USING (month,day,group_id)
- LEFT JOIN stats_agg_logo_by_group salbg USING (month,day,group_id)
- LEFT JOIN stats_subd_pages ssp USING (month,day,group_id)
- LEFT JOIN frs_dlstats_group_vw fdga USING (month,day,group_id)
-;
-
-CREATE VIEW stats_project_all_vw AS
-SELECT group_id,
- AVG(developers)::int AS developers,
- AVG(group_ranking)::int AS group_ranking,
- AVG(group_metric)::float AS group_metric,
- SUM(logo_showings) AS logo_showings,
- SUM(downloads) AS downloads,
- SUM(site_views) AS site_views,
- SUM(subdomain_views) AS subdomain_views,
- SUM(page_views) AS page_views,
- SUM(file_releases) AS file_releases,
- SUM(msg_posted) AS msg_posted,
- AVG(msg_uniq_auth)::int AS msg_uniq_auth,
- SUM(bugs_opened) AS bugs_opened,
- SUM(bugs_closed) AS bugs_closed,
- SUM(support_opened) AS support_opened,
- SUM(support_closed) AS support_closed,
- SUM(patches_opened) AS patches_opened,
- SUM(patches_closed) AS patches_closed,
- SUM(artifacts_opened) AS artifacts_opened,
- SUM(artifacts_closed) AS artifacts_closed,
- SUM(tasks_opened) AS tasks_opened,
- SUM(tasks_closed) AS tasks_closed,
- SUM(help_requests) AS help_requests,
- SUM(cvs_checkouts) AS cvs_checkouts,
- SUM(cvs_commits) AS cvs_commits,
- SUM(cvs_adds) AS cvs_adds
- FROM stats_project_months
- GROUP BY group_id;
-
-CREATE VIEW stats_site_vw AS
-SELECT p.month,
- p.day,
- sspbd.site_page_views,
- SUM(p.downloads) AS downloads,
- SUM(p.subdomain_views) AS subdomain_views,
- SUM(p.msg_posted) AS msg_posted,
- SUM(p.bugs_opened) AS bugs_opened,
- SUM(p.bugs_closed) AS bugs_closed,
- SUM(p.support_opened) AS support_opened,
- SUM(p.support_closed) AS support_closed,
- SUM(p.patches_opened) AS patches_opened,
- SUM(p.patches_closed) AS patches_closed,
- SUM(artifacts_opened) AS artifacts_opened,
- SUM(artifacts_closed) AS artifacts_closed,
- SUM(p.tasks_opened) AS tasks_opened,
- SUM(p.tasks_closed) AS tasks_closed,
- SUM(p.help_requests) AS help_requests,
- SUM(p.cvs_checkouts) AS cvs_checkouts,
- SUM(p.cvs_commits) AS cvs_commits,
- SUM(p.cvs_adds) AS cvs_adds
- FROM stats_project_vw p, stats_site_pages_by_day sspbd
- WHERE p.month=sspbd.month AND p.day=sspbd.day
- GROUP BY p.month, p.day, sspbd.site_page_views;
-
-
-CREATE VIEW stats_site_all_vw AS
-SELECT
- SUM(site_page_views) AS site_page_views,
- SUM(downloads) AS downloads,
- SUM(subdomain_views) AS subdomain_views,
- SUM(msg_posted) AS msg_posted,
- SUM(bugs_opened) AS bugs_opened,
- SUM(bugs_closed) AS bugs_closed,
- SUM(support_opened) AS support_opened,
- SUM(support_closed) AS support_closed,
- SUM(patches_opened) AS patches_opened,
- SUM(patches_closed) AS patches_closed,
- SUM(artifacts_opened) AS artifacts_opened,
- SUM(artifacts_closed) AS artifacts_closed,
- SUM(tasks_opened) AS tasks_opened,
- SUM(tasks_closed) AS tasks_closed,
- SUM(help_requests) AS help_requests,
- SUM(cvs_checkouts) AS cvs_checkouts,
- SUM(cvs_commits) AS cvs_commits,
- SUM(cvs_adds) AS cvs_adds
- FROM stats_site_months;
Copied: branches/Branch_4_8/gforge/db/20050224-1-drop.sql (from rev 7730, branches/Branch_4_8/gforge/db/20050224-drop.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050224-1-drop.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050224-1-drop.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,8 @@
+DROP INDEX docdata_groupid;
+DROP INDEX forumperm_useridgroupforumid;
+ALTER TABLE forum_perm DROP CONSTRAINT forum_perm_id_key;
+DROP INDEX forumperm_groupforumiduserid;
+DROP INDEX group_cvs_history_id_key;
+ALTER TABLE project_perm DROP CONSTRAINT project_perm_id_key;
+DROP INDEX projecttaskartifact_projecttask;
+DROP INDEX supported_langu_language_id_key;
Property changes on: branches/Branch_4_8/gforge/db/20050224-1-drop.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20050224-2.sql (from rev 7730, branches/Branch_4_8/gforge/db/20050224.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050224-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050224-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,302 @@
+CREATE INDEX artifactextrafldlmts_extrafieldid ON
+artifact_extra_field_elements(extra_field_id);
+
+CREATE INDEX artifactextrafielddata_artifactid ON
+artifact_extra_field_data(artifact_id);
+
+CREATE INDEX artifactextrafieldlist_groupartid ON
+artifact_extra_field_list(group_artifact_id);
+
+CREATE INDEX docdata_groupid ON doc_data (group_id,doc_group);
+
+CREATE SEQUENCE artifact_extra_field_elements_element_id_seq;
+ALTER TABLE artifact_extra_field_elements ALTER COLUMN
+ element_id SET DEFAULT nextval('artifact_extra_field_elements_element_id_seq');
+DROP SEQUENCE artifact_group_selection_box_options_id_seq;
+SELECT setval('artifact_extra_field_elements_element_id_seq',(SELECT
+max(element_id) FROM artifact_extra_field_elements));
+
+CREATE SEQUENCE artifact_extra_field_data_data_id_seq;
+ALTER TABLE artifact_extra_field_data ALTER COLUMN
+ data_id SET DEFAULT nextval('artifact_extra_field_data_data_id_seq');
+SELECT setval('artifact_extra_field_data_data_id_seq',(SELECT
+max(data_id) FROM artifact_extra_field_data));
+DROP SEQUENCE artifact_extra_field_data_id_seq;
+
+CREATE SEQUENCE artifact_extra_field_list_extra_field_id_seq;
+ALTER TABLE artifact_extra_field_list ALTER COLUMN
+ extra_field_id SET DEFAULT nextval('artifact_extra_field_list_extra_field_id_seq');
+SELECT setval('artifact_extra_field_list_extra_field_id_seq',(SELECT
+max(extra_field_id) FROM artifact_extra_field_list));
+DROP SEQUENCE artifact_group_selection_box_list_id_seq;
+
+
+ALTER TABLE artifact_counts_agg ADD CONSTRAINT
+ artifact_counts_agg_pkey primary key (group_artifact_id);
+DROP INDEX artifactcountsagg_groupartid;
+
+
+ALTER TABLE artifact_extra_field_elements DROP CONSTRAINT
+ artifact_group_selection_box_options_pkey;
+ALTER TABLE artifact_extra_field_elements ADD CONSTRAINT
+ artifact_extra_field_elements_pkey primary key (element_id);
+
+
+ALTER TABLE artifact_extra_field_list DROP CONSTRAINT
+ artifact_group_selection_box_list_pkey;
+ALTER TABLE artifact_extra_field_list ADD CONSTRAINT
+ artifact_extra_field_list_pkey primary key (extra_field_id);
+
+DROP INDEX artfile_artid;
+
+DROP INDEX artgrouplist_groupid;
+
+DROP INDEX arthistory_artid;
+
+DROP INDEX artmessage_artid;
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE artifact_monitor DROP CONSTRAINT artifact_monitor_pkey;
+DROP INDEX artmonitor_artifactid;
+ALTER TABLE artifact_monitor ADD CONSTRAINT artifact_monitor_pkey PRIMARY KEY (artifact_id,user_id);
+CREATE INDEX artmonitor_useridartid ON artifact_monitor(user_id,artifact_id);
+
+DROP INDEX artperm_groupartifactid;
+
+CREATE INDEX cronhist_jobrundate ON cron_history(job,rundate);
+
+DROP INDEX doc_group_doc_group;
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE filemodule_monitor DROP CONSTRAINT filemodule_monitor_pkey;
+DROP INDEX filemodule_monitor_id;
+DROP INDEX filemodulemonitor_userid;
+ALTER TABLE filemodule_monitor ADD CONSTRAINT filemodule_monitor_pkey PRIMARY KEY (filemodule_id,user_id);
+CREATE INDEX filemodulemonitor_useridfilemoduleid ON filemodule_monitor (user_id,filemodule_id);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE forum_monitored_forums DROP CONSTRAINT forum_monitored_forums_pkey;
+DROP INDEX forum_monitor_combo_id;
+DROP INDEX forum_monitor_thread_id;
+DROP INDEX forummonitoredforums_user;
+ALTER TABLE forum_monitored_forums ADD CONSTRAINT forum_monitored_forums_pkey PRIMARY KEY (forum_id,user_id);
+CREATE INDEX forummonitoredforums_useridforumid ON forum_monitored_forums(user_id,forum_id);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE forum_perm DROP CONSTRAINT 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);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE forum_saved_place DROP CONSTRAINT forum_saved_place_pkey;
+ALTER TABLE forum_saved_place ADD CONSTRAINT
+ forum_saved_place_pkey PRIMARY KEY (user_id,forum_id);
+
+DROP INDEX frsdlfiletotal_fileid;
+ALTER TABLE frs_dlstats_filetotal_agg DROP CONSTRAINT frs_dlstats_filetotal_agg_pkey;
+ALTER TABLE frs_dlstats_filetotal_agg ADD CONSTRAINT
+ frs_dlstats_filetotal_agg_pkey PRIMARY KEY (file_id);
+
+--
+-- TODO investigate if group_plugin_id is needed at all
+--
+CREATE INDEX groupplugin_groupid ON group_plugin(group_id);
+
+ALTER TABLE licenses DROP CONSTRAINT licenses_license_id_key CASCADE;
+ALTER TABLE licenses ADD CONSTRAINT licenses_pkey PRIMARY KEY (license_id);
+--groups fkey is dropped BY CASCADE
+--"groups_license" FOREIGN KEY (license) REFERENCES licenses(license_id) MATCH FULL
+ALTER TABLE groups ADD CONSTRAINT groups_license
+ FOREIGN KEY (license) REFERENCES licenses(license_id) MATCH FULL;
+
+CREATE INDEX prdbdbs_groupid ON prdb_dbs(group_id);
+CREATE INDEX prdbstates_stateid ON prdb_states(stateid);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE project_assigned_to DROP CONSTRAINT project_assigned_to_pkey;
+DROP INDEX project_assigned_to_assigned_to;
+DROP INDEX project_assigned_to_task_id;
+--mop up duplicate ids
+DELETE FROM project_assigned_to WHERE EXISTS (
+SELECT * FROM (SELECT project_task_id,assigned_to_id,count(*) AS count FROM project_assigned_to
+ GROUP BY project_task_id,assigned_to_id ORDER BY count) ta WHERE ta.count > 1
+ AND ta.project_task_id=project_assigned_to.project_task_id);
+ALTER TABLE project_assigned_to ADD CONSTRAINT
+ project_assigned_to_pkey PRIMARY KEY (project_task_id,assigned_to_id);
+CREATE INDEX projectassigned_assignedtotaskid ON
+ project_assigned_to(assigned_to_id,project_task_id);
+
+ALTER TABLE project_counts_agg ADD CONSTRAINT
+ project_counts_agg_pkey PRIMARY KEY (group_project_id);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE project_dependencies DROP CONSTRAINT project_dependencies_pkey;
+DROP INDEX project_dependencies_task_id;
+DROP INDEX project_is_dependent_on_task_id;
+ALTER TABLE project_dependencies ALTER COLUMN link_type SET DEFAULT 'FS';
+--mop up duplicate ids
+DELETE FROM project_dependencies WHERE EXISTS (
+SELECT * FROM (SELECT project_task_id,is_dependent_on_task_id,count(*) AS count
+ FROM project_dependencies
+ GROUP BY project_task_id,is_dependent_on_task_id ORDER BY count) ta WHERE ta.count > 1
+ AND ta.project_task_id=project_dependencies.project_task_id
+ AND ta.is_dependent_on_task_id=project_dependencies.is_dependent_on_task_id);
+ALTER TABLE project_dependencies ADD CONSTRAINT project_dependencies_pkey
+ PRIMARY KEY(project_task_id,is_dependent_on_task_id);
+CREATE INDEX projectdep_isdepon_projtaskid ON
+ project_dependencies(is_dependent_on_task_id,project_task_id);
+
+DROP TABLE project_group_doccat;
+DROP TABLE project_group_forum;
+
+CREATE INDEX projectmsgs_projtaskidpostdate ON project_messages(project_task_id,postdate);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE project_perm DROP CONSTRAINT 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);
+
+
+DROP INDEX projectsumsagg_groupid;
+--MAY HAVE TO RUN db_project_sums.php cronjob first
+ALTER TABLE project_sums_agg ALTER type SET NOT NULL;
+DELETE FROM project_sums_agg;
+ALTER TABLE project_sums_agg ADD CONSTRAINT project_sums_agg_pkey PRIMARY KEY (group_id,type);
+
+DROP INDEX project_task_group_project_id;
+
+DROP INDEX projecttaskartifact_artifactid;
+ALTER TABLE project_task_artifact ALTER project_task_id SET NOT NULL;
+ALTER TABLE project_task_artifact ALTER artifact_id SET NOT NULL;
+ALTER TABLE project_task_artifact ADD CONSTRAINT
+ project_task_artifact_pkey PRIMARY KEY (project_task_id,artifact_id);
+CREATE INDEX projecttaskartifact_artidprojtaskid ON
+ project_task_artifact(artifact_id,project_task_id);
+
+DROP INDEX projecttaskexternal_projtaskid;
+ALTER TABLE project_task_external_order ADD CONSTRAINT
+ roject_task_external_order_pkey PRIMARY KEY (project_task_id);
+
+--UNKNOWN IF CORRECT: project_weekly_metric
+--UNKNOWN IF CORRECT: prweb_vhost
+
+ALTER TABLE role DROP CONSTRAINT role_role_id_key CASCADE;
+--NOTICE: drop cascades to constraint usergroup_roleid on table user_group
+--NOTICE: drop cascades to constraint $1 on table role_setting
+ALTER TABLE role ADD CONSTRAINT role_role_id_pkey PRIMARY KEY (role_id);
+ALTER TABLE user_group ADD CONSTRAINT usergroup_roleid
+ FOREIGN KEY (role_id) REFERENCES role(role_id) MATCH FULL;
+ALTER TABLE role_setting ADD CONSTRAINT rolesetting_roleroleid
+ FOREIGN KEY (role_id) REFERENCES role(role_id) ON DELETE CASCADE;
+
+DROP INDEX rolesetting_roleidsectionid;
+ALTER TABLE role_setting ADD CONSTRAINT role_setting_pkey
+ PRIMARY KEY (role_id,section_name,ref_id);
+
+--skills_data ignored - to be dropped
+--stats tables ignored - to be dropped
+
+CREATE UNIQUE INDEX supportedlanguage_code ON supported_languages(language_code);
+--TODO DROP supported_languages.filename
+
+--NEED TO BE INVESTIGATED MORE THOROUGHLY
+-- public | survey_questions | table | tperdue
+-- public | survey_rating_aggregate | table | tperdue
+-- public | survey_rating_response | table | tperdue
+-- public | survey_responses | table | tperdue
+DROP INDEX survey_responses_user_survey;
+
+DROP INDEX troveagg_trovecatid;
+--trove_agg - what is this?
+DROP INDEX parent_idx;
+CREATE INDEX trovecat_parentid ON trove_cat(parent);
+DROP INDEX version_idx;
+DROP INDEX root_parent_idx;
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE trove_group_link DROP CONSTRAINT trove_group_link_pkey;
+DROP INDEX trove_group_link_cat_id;
+DROP INDEX trove_group_link_group_id;
+CREATE INDEX trovegrouplink_groupidcatid ON trove_group_link(group_id,trove_cat_id);
+ALTER TABLE trove_group_link ADD CONSTRAINT
+ trove_group_link_pkey PRIMARY KEY(trove_cat_id,group_id,trove_cat_version);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE trove_treesums DROP CONSTRAINT trove_treesums_pkey;
+ALTER TABLE trove_treesums ADD CONSTRAINT trove_treesums_pkey PRIMARY KEY (trove_cat_id);
+
+DROP INDEX user_diary_user;
+DROP INDEX user_diary_date;
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE user_diary_monitor DROP CONSTRAINT user_diary_monitor_pkey;
+DROP INDEX user_diary_monitor_monitored_us;
+DROP INDEX user_diary_monitor_user;
+ALTER TABLE user_diary_monitor ADD CONSTRAINT
+ user_diary_monitor_pkey PRIMARY KEY (monitored_user,user_id);
+CREATE INDEX userdiarymon_useridmonitoredid ON
+ user_diary_monitor(user_id,monitored_user);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+DROP INDEX admin_flags_idx;
+DROP INDEX forum_flags_idx;
+DROP INDEX project_flags_idx;
+DROP INDEX user_group_group_id;
+DROP INDEX user_group_user_id;
+ALTER TABLE user_group DROP CONSTRAINT user_group_pkey;
+ALTER TABLE user_group ADD CONSTRAINT user_group_pkey PRIMARY KEY (group_id,user_id);
+CREATE INDEX usergroup_useridgroupid ON user_group(user_id,group_id);
+DROP INDEX usergroup_uniq_groupid_userid;
+
+CREATE UNIQUE INDEX usermetric_userid ON user_metric(user_id);
+
+CREATE INDEX usermetrichistory_useridmonthday ON user_metric_history(user_id,month,day);
+DROP INDEX user_metric_history_date_userid;
+ALTER TABLE user_metric_history ADD CONSTRAINT
+ user_metric_history_pkey PRIMARY KEY (month,day,user_id);
+
+--
+-- TODO DROP unnecessary sequence/id
+--
+ALTER TABLE user_plugin DROP CONSTRAINT user_plugin_pkey;
+ALTER TABLE user_plugin ALTER user_id SET NOT NULL;
+ALTER TABLE user_plugin ALTER plugin_id SET NOT NULL;
+ALTER TABLE user_plugin ADD CONSTRAINT user_plugin_pkey PRIMARY KEY (user_id,plugin_id);
+
+
+DROP INDEX user_pref_user_id;
+ALTER TABLE user_preferences ALTER user_id SET NOT NULL;
+ALTER TABLE user_preferences ALTER preference_name SET NOT NULL;
+ALTER TABLE user_preferences ADD CONSTRAINT
+ user_preferences_pkey PRIMARY KEY (user_id,preference_name);
+
+DROP INDEX user_ratings_rated_by;
+ALTER TABLE user_ratings ADD CONSTRAINT user_ratings_pkey PRIMARY KEY (rated_by,user_id,rate_field);
+
+DROP INDEX users_user_pw;
+
Property changes on: branches/Branch_4_8/gforge/db/20050224-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20050224-drop.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050224-drop.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050224-drop.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,6 +0,0 @@
-DROP INDEX docdata_groupid;
-DROP INDEX forumperm_useridgroupforumid;
-DROP INDEX forumperm_groupforumiduserid;
-DROP INDEX group_cvs_history_id_key;
-DROP INDEX projecttaskartifact_projecttask;
-DROP INDEX supported_langu_language_id_key;
Deleted: branches/Branch_4_8/gforge/db/20050224.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050224.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050224.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,304 +0,0 @@
-CREATE INDEX artifactextrafldlmts_extrafieldid ON
-artifact_extra_field_elements(extra_field_id);
-
-CREATE INDEX artifactextrafielddata_artifactid ON
-artifact_extra_field_data(artifact_id);
-
-CREATE INDEX artifactextrafieldlist_groupartid ON
-artifact_extra_field_list(group_artifact_id);
-
-CREATE INDEX docdata_groupid ON doc_data (group_id,doc_group);
-
-CREATE SEQUENCE artifact_extra_field_elements_element_id_seq;
-ALTER TABLE artifact_extra_field_elements ALTER COLUMN
- element_id SET DEFAULT nextval('artifact_extra_field_elements_element_id_seq');
-DROP SEQUENCE artifact_group_selection_box_options_id_seq;
-SELECT setval('artifact_extra_field_elements_element_id_seq',(SELECT
-max(element_id) FROM artifact_extra_field_elements));
-
-CREATE SEQUENCE artifact_extra_field_data_data_id_seq;
-ALTER TABLE artifact_extra_field_data ALTER COLUMN
- data_id SET DEFAULT nextval('artifact_extra_field_data_data_id_seq');
-SELECT setval('artifact_extra_field_data_data_id_seq',(SELECT
-max(data_id) FROM artifact_extra_field_data));
-DROP SEQUENCE artifact_extra_field_data_id_seq;
-
-CREATE SEQUENCE artifact_extra_field_list_extra_field_id_seq;
-ALTER TABLE artifact_extra_field_list ALTER COLUMN
- extra_field_id SET DEFAULT nextval('artifact_extra_field_list_extra_field_id_seq');
-SELECT setval('artifact_extra_field_list_extra_field_id_seq',(SELECT
-max(extra_field_id) FROM artifact_extra_field_list));
-DROP SEQUENCE artifact_group_selection_box_list_id_seq;
-
-
-ALTER TABLE artifact_counts_agg ADD CONSTRAINT
- artifact_counts_agg_pkey primary key (group_artifact_id);
-DROP INDEX artifactcountsagg_groupartid;
-
-
-ALTER TABLE artifact_extra_field_elements DROP CONSTRAINT
- artifact_group_selection_box_options_pkey;
-ALTER TABLE artifact_extra_field_elements ADD CONSTRAINT
- artifact_extra_field_elements_pkey primary key (element_id);
-
-
-ALTER TABLE artifact_extra_field_list DROP CONSTRAINT
- artifact_group_selection_box_list_pkey;
-ALTER TABLE artifact_extra_field_list ADD CONSTRAINT
- artifact_extra_field_list_pkey primary key (extra_field_id);
-
-DROP INDEX artfile_artid;
-
-DROP INDEX artgrouplist_groupid;
-
-DROP INDEX arthistory_artid;
-
-DROP INDEX artmessage_artid;
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE artifact_monitor DROP CONSTRAINT artifact_monitor_pkey;
-DROP INDEX artmonitor_artifactid;
-ALTER TABLE artifact_monitor ADD CONSTRAINT artifact_monitor_pkey PRIMARY KEY (artifact_id,user_id);
-CREATE INDEX artmonitor_useridartid ON artifact_monitor(user_id,artifact_id);
-
-DROP INDEX artperm_groupartifactid;
-
-CREATE INDEX cronhist_jobrundate ON cron_history(job,rundate);
-
-DROP INDEX doc_group_doc_group;
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE filemodule_monitor DROP CONSTRAINT filemodule_monitor_pkey;
-DROP INDEX filemodule_monitor_id;
-DROP INDEX filemodulemonitor_userid;
-ALTER TABLE filemodule_monitor ADD CONSTRAINT filemodule_monitor_pkey PRIMARY KEY (filemodule_id,user_id);
-CREATE INDEX filemodulemonitor_useridfilemoduleid ON filemodule_monitor (user_id,filemodule_id);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE forum_monitored_forums DROP CONSTRAINT forum_monitored_forums_pkey;
-DROP INDEX forum_monitor_combo_id;
-DROP INDEX forum_monitor_thread_id;
-DROP INDEX forummonitoredforums_user;
-ALTER TABLE forum_monitored_forums ADD CONSTRAINT forum_monitored_forums_pkey PRIMARY KEY (forum_id,user_id);
-CREATE INDEX forummonitoredforums_useridforumid ON forum_monitored_forums(user_id,forum_id);
-
---
--- 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);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE forum_saved_place DROP CONSTRAINT forum_saved_place_pkey;
-ALTER TABLE forum_saved_place ADD CONSTRAINT
- forum_saved_place_pkey PRIMARY KEY (user_id,forum_id);
-
-DROP INDEX frsdlfiletotal_fileid;
-ALTER TABLE frs_dlstats_filetotal_agg DROP CONSTRAINT frs_dlstats_filetotal_agg_pkey;
-ALTER TABLE frs_dlstats_filetotal_agg ADD CONSTRAINT
- frs_dlstats_filetotal_agg_pkey PRIMARY KEY (file_id);
-
---
--- TODO investigate if group_plugin_id is needed at all
---
-CREATE INDEX groupplugin_groupid ON group_plugin(group_id);
-
-ALTER TABLE licenses DROP CONSTRAINT licenses_license_id_key CASCADE;
-ALTER TABLE licenses ADD CONSTRAINT licenses_pkey PRIMARY KEY (license_id);
---groups fkey is dropped BY CASCADE
---"groups_license" FOREIGN KEY (license) REFERENCES licenses(license_id) MATCH FULL
-ALTER TABLE groups ADD CONSTRAINT groups_license
- FOREIGN KEY (license) REFERENCES licenses(license_id) MATCH FULL;
-
-CREATE INDEX prdbdbs_groupid ON prdb_dbs(group_id);
-CREATE INDEX prdbstates_stateid ON prdb_states(stateid);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE project_assigned_to DROP CONSTRAINT project_assigned_to_pkey;
-DROP INDEX project_assigned_to_assigned_to;
-DROP INDEX project_assigned_to_task_id;
---mop up duplicate ids
-DELETE FROM project_assigned_to WHERE EXISTS (
-SELECT * FROM (SELECT project_task_id,assigned_to_id,count(*) AS count FROM project_assigned_to
- GROUP BY project_task_id,assigned_to_id ORDER BY count) ta WHERE ta.count > 1
- AND ta.project_task_id=project_assigned_to.project_task_id);
-ALTER TABLE project_assigned_to ADD CONSTRAINT
- project_assigned_to_pkey PRIMARY KEY (project_task_id,assigned_to_id);
-CREATE INDEX projectassigned_assignedtotaskid ON
- project_assigned_to(assigned_to_id,project_task_id);
-
-ALTER TABLE project_counts_agg ADD CONSTRAINT
- project_counts_agg_pkey PRIMARY KEY (group_project_id);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE project_dependencies DROP CONSTRAINT project_dependencies_pkey;
-DROP INDEX project_dependencies_task_id;
-DROP INDEX project_is_dependent_on_task_id;
-ALTER TABLE project_dependencies ALTER COLUMN link_type SET DEFAULT 'FS';
---mop up duplicate ids
-DELETE FROM project_dependencies WHERE EXISTS (
-SELECT * FROM (SELECT project_task_id,is_dependent_on_task_id,count(*) AS count
- FROM project_dependencies
- GROUP BY project_task_id,is_dependent_on_task_id ORDER BY count) ta WHERE ta.count > 1
- AND ta.project_task_id=project_dependencies.project_task_id
- AND ta.is_dependent_on_task_id=project_dependencies.is_dependent_on_task_id);
-ALTER TABLE project_dependencies ADD CONSTRAINT project_dependencies_pkey
- PRIMARY KEY(project_task_id,is_dependent_on_task_id);
-CREATE INDEX projectdep_isdepon_projtaskid ON
- project_dependencies(is_dependent_on_task_id,project_task_id);
-
-DROP TABLE project_group_doccat;
-DROP TABLE project_group_forum;
-
-CREATE INDEX projectmsgs_projtaskidpostdate ON project_messages(project_task_id,postdate);
-
---
--- 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);
-
-
-DROP INDEX projectsumsagg_groupid;
---MAY HAVE TO RUN db_project_sums.php cronjob first
-ALTER TABLE project_sums_agg ALTER type SET NOT NULL;
-DELETE FROM project_sums_agg;
-ALTER TABLE project_sums_agg ADD CONSTRAINT project_sums_agg_pkey PRIMARY KEY (group_id,type);
-
-DROP INDEX project_task_group_project_id;
-
-DROP INDEX projecttaskartifact_artifactid;
-ALTER TABLE project_task_artifact ALTER project_task_id SET NOT NULL;
-ALTER TABLE project_task_artifact ALTER artifact_id SET NOT NULL;
-ALTER TABLE project_task_artifact ADD CONSTRAINT
- project_task_artifact_pkey PRIMARY KEY (project_task_id,artifact_id);
-CREATE INDEX projecttaskartifact_artidprojtaskid ON
- project_task_artifact(artifact_id,project_task_id);
-
-DROP INDEX projecttaskexternal_projtaskid;
-ALTER TABLE project_task_external_order ADD CONSTRAINT
- roject_task_external_order_pkey PRIMARY KEY (project_task_id);
-
---UNKNOWN IF CORRECT: project_weekly_metric
---UNKNOWN IF CORRECT: prweb_vhost
-
-ALTER TABLE role DROP CONSTRAINT role_role_id_key CASCADE;
---NOTICE: drop cascades to constraint usergroup_roleid on table user_group
---NOTICE: drop cascades to constraint $1 on table role_setting
-ALTER TABLE role ADD CONSTRAINT role_role_id_pkey PRIMARY KEY (role_id);
-ALTER TABLE user_group ADD CONSTRAINT usergroup_roleid
- FOREIGN KEY (role_id) REFERENCES role(role_id) MATCH FULL;
-ALTER TABLE role_setting ADD CONSTRAINT rolesetting_roleroleid
- FOREIGN KEY (role_id) REFERENCES role(role_id) ON DELETE CASCADE;
-
-DROP INDEX rolesetting_roleidsectionid;
-ALTER TABLE role_setting ADD CONSTRAINT role_setting_pkey
- PRIMARY KEY (role_id,section_name,ref_id);
-
---skills_data ignored - to be dropped
---stats tables ignored - to be dropped
-
-CREATE UNIQUE INDEX supportedlanguage_code ON supported_languages(language_code);
---TODO DROP supported_languages.filename
-
---NEED TO BE INVESTIGATED MORE THOROUGHLY
--- public | survey_questions | table | tperdue
--- public | survey_rating_aggregate | table | tperdue
--- public | survey_rating_response | table | tperdue
--- public | survey_responses | table | tperdue
-DROP INDEX survey_responses_user_survey;
-
-DROP INDEX troveagg_trovecatid;
---trove_agg - what is this?
-DROP INDEX parent_idx;
-CREATE INDEX trovecat_parentid ON trove_cat(parent);
-DROP INDEX version_idx;
-DROP INDEX root_parent_idx;
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE trove_group_link DROP CONSTRAINT trove_group_link_pkey;
-DROP INDEX trove_group_link_cat_id;
-DROP INDEX trove_group_link_group_id;
-CREATE INDEX trovegrouplink_groupidcatid ON trove_group_link(group_id,trove_cat_id);
-ALTER TABLE trove_group_link ADD CONSTRAINT
- trove_group_link_pkey PRIMARY KEY(trove_cat_id,group_id,trove_cat_version);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE trove_treesums DROP CONSTRAINT trove_treesums_pkey;
-ALTER TABLE trove_treesums ADD CONSTRAINT trove_treesums_pkey PRIMARY KEY (trove_cat_id);
-
-DROP INDEX user_diary_user;
-DROP INDEX user_diary_date;
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE user_diary_monitor DROP CONSTRAINT user_diary_monitor_pkey;
-DROP INDEX user_diary_monitor_monitored_us;
-DROP INDEX user_diary_monitor_user;
-ALTER TABLE user_diary_monitor ADD CONSTRAINT
- user_diary_monitor_pkey PRIMARY KEY (monitored_user,user_id);
-CREATE INDEX userdiarymon_useridmonitoredid ON
- user_diary_monitor(user_id,monitored_user);
-
---
--- TODO DROP unnecessary sequence/id
---
-DROP INDEX admin_flags_idx;
-DROP INDEX forum_flags_idx;
-DROP INDEX project_flags_idx;
-DROP INDEX user_group_group_id;
-DROP INDEX user_group_user_id;
-ALTER TABLE user_group DROP CONSTRAINT user_group_pkey;
-ALTER TABLE user_group ADD CONSTRAINT user_group_pkey PRIMARY KEY (group_id,user_id);
-CREATE INDEX usergroup_useridgroupid ON user_group(user_id,group_id);
-DROP INDEX usergroup_uniq_groupid_userid;
-
-CREATE UNIQUE INDEX usermetric_userid ON user_metric(user_id);
-
-CREATE INDEX usermetrichistory_useridmonthday ON user_metric_history(user_id,month,day);
-DROP INDEX user_metric_history_date_userid;
-ALTER TABLE user_metric_history ADD CONSTRAINT
- user_metric_history_pkey PRIMARY KEY (month,day,user_id);
-
---
--- TODO DROP unnecessary sequence/id
---
-ALTER TABLE user_plugin DROP CONSTRAINT user_plugin_pkey;
-ALTER TABLE user_plugin ALTER user_id SET NOT NULL;
-ALTER TABLE user_plugin ALTER plugin_id SET NOT NULL;
-ALTER TABLE user_plugin ADD CONSTRAINT user_plugin_pkey PRIMARY KEY (user_id,plugin_id);
-
-
-DROP INDEX user_pref_user_id;
-ALTER TABLE user_preferences ALTER user_id SET NOT NULL;
-ALTER TABLE user_preferences ALTER preference_name SET NOT NULL;
-ALTER TABLE user_preferences ADD CONSTRAINT
- user_preferences_pkey PRIMARY KEY (user_id,preference_name);
-
-DROP INDEX user_ratings_rated_by;
-ALTER TABLE user_ratings ADD CONSTRAINT user_ratings_pkey PRIMARY KEY (rated_by,user_id,rate_field);
-
-DROP INDEX users_user_pw;
-
Deleted: branches/Branch_4_8/gforge/db/20050325-1.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-1.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050325-1.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,40 +0,0 @@
-ALTER TABLE artifact_extra_field_list ADD COLUMN is_required INT;
-UPDATE artifact_extra_field_list SET is_required=0;
-ALTER TABLE artifact_extra_field_list ALTER COLUMN is_required SET NOT NULL;
-ALTER TABLE artifact_extra_field_list ALTER COLUMN is_required SET DEFAULT 0;
-
-ALTER TABLE artifact_extra_field_elements ADD COLUMN status_id INT;
-UPDATE artifact_extra_field_elements SET status_id=0;
-ALTER TABLE artifact_extra_field_elements ALTER COLUMN status_id SET NOT NULL;
-ALTER TABLE artifact_extra_field_elements ALTER COLUMN status_id SET DEFAULT 0;
-
-ALTER TABLE artifact_group_list ADD COLUMN custom_status_field INT;
-UPDATE artifact_group_list SET custom_status_field=0;
-ALTER TABLE artifact_group_list ALTER COLUMN custom_status_field SET NOT NULL;
-ALTER TABLE artifact_group_list ALTER COLUMN custom_status_field SET DEFAULT 0;
-
-ALTER TABLE artifact_group_list ADD COLUMN custom_renderer TEXT;
-
-CREATE TABLE artifact_query (
- artifact_query_id SERIAL NOT NULL,
- group_artifact_id integer NOT NULL
- CONSTRAINT artquery_groupartid_fk REFERENCES artifact_group_list(group_artifact_id) ON DELETE CASCADE,
- user_id integer NOT NULL,
- query_name text NOT NULL,
- Constraint artifact_query_pkey Primary Key (artifact_query_id)
-);
-
-CREATE TABLE artifact_query_fields (
- artifact_query_id integer NOT NULL
- CONSTRAINT artqueryelmnt_artqueryid REFERENCES artifact_query(artifact_query_id) ON DELETE CASCADE,
- query_field_type text NOT NULL,
- query_field_id int NOT NULL,
- query_field_values text NOT NULL,
- Constraint artifact_query_elements_pkey Primary Key (artifact_query_id,query_field_type,query_field_id)
-);
-
-ALTER TABLE doc_groups ADD COLUMN parent_doc_group INTEGER;
-UPDATE doc_groups SET parent_doc_group=0;
-ALTER TABLE doc_groups ALTER COLUMN parent_doc_group SET NOT NULL;
-ALTER TABLE doc_groups ALTER COLUMN parent_doc_group SET DEFAULT 0;
-CREATE INDEX docgroups_parentdocgroup ON doc_groups(parent_doc_group);
Deleted: branches/Branch_4_8/gforge/db/20050325-2.php
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-2.php 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050325-2.php 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,248 +0,0 @@
-#! /usr/bin/php5
-<?php
-/**
- * GForge Extra Field Conversion Script
- *
- * Copyright 2004 GForge, LLC
- * http://gforge.org/
- *
- * This file is part of GForge.
- *
- * GForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GForge is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with GForge; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
- */
-
-require_once dirname(__FILE__).'/../www/env.inc.php';
-require_once $gfwww.'include/squal_pre.php';
-require_once $gfcommon.'tracker/ArtifactExtraField.class.php';
-require_once $gfcommon.'tracker/ArtifactExtraFieldElement.class.php';
-
-// First of all, try to create the "alias" field if it doesn't exist
-$res = db_query("SELECT alias FROM artifact_extra_field_list");
-if (!$res) { // error, the field doesn't exist
- $res = db_query("ALTER TABLE artifact_extra_field_list ADD COLUMN alias TEXT");
- if (!$res) {
- echo db_error();
- exit(16);
- }
-}
-
-//
-// Set up this script to run as the site admin
-//
-
-$res = db_query("SELECT user_id FROM user_group WHERE admin_flags='A' AND group_id='1'");
-
-if (!$res) {
- echo db_error();
- exit(1);
-}
-
-if (db_numrows($res) == 0) {
- // There are no Admins yet, aborting without failing
- echo "SUCCESS\n";
- exit(0);
-}
-
-$id=db_result($res,0,0);
-session_set_new($id);
-
-db_begin();
-
-$res=db_query("SELECT group_id,group_artifact_id,use_resolution FROM artifact_group_list");
-
-for ($i=0; $i<db_numrows($res); $i++) {
-
- $group_id=db_result($res,$i,'group_id');
- $gaid=db_result($res,$i,'group_artifact_id');
- $ur=db_result($res,$i,'use_resolution');
-
- $g = group_get_object($group_id);
- if (!$g || !is_object($g)) {
- echo "\nCould Not Get Group: $group_id";
- db_rollback();
- exit(2);
- }
-
- $at = new ArtifactType($g,$gaid);
- if (!$at || !is_object($at)) {
- echo "\nCould Not Get ArtifactType: $gaid";
- db_rollback();
- exit(3);
- }
- //
- // Convert ArtifactCategory To Extra Field
- //
- $aef=new ArtifactExtraField($at);
- $aef->create('Category',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
- $catbox_id=$aef->getID();
- if (!$catbox_id) {
- echo "\nCould Not Get New Category Box ID: $gaid ".$aef->getErrorMessage();
- db_rollback();
- exit(4);
- }
- $resc=db_query("SELECT * FROM artifact_category WHERE group_artifact_id='$gaid'");
- for ($j=0; $j<db_numrows($resc); $j++) {
- $cat_id=db_result($resc,$j,'id');
- $cat_name=addslashes(db_result($resc,$j,'category_name'));
- if (strlen($cat_name) < 1) {
- $cat_name='[empty]';
- }
-
- $efe=new ArtifactExtraFieldElement($aef);
- #DEBUG
- #$efe->create($cat_name);
- if (!$efe->create($cat_name)) {
- echo 'Group: '.$group_id.' Could not create category element: '.$cat_name.' '.$efe->getErrorMessage();
- db_rollback();
- exit(5);
- }
- $efe_id=$efe->getID();
-//echo 'Artifact Category: Group: '.$group_id;
-//print_r($efe->data_array);
- if (!$efe_id) {
- #DEBUG echo "\nDid Not Get efe_id";
- echo "\nDid Not Get efe_id (group_id: $group_id)";
- db_rollback();
- exit(5);
- }
- $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
- SELECT artifact_id,$efe_id,$catbox_id FROM artifact
- WHERE category_id='$cat_id' AND group_artifact_id='$gaid'");
- if (!$res2) {
- echo "Could Not Insert AEFD for category " . db_error();
- db_rollback();
- exit(6);
- }
- $res3=db_query("UPDATE artifact_history SET old_value='$cat_name',field_name='Category'
- WHERE old_value='$cat_id' AND field_name='category_id' AND artifact_id IN
- (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
- if (!$res3) {
- echo "Could Not update history category " . db_error();
- db_rollback();
- exit(7);
- }
- }
-
- //
- // Convert ArtifactGroup To Extra Field
- //
- $aef=new ArtifactExtraField($at);
- $aef->create('Group',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
- $groupbox_id=$aef->getID();
- if (!$groupbox_id) {
- echo "\nCould Not Get groupbox_id ".$aef->getErrorMessage();
- db_rollback();
- exit(8);
- }
- $resc=db_query("SELECT * FROM artifact_group WHERE group_artifact_id='$gaid'");
- for ($j=0; $j<db_numrows($resc); $j++) {
- $artgroup_id=db_result($resc,$j,'id');
- $group_name=addslashes(db_result($resc,$j,'group_name'));
- if (strlen($group_name) < 1) {
- $group_name='[empty]';
- }
-
- $efe=new ArtifactExtraFieldElement($aef);
- //$efe->create($group_name);
- if (!$efe->create($group_name)) {
- echo 'Group: '.$group_id.' Could not create group element: '.$group_name.' '.$efe->getErrorMessage();
- db_rollback();
- exit(5);
- }
-//echo 'Artifact Group: Group: '.$group_id;
-//print_r($efe->data_array);
- $efe_id=$efe->getID();
- if (!$efe_id) {
- echo "\nDid Not Get efe_id";
- db_rollback();
- exit(9);
- }
- $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
- SELECT artifact_id,$efe_id,$groupbox_id FROM artifact
- WHERE artifact_group_id='$artgroup_id' AND group_artifact_id='$gaid'");
- if (!$res2) {
- echo "Could Not Insert AEFD for artifactgroup " . db_error();
- db_rollback();
- exit(10);
- }
- $res3=db_query("UPDATE artifact_history SET old_value='$group_name',field_name='Group'
- WHERE old_value='$artgroup_id' AND field_name='artifact_group_id' AND artifact_id IN
- (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
- if (!$res3) {
- echo "Could Not update history artifactgroup " . db_error();
- db_rollback();
- exit(11);
- }
- }
-
- if ($ur) {
- //
- // Convert ArtifactResolution To Extra Field
- //
- $aef=new ArtifactExtraField($at);
- $aef->create('Resolution',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
- $resolutionbox_id=$aef->getID();
- if (!$resolutionbox_id) {
- echo "\nCould Not Get resolutionbox_id ".$aef->getErrorMessage();
- db_rollback();
- exit(12);
- }
- $resc=db_query("SELECT * FROM artifact_resolution");
- for ($j=0; $j<db_numrows($resc); $j++) {
- $resolution_id=db_result($resc,$j,'id');
- $resolution_name=addslashes(db_result($resc,$j,'resolution_name'));
- if (strlen($resolution_name) < 1) {
- $resolution_name='[empty]';
- }
- $efe=new ArtifactExtraFieldElement($aef);
- // $efe->create($resolution_name);
- if (!$efe->create($resolution_name)) {
- echo 'Group: '.$group_id.' Could not create resolution element: '.$resolution_name.' '.$efe->getErrorMessage();
- db_rollback();
- exit(5);
- }
-//echo 'Artifact Group: Group: '.$group_id;
-//print_r($efe->data_array);
- $efe_id=$efe->getID();
- if (!$efe_id) {
- echo "\nDid Not Get efe_id";
- db_rollback();
- exit(13);
- }
- $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
- SELECT artifact_id,$efe_id,$resolutionbox_id FROM artifact
- WHERE resolution_id='$resolution_id' AND group_artifact_id='$gaid'");
- if (!$res2) {
- echo "Could Not Insert AEFD for resolution " . db_error();
- db_rollback();
- exit(14);
- }
- $res3=db_query("UPDATE artifact_history SET old_value='$resolution_name',field_name='Resolution'
- WHERE old_value='$resolution_id' AND field_name='resolution_id' AND artifact_id IN
- (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
- if (!$res3) {
- echo "Could Not update history resolution " . db_error();
- db_rollback();
- exit(15);
- }
- }
- }
-}
-db_commit();
-
-
-echo "\nSUCCESS";
-
-?>
Copied: branches/Branch_4_8/gforge/db/20050325-2.sql (from rev 7727, branches/Branch_4_8/gforge/db/20050325-1.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050325-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,40 @@
+ALTER TABLE artifact_extra_field_list ADD COLUMN is_required INT;
+UPDATE artifact_extra_field_list SET is_required=0;
+ALTER TABLE artifact_extra_field_list ALTER COLUMN is_required SET NOT NULL;
+ALTER TABLE artifact_extra_field_list ALTER COLUMN is_required SET DEFAULT 0;
+
+ALTER TABLE artifact_extra_field_elements ADD COLUMN status_id INT;
+UPDATE artifact_extra_field_elements SET status_id=0;
+ALTER TABLE artifact_extra_field_elements ALTER COLUMN status_id SET NOT NULL;
+ALTER TABLE artifact_extra_field_elements ALTER COLUMN status_id SET DEFAULT 0;
+
+ALTER TABLE artifact_group_list ADD COLUMN custom_status_field INT;
+UPDATE artifact_group_list SET custom_status_field=0;
+ALTER TABLE artifact_group_list ALTER COLUMN custom_status_field SET NOT NULL;
+ALTER TABLE artifact_group_list ALTER COLUMN custom_status_field SET DEFAULT 0;
+
+ALTER TABLE artifact_group_list ADD COLUMN custom_renderer TEXT;
+
+CREATE TABLE artifact_query (
+ artifact_query_id SERIAL NOT NULL,
+ group_artifact_id integer NOT NULL
+ CONSTRAINT artquery_groupartid_fk REFERENCES artifact_group_list(group_artifact_id) ON DELETE CASCADE,
+ user_id integer NOT NULL,
+ query_name text NOT NULL,
+ Constraint artifact_query_pkey Primary Key (artifact_query_id)
+);
+
+CREATE TABLE artifact_query_fields (
+ artifact_query_id integer NOT NULL
+ CONSTRAINT artqueryelmnt_artqueryid REFERENCES artifact_query(artifact_query_id) ON DELETE CASCADE,
+ query_field_type text NOT NULL,
+ query_field_id int NOT NULL,
+ query_field_values text NOT NULL,
+ Constraint artifact_query_elements_pkey Primary Key (artifact_query_id,query_field_type,query_field_id)
+);
+
+ALTER TABLE doc_groups ADD COLUMN parent_doc_group INTEGER;
+UPDATE doc_groups SET parent_doc_group=0;
+ALTER TABLE doc_groups ALTER COLUMN parent_doc_group SET NOT NULL;
+ALTER TABLE doc_groups ALTER COLUMN parent_doc_group SET DEFAULT 0;
+CREATE INDEX docgroups_parentdocgroup ON doc_groups(parent_doc_group);
Property changes on: branches/Branch_4_8/gforge/db/20050325-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20050325-1.sql: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
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20050325-3-drop.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-3-drop.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050325-3-drop.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,2 +0,0 @@
-DROP VIEW artifact_group_list_vw;
-DROP VIEW artifact_vw;
Copied: branches/Branch_4_8/gforge/db/20050325-3.php (from rev 7729, branches/Branch_4_8/gforge/db/20050325-2.php)
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-3.php (rev 0)
+++ branches/Branch_4_8/gforge/db/20050325-3.php 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,248 @@
+#! /usr/bin/php5
+<?php
+/**
+ * GForge Extra Field Conversion Script
+ *
+ * Copyright 2004 GForge, LLC
+ * http://gforge.org/
+ *
+ * This file is part of GForge.
+ *
+ * GForge is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GForge; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US
+ */
+
+require_once dirname(__FILE__).'/../www/env.inc.php';
+require_once $gfwww.'include/squal_pre.php';
+require_once $gfcommon.'tracker/ArtifactExtraField.class.php';
+require_once $gfcommon.'tracker/ArtifactExtraFieldElement.class.php';
+
+// First of all, try to create the "alias" field if it doesn't exist
+$res = db_query("SELECT alias FROM artifact_extra_field_list");
+if (!$res) { // error, the field doesn't exist
+ $res = db_query("ALTER TABLE artifact_extra_field_list ADD COLUMN alias TEXT");
+ if (!$res) {
+ echo db_error();
+ exit(16);
+ }
+}
+
+//
+// Set up this script to run as the site admin
+//
+
+$res = db_query("SELECT user_id FROM user_group WHERE admin_flags='A' AND group_id='1'");
+
+if (!$res) {
+ echo db_error();
+ exit(1);
+}
+
+if (db_numrows($res) == 0) {
+ // There are no Admins yet, aborting without failing
+ echo "SUCCESS\n";
+ exit(0);
+}
+
+$id=db_result($res,0,0);
+session_set_new($id);
+
+db_begin();
+
+$res=db_query("SELECT group_id,group_artifact_id,use_resolution FROM artifact_group_list");
+
+for ($i=0; $i<db_numrows($res); $i++) {
+
+ $group_id=db_result($res,$i,'group_id');
+ $gaid=db_result($res,$i,'group_artifact_id');
+ $ur=db_result($res,$i,'use_resolution');
+
+ $g = group_get_object($group_id);
+ if (!$g || !is_object($g)) {
+ echo "\nCould Not Get Group: $group_id";
+ db_rollback();
+ exit(2);
+ }
+
+ $at = new ArtifactType($g,$gaid);
+ if (!$at || !is_object($at)) {
+ echo "\nCould Not Get ArtifactType: $gaid";
+ db_rollback();
+ exit(3);
+ }
+ //
+ // Convert ArtifactCategory To Extra Field
+ //
+ $aef=new ArtifactExtraField($at);
+ $aef->create('Category',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
+ $catbox_id=$aef->getID();
+ if (!$catbox_id) {
+ echo "\nCould Not Get New Category Box ID: $gaid ".$aef->getErrorMessage();
+ db_rollback();
+ exit(4);
+ }
+ $resc=db_query("SELECT * FROM artifact_category WHERE group_artifact_id='$gaid'");
+ for ($j=0; $j<db_numrows($resc); $j++) {
+ $cat_id=db_result($resc,$j,'id');
+ $cat_name=addslashes(db_result($resc,$j,'category_name'));
+ if (strlen($cat_name) < 1) {
+ $cat_name='[empty]';
+ }
+
+ $efe=new ArtifactExtraFieldElement($aef);
+ #DEBUG
+ #$efe->create($cat_name);
+ if (!$efe->create($cat_name)) {
+ echo 'Group: '.$group_id.' Could not create category element: '.$cat_name.' '.$efe->getErrorMessage();
+ db_rollback();
+ exit(5);
+ }
+ $efe_id=$efe->getID();
+//echo 'Artifact Category: Group: '.$group_id;
+//print_r($efe->data_array);
+ if (!$efe_id) {
+ #DEBUG echo "\nDid Not Get efe_id";
+ echo "\nDid Not Get efe_id (group_id: $group_id)";
+ db_rollback();
+ exit(5);
+ }
+ $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,$efe_id,$catbox_id FROM artifact
+ WHERE category_id='$cat_id' AND group_artifact_id='$gaid'");
+ if (!$res2) {
+ echo "Could Not Insert AEFD for category " . db_error();
+ db_rollback();
+ exit(6);
+ }
+ $res3=db_query("UPDATE artifact_history SET old_value='$cat_name',field_name='Category'
+ WHERE old_value='$cat_id' AND field_name='category_id' AND artifact_id IN
+ (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
+ if (!$res3) {
+ echo "Could Not update history category " . db_error();
+ db_rollback();
+ exit(7);
+ }
+ }
+
+ //
+ // Convert ArtifactGroup To Extra Field
+ //
+ $aef=new ArtifactExtraField($at);
+ $aef->create('Group',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
+ $groupbox_id=$aef->getID();
+ if (!$groupbox_id) {
+ echo "\nCould Not Get groupbox_id ".$aef->getErrorMessage();
+ db_rollback();
+ exit(8);
+ }
+ $resc=db_query("SELECT * FROM artifact_group WHERE group_artifact_id='$gaid'");
+ for ($j=0; $j<db_numrows($resc); $j++) {
+ $artgroup_id=db_result($resc,$j,'id');
+ $group_name=addslashes(db_result($resc,$j,'group_name'));
+ if (strlen($group_name) < 1) {
+ $group_name='[empty]';
+ }
+
+ $efe=new ArtifactExtraFieldElement($aef);
+ //$efe->create($group_name);
+ if (!$efe->create($group_name)) {
+ echo 'Group: '.$group_id.' Could not create group element: '.$group_name.' '.$efe->getErrorMessage();
+ db_rollback();
+ exit(5);
+ }
+//echo 'Artifact Group: Group: '.$group_id;
+//print_r($efe->data_array);
+ $efe_id=$efe->getID();
+ if (!$efe_id) {
+ echo "\nDid Not Get efe_id";
+ db_rollback();
+ exit(9);
+ }
+ $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,$efe_id,$groupbox_id FROM artifact
+ WHERE artifact_group_id='$artgroup_id' AND group_artifact_id='$gaid'");
+ if (!$res2) {
+ echo "Could Not Insert AEFD for artifactgroup " . db_error();
+ db_rollback();
+ exit(10);
+ }
+ $res3=db_query("UPDATE artifact_history SET old_value='$group_name',field_name='Group'
+ WHERE old_value='$artgroup_id' AND field_name='artifact_group_id' AND artifact_id IN
+ (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
+ if (!$res3) {
+ echo "Could Not update history artifactgroup " . db_error();
+ db_rollback();
+ exit(11);
+ }
+ }
+
+ if ($ur) {
+ //
+ // Convert ArtifactResolution To Extra Field
+ //
+ $aef=new ArtifactExtraField($at);
+ $aef->create('Resolution',ARTIFACT_EXTRAFIELDTYPE_SELECT,0,0);
+ $resolutionbox_id=$aef->getID();
+ if (!$resolutionbox_id) {
+ echo "\nCould Not Get resolutionbox_id ".$aef->getErrorMessage();
+ db_rollback();
+ exit(12);
+ }
+ $resc=db_query("SELECT * FROM artifact_resolution");
+ for ($j=0; $j<db_numrows($resc); $j++) {
+ $resolution_id=db_result($resc,$j,'id');
+ $resolution_name=addslashes(db_result($resc,$j,'resolution_name'));
+ if (strlen($resolution_name) < 1) {
+ $resolution_name='[empty]';
+ }
+ $efe=new ArtifactExtraFieldElement($aef);
+ // $efe->create($resolution_name);
+ if (!$efe->create($resolution_name)) {
+ echo 'Group: '.$group_id.' Could not create resolution element: '.$resolution_name.' '.$efe->getErrorMessage();
+ db_rollback();
+ exit(5);
+ }
+//echo 'Artifact Group: Group: '.$group_id;
+//print_r($efe->data_array);
+ $efe_id=$efe->getID();
+ if (!$efe_id) {
+ echo "\nDid Not Get efe_id";
+ db_rollback();
+ exit(13);
+ }
+ $res2=db_query("INSERT INTO artifact_extra_field_data (artifact_id,field_data,extra_field_id)
+ SELECT artifact_id,$efe_id,$resolutionbox_id FROM artifact
+ WHERE resolution_id='$resolution_id' AND group_artifact_id='$gaid'");
+ if (!$res2) {
+ echo "Could Not Insert AEFD for resolution " . db_error();
+ db_rollback();
+ exit(14);
+ }
+ $res3=db_query("UPDATE artifact_history SET old_value='$resolution_name',field_name='Resolution'
+ WHERE old_value='$resolution_id' AND field_name='resolution_id' AND artifact_id IN
+ (SELECT artifact_id FROM artifact WHERE group_artifact_id='$gaid')");
+ if (!$res3) {
+ echo "Could Not update history resolution " . db_error();
+ db_rollback();
+ exit(15);
+ }
+ }
+ }
+}
+db_commit();
+
+
+echo "\nSUCCESS";
+
+?>
Property changes on: branches/Branch_4_8/gforge/db/20050325-3.php
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20050325-3.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-3.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050325-3.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,42 +0,0 @@
-DROP TABLE artifact_category CASCADE;
-DROP TABLE artifact_group CASCADE;
-DROP TABLE artifact_resolution CASCADE;
-ALTER TABLE artifact DROP COLUMN artifact_group_id;
-ALTER TABLE artifact DROP COLUMN resolution_id;
-ALTER TABLE artifact DROP COLUMN category_id;
-ALTER TABLE artifact_group_list DROP COLUMN use_resolution CASCADE;
-
-CREATE VIEW artifact_group_list_vw AS
-SELECT agl.*,aca.count,aca.open_count
- FROM artifact_group_list agl
- LEFT JOIN artifact_counts_agg aca USING (group_artifact_id);
-
-CREATE VIEW artifact_vw
-AS
-SELECT artifact.artifact_id,
- artifact.group_artifact_id,
- artifact.status_id,
- artifact.priority,
- artifact.submitted_by,
- artifact.assigned_to,
- artifact.open_date,
- artifact.close_date,
- artifact.summary,
- artifact.details,
- u.user_name AS assigned_unixname,
- u.realname AS assigned_realname,
- u.email AS assigned_email,
- u2.user_name AS submitted_unixname,
- u2.realname AS submitted_realname,
- u2.email AS submitted_email,
- artifact_status.status_name,
- artifact.last_modified_date
-FROM users u,
- users u2,
- artifact_status,
- artifact
-WHERE artifact.assigned_to = u.user_id
-AND artifact.submitted_by = u2.user_id
-AND artifact.status_id = artifact_status.id;
-
-DELETE FROM user_preferences WHERE preference_name LIKE 'art_cust%';
Copied: branches/Branch_4_8/gforge/db/20050325-4-drop.sql (from rev 7727, branches/Branch_4_8/gforge/db/20050325-3-drop.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-4-drop.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050325-4-drop.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,2 @@
+DROP VIEW artifact_group_list_vw;
+DROP VIEW artifact_vw;
Property changes on: branches/Branch_4_8/gforge/db/20050325-4-drop.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20050325-3-drop.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20050325-5.sql (from rev 7727, branches/Branch_4_8/gforge/db/20050325-3.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050325-5.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050325-5.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,42 @@
+DROP TABLE artifact_category CASCADE;
+DROP TABLE artifact_group CASCADE;
+DROP TABLE artifact_resolution CASCADE;
+ALTER TABLE artifact DROP COLUMN artifact_group_id;
+ALTER TABLE artifact DROP COLUMN resolution_id;
+ALTER TABLE artifact DROP COLUMN category_id;
+ALTER TABLE artifact_group_list DROP COLUMN use_resolution CASCADE;
+
+CREATE VIEW artifact_group_list_vw AS
+SELECT agl.*,aca.count,aca.open_count
+ FROM artifact_group_list agl
+ LEFT JOIN artifact_counts_agg aca USING (group_artifact_id);
+
+CREATE VIEW artifact_vw
+AS
+SELECT artifact.artifact_id,
+ artifact.group_artifact_id,
+ artifact.status_id,
+ artifact.priority,
+ artifact.submitted_by,
+ artifact.assigned_to,
+ artifact.open_date,
+ artifact.close_date,
+ artifact.summary,
+ artifact.details,
+ u.user_name AS assigned_unixname,
+ u.realname AS assigned_realname,
+ u.email AS assigned_email,
+ u2.user_name AS submitted_unixname,
+ u2.realname AS submitted_realname,
+ u2.email AS submitted_email,
+ artifact_status.status_name,
+ artifact.last_modified_date
+FROM users u,
+ users u2,
+ artifact_status,
+ artifact
+WHERE artifact.assigned_to = u.user_id
+AND artifact.submitted_by = u2.user_id
+AND artifact.status_id = artifact_status.id;
+
+DELETE FROM user_preferences WHERE preference_name LIKE 'art_cust%';
Property changes on: branches/Branch_4_8/gforge/db/20050325-5.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20050325-3.sql: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
Added: svn:eol-style
+ native
Copied: branches/Branch_4_8/gforge/db/20050822-1-drops.sql (from rev 7727, branches/Branch_4_8/gforge/db/20050822-drops.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050822-1-drops.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050822-1-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,2 @@
+drop table forum_attachment;
+drop table forum_attachmenttype;
Property changes on: branches/Branch_4_8/gforge/db/20050822-1-drops.sql
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20050822-drops.sql: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
Copied: branches/Branch_4_8/gforge/db/20050822-2.sql (from rev 7730, branches/Branch_4_8/gforge/db/20050822.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20050822-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20050822-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,116 @@
+--
+-- Modification to forum table for bbcode support
+--
+
+alter table forum add bbcode_uid character varying(15);
+
+--
+-- forum_attachment
+--
+
+
+--
+-- Name: forum_attachment; Type: TABLE; Schema: public; Owner: gforge; Tablespace:
+--
+
+
+CREATE TABLE forum_attachment (
+ attachmentid serial NOT NULL,
+ userid integer DEFAULT 0 NOT NULL,
+ dateline integer DEFAULT 0 NOT NULL,
+ filename character varying(100) DEFAULT ''::character varying NOT NULL,
+ filedata text NOT NULL,
+ visible smallint DEFAULT (0)::smallint NOT NULL,
+ counter smallint DEFAULT (0)::smallint NOT NULL,
+ filesize integer DEFAULT 0 NOT NULL,
+ msg_id integer DEFAULT 0 NOT NULL,
+ filehash character varying(32) DEFAULT ''::character varying NOT NULL
+);
+
+
+
+--
+-- Name: filehash; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
+--
+
+ALTER TABLE ONLY forum_attachment
+ ADD CONSTRAINT filehash UNIQUE (filehash);
+
+
+
+--
+-- Name: forum_attachment_key; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
+--
+
+ALTER TABLE ONLY forum_attachment
+ ADD CONSTRAINT forum_attachment_key PRIMARY KEY (attachmentid);
+
+
+
+--
+-- Name: msg_id; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
+--
+
+ALTER TABLE ONLY forum_attachment
+ ADD CONSTRAINT msg_id UNIQUE (msg_id);
+
+
+
+--
+-- forum_attachmenttype
+--
+
+
+--
+-- Name: forum_attachmenttype; Type: TABLE; Schema: public; Owner: gforge; Tablespace:
+--
+
+
+CREATE TABLE forum_attachmenttype (
+ extension character varying(20) DEFAULT ''::character varying NOT NULL,
+ mimetype character varying(255) DEFAULT ''::character varying NOT NULL,
+ size integer DEFAULT 0 NOT NULL,
+ width smallint DEFAULT 0::smallint NOT NULL,
+ height smallint DEFAULT 0::smallint NOT NULL,
+ enabled smallint DEFAULT 1::smallint NOT NULL,
+ display smallint DEFAULT 0::smallint NOT NULL
+);
+
+
+
+--
+-- Data for Name: forum_attachmenttype; Type: TABLE DATA; Schema: public; Owner: gforge
+--
+
+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);
+
+
+--
+-- Name: forum_attachmenttype_key; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
+--
+
+ALTER TABLE ONLY forum_attachmenttype
+ ADD CONSTRAINT forum_attachmenttype_key PRIMARY KEY (extension);
+
+
+--
+-- change the views
+--
+
+DROP VIEW forum_user_vw;
+
+CREATE VIEW forum_user_vw AS
+ SELECT forum.msg_id, forum.group_forum_id, forum.posted_by, forum.subject, forum.body, forum.post_date, forum.is_followup_to, forum.thread_id, forum.has_followups, forum.most_recent_date,
+forum.bbcode_uid, users.user_name, users.realname FROM forum, users WHERE (forum.posted_by = users.user_id);
+
+
Property changes on: branches/Branch_4_8/gforge/db/20050822-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20050822-drops.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050822-drops.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050822-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,2 +0,0 @@
-drop table forum_attachment;
-drop table forum_attachmenttype;
Deleted: branches/Branch_4_8/gforge/db/20050822.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20050822.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20050822.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,116 +0,0 @@
---
--- Modification to forum table for bbcode support
---
-
-alter table forum add bbcode_uid character varying(15);
-
---
--- forum_attachment
---
-
-
---
--- Name: forum_attachment; Type: TABLE; Schema: public; Owner: gforge; Tablespace:
---
-
-
-CREATE TABLE forum_attachment (
- attachmentid serial NOT NULL,
- userid integer DEFAULT 0 NOT NULL,
- dateline integer DEFAULT 0 NOT NULL,
- filename character varying(100) DEFAULT ''::character varying NOT NULL,
- filedata text NOT NULL,
- visible smallint DEFAULT (0)::smallint NOT NULL,
- counter smallint DEFAULT (0)::smallint NOT NULL,
- filesize integer DEFAULT 0 NOT NULL,
- msg_id integer DEFAULT 0 NOT NULL,
- filehash character varying(32) DEFAULT ''::character varying NOT NULL
-);
-
-
-
---
--- Name: filehash; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
---
-
-ALTER TABLE ONLY forum_attachment
- ADD CONSTRAINT filehash UNIQUE (filehash);
-
-
-
---
--- Name: forum_attachment_key; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
---
-
-ALTER TABLE ONLY forum_attachment
- ADD CONSTRAINT forum_attachment_key PRIMARY KEY (attachmentid);
-
-
-
---
--- Name: msg_id; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
---
-
-ALTER TABLE ONLY forum_attachment
- ADD CONSTRAINT msg_id UNIQUE (msg_id);
-
-
-
---
--- forum_attachmenttype
---
-
-
---
--- Name: forum_attachmenttype; Type: TABLE; Schema: public; Owner: gforge; Tablespace:
---
-
-
-CREATE TABLE forum_attachmenttype (
- extension character varying(20) DEFAULT ''::character varying NOT NULL,
- mimetype character varying(255) DEFAULT ''::character varying NOT NULL,
- size integer DEFAULT 0 NOT NULL,
- width smallint DEFAULT 0::smallint NOT NULL,
- height smallint DEFAULT 0::smallint NOT NULL,
- enabled smallint DEFAULT 1::smallint NOT NULL,
- display smallint DEFAULT 0::smallint NOT NULL
-);
-
-
-
---
--- Data for Name: forum_attachmenttype; Type: TABLE DATA; Schema: public; Owner: gforge
---
-
-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);
-
-
---
--- Name: forum_attachmenttype_key; Type: CONSTRAINT; Schema: public; Owner: gforge; Tablespace:
---
-
-ALTER TABLE ONLY forum_attachmenttype
- ADD CONSTRAINT forum_attachmenttype_key PRIMARY KEY (extension);
-
-
---
--- change the views
---
-
-DROP VIEW forum_user_vw;
-
-CREATE VIEW forum_user_vw AS
- SELECT forum.msg_id, forum.group_forum_id, forum.posted_by, forum.subject, forum.body, forum.post_date, forum.is_followup_to, forum.thread_id, forum.has_followups, forum.most_recent_date,
-forum.bbcode_uid, users.user_name, users.realname FROM forum, users WHERE (forum.posted_by = users.user_id);
-
-
Copied: branches/Branch_4_8/gforge/db/20060216-1-drops.sql (from rev 7727, branches/Branch_4_8/gforge/db/20060216-drops.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20060216-1-drops.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20060216-1-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1 @@
+DROP VIEW activity_vw;
Property changes on: branches/Branch_4_8/gforge/db/20060216-1-drops.sql
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20060216-drops.sql: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
Copied: branches/Branch_4_8/gforge/db/20060216-2-debian-nocommit.sql (from rev 7727, branches/Branch_4_8/gforge/db/20060216-nocommit.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20060216-2-debian-nocommit.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20060216-2-debian-nocommit.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,38 @@
+
+CREATE VIEW activity_vw AS
+SELECT
+agl.group_id, 'trackeropen'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.open_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
+users u WHERE u.user_id=a.submitted_by
+UNION
+SELECT
+agl.group_id, 'trackerclose'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.close_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id), users u WHERE u.user_id=a.assigned_to
+--actually should join against
+AND a.close_date > 0
+UNION
+SELECT
+frsp.group_id, 'frsrelease'::text as section,frsp.package_id as ref_id,
+frsr.release_id as subref_id, frsr.name AS description, frsr.release_date AS activity_date,
+u.user_id, u.user_name, u.realname FROM frs_package frsp JOIN frs_release frsr USING (package_id), users u WHERE
+u.user_id=frsr.released_by
+UNION
+SELECT
+fgl.group_id, 'forumpost'::text as section,fgl.group_forum_id as ref_id, forum.msg_id
+as subref_id, forum.subject AS description, forum.post_date AS activity_date, u.user_id,
+u.user_name, u.realname FROM forum_group_list fgl JOIN forum USING (group_forum_id), users u WHERE
+u.user_id=forum.posted_by
+;
+
+CREATE TABLE group_activity_monitor (
+group_id int not null CONSTRAINT group_id REFERENCES groups(group_id) ON DELETE CASCADE,
+user_id int NOT NULL CONSTRAINT userid_fk REFERENCES users(user_id),
+filter text,
+PRIMARY KEY (group_id,user_id)
+);
+
+CREATE RULE groupactivity_userdelete_rule AS ON UPDATE TO USERS DO
+ DELETE FROM group_activity_monitor WHERE user_id =(CASE WHEN NEW.status='D'
+ THEN NEW.user_id ELSE 0 END);
Property changes on: branches/Branch_4_8/gforge/db/20060216-2-debian-nocommit.sql
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/Branch_4_7/gforge/db/20060216-nocommit.sql: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
Copied: branches/Branch_4_8/gforge/db/20060216-2.sql (from rev 7730, branches/Branch_4_8/gforge/db/20060216.sql)
===================================================================
--- branches/Branch_4_8/gforge/db/20060216-2.sql (rev 0)
+++ branches/Branch_4_8/gforge/db/20060216-2.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -0,0 +1,46 @@
+CREATE VIEW activity_vw AS
+SELECT
+agl.group_id, 'trackeropen'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.open_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
+users u WHERE u.user_id=a.submitted_by
+UNION
+SELECT
+agl.group_id, 'trackerclose'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, a.summary as description, a.close_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id), users u WHERE u.user_id=a.assigned_to
+--actually should join against
+AND a.close_date > 0
+UNION
+SELECT
+agl.group_id, 'commit'::text AS section, agl.group_artifact_id AS ref_id,
+a.artifact_id as subref_id, pcdm.log_text AS description, pcdm.cvs_date AS activity_date, u.user_id, u.user_name, u.realname
+FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
+plugin_cvstracker_data_master pcdm, plugin_cvstracker_data_artifact pcda, users u
+WHERE pcdm.holder_id=pcda.id
+AND pcda.group_artifact_id=a.artifact_id
+AND u.user_name=pcdm.author
+UNION
+SELECT
+frsp.group_id, 'frsrelease'::text as section,frsp.package_id as ref_id,
+frsr.release_id as subref_id, frsr.name AS description, frsr.release_date AS activity_date,
+u.user_id, u.user_name, u.realname FROM frs_package frsp JOIN frs_release frsr USING (package_id), users u WHERE
+u.user_id=frsr.released_by
+UNION
+SELECT
+fgl.group_id, 'forumpost'::text as section,fgl.group_forum_id as ref_id, forum.msg_id
+as subref_id, forum.subject AS description, forum.post_date AS activity_date, u.user_id,
+u.user_name, u.realname FROM forum_group_list fgl JOIN forum USING (group_forum_id), users u WHERE
+u.user_id=forum.posted_by
+;
+
+CREATE TABLE group_activity_monitor (
+group_id int not null CONSTRAINT group_id REFERENCES groups(group_id) ON DELETE CASCADE,
+user_id int NOT NULL CONSTRAINT userid_fk REFERENCES users(user_id),
+filter text,
+PRIMARY KEY (group_id,user_id)
+);
+
+CREATE RULE groupactivity_userdelete_rule AS ON UPDATE TO USERS DO
+ DELETE FROM group_activity_monitor WHERE user_id =(CASE WHEN NEW.status='D'
+ THEN NEW.user_id ELSE 0 END);
Property changes on: branches/Branch_4_8/gforge/db/20060216-2.sql
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:mergeinfo
+
Added: svn:eol-style
+ native
Deleted: branches/Branch_4_8/gforge/db/20060216-drops.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20060216-drops.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20060216-drops.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1 +0,0 @@
-DROP VIEW activity_vw;
Deleted: branches/Branch_4_8/gforge/db/20060216-nocommit.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20060216-nocommit.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20060216-nocommit.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,38 +0,0 @@
-
-CREATE VIEW activity_vw AS
-SELECT
-agl.group_id, 'trackeropen'::text AS section, agl.group_artifact_id AS ref_id,
-a.artifact_id as subref_id, a.summary as description, a.open_date AS activity_date, u.user_id, u.user_name, u.realname
-FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
-users u WHERE u.user_id=a.submitted_by
-UNION
-SELECT
-agl.group_id, 'trackerclose'::text AS section, agl.group_artifact_id AS ref_id,
-a.artifact_id as subref_id, a.summary as description, a.close_date AS activity_date, u.user_id, u.user_name, u.realname
-FROM artifact_group_list agl JOIN artifact a using (group_artifact_id), users u WHERE u.user_id=a.assigned_to
---actually should join against
-AND a.close_date > 0
-UNION
-SELECT
-frsp.group_id, 'frsrelease'::text as section,frsp.package_id as ref_id,
-frsr.release_id as subref_id, frsr.name AS description, frsr.release_date AS activity_date,
-u.user_id, u.user_name, u.realname FROM frs_package frsp JOIN frs_release frsr USING (package_id), users u WHERE
-u.user_id=frsr.released_by
-UNION
-SELECT
-fgl.group_id, 'forumpost'::text as section,fgl.group_forum_id as ref_id, forum.msg_id
-as subref_id, forum.subject AS description, forum.post_date AS activity_date, u.user_id,
-u.user_name, u.realname FROM forum_group_list fgl JOIN forum USING (group_forum_id), users u WHERE
-u.user_id=forum.posted_by
-;
-
-CREATE TABLE group_activity_monitor (
-group_id int not null CONSTRAINT group_id REFERENCES groups(group_id) ON DELETE CASCADE,
-user_id int NOT NULL CONSTRAINT userid_fk REFERENCES users(user_id),
-filter text,
-PRIMARY KEY (group_id,user_id)
-);
-
-CREATE RULE groupactivity_userdelete_rule AS ON UPDATE TO USERS DO
- DELETE FROM group_activity_monitor WHERE user_id =(CASE WHEN NEW.status='D'
- THEN NEW.user_id ELSE 0 END);
Deleted: branches/Branch_4_8/gforge/db/20060216.sql
===================================================================
--- branches/Branch_4_8/gforge/db/20060216.sql 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/20060216.sql 2009-06-10 20:22:42 UTC (rev 7802)
@@ -1,51 +0,0 @@
-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,
-a.artifact_id as subref_id, a.summary as description, a.open_date AS activity_date, u.user_id, u.user_name, u.realname
-FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
-users u WHERE u.user_id=a.submitted_by
-UNION
-SELECT
-agl.group_id, 'trackerclose'::text AS section, agl.group_artifact_id AS ref_id,
-a.artifact_id as subref_id, a.summary as description, a.close_date AS activity_date, u.user_id, u.user_name, u.realname
-FROM artifact_group_list agl JOIN artifact a using (group_artifact_id), users u WHERE u.user_id=a.assigned_to
---actually should join against
-AND a.close_date > 0
-UNION
-SELECT
-agl.group_id, 'commit'::text AS section, agl.group_artifact_id AS ref_id,
-a.artifact_id as subref_id, pcdm.log_text AS description, pcdm.cvs_date AS activity_date, u.user_id, u.user_name, u.realname
-FROM artifact_group_list agl JOIN artifact a using (group_artifact_id),
-plugin_cvstracker_data_master pcdm, plugin_cvstracker_data_artifact pcda, users u
-WHERE pcdm.holder_id=pcda.id
-AND pcda.group_artifact_id=a.artifact_id
-AND u.user_name=pcdm.author
-UNION
-SELECT
-frsp.group_id, 'frsrelease'::text as section,frsp.package_id as ref_id,
-frsr.release_id as subref_id, frsr.name AS description, frsr.release_date AS activity_date,
-u.user_id, u.user_name, u.realname FROM frs_package frsp JOIN frs_release frsr USING (package_id), users u WHERE
-u.user_id=frsr.released_by
-UNION
-SELECT
-fgl.group_id, 'forumpost'::text as section,fgl.group_forum_id as ref_id, forum.msg_id
-as subref_id, forum.subject AS description, forum.post_date AS activity_date, u.user_id,
-u.user_name, u.realname FROM forum_group_list fgl JOIN forum USING (group_forum_id), users u WHERE
-u.user_id=forum.posted_by
-;
-
-CREATE TABLE group_activity_monitor (
-group_id int not null CONSTRAINT group_id REFERENCES groups(group_id) ON DELETE CASCADE,
-user_id int NOT NULL CONSTRAINT userid_fk REFERENCES users(user_id),
-filter text,
-PRIMARY KEY (group_id,user_id)
-);
-
-CREATE RULE groupactivity_userdelete_rule AS ON UPDATE TO USERS DO
- DELETE FROM group_activity_monitor WHERE user_id =(CASE WHEN NEW.status='D'
- THEN NEW.user_id ELSE 0 END);
Modified: branches/Branch_4_8/gforge/db/upgrade-db.php
===================================================================
--- branches/Branch_4_8/gforge/db/upgrade-db.php 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/db/upgrade-db.php 2009-06-10 20:22:42 UTC (rev 7802)
@@ -107,7 +107,7 @@
if (strlen($name) >= 8) {
$date_aux = substr($name, 0, 8);
$type_aux = substr($file, $pos + 1);
- if ((int) $date_aux > 20000000 && $type_aux=='sql' || $type_aux=='php') {
+ if ((int) $date_aux > 20000000 && ($type_aux=='sql' || $type_aux=='php') && strpos($file, 'debian') === false) {
$data[] = array('date'=>$date_aux, 'filename'=>$file, 'ext'=>$type_aux);
}
}
@@ -115,12 +115,17 @@
}
closedir($dh);
}
- sort($data);
+ usort($data, 'compare_scripts');
reset($data);
}
+
return $data;
}
+function compare_scripts($script1, $script2) {
+ return strcmp($script1['filename'], $script2['filename']);
+}
+
function run_script($script) {
global $db_path;
$return = false;
Modified: branches/Branch_4_8/gforge/deb-specific/db-upgrade.pl
===================================================================
--- branches/Branch_4_8/gforge/deb-specific/db-upgrade.pl 2009-06-10 19:38:26 UTC (rev 7801)
+++ branches/Branch_4_8/gforge/deb-specific/db-upgrade.pl 2009-06-10 20:22:42 UTC (rev 7802)
@@ -835,9 +835,9 @@
$version = &get_db_version ;
$target = "2.6-0+checkpoint+14" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20021213.sql") ;
+ &debug ("Upgrading with 20021213-1.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20021213.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20021213-1.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -944,9 +944,9 @@
$version = &get_db_version ;
$target = "2.6-0+checkpoint+19" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20021223.sql") ;
+ &debug ("Upgrading with 20021223-2.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20021223.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20021223-2.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -964,9 +964,9 @@
$version = &get_db_version ;
$target = "2.6-0+checkpoint+20" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20030102.sql") ;
+ &debug ("Upgrading with 20030102-2.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20030102.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20030102-2.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -1075,9 +1075,9 @@
$version = &get_db_version ;
$target = "2.6-0+checkpoint+25" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20030113.sql") ;
+ &debug ("Upgrading with 20030113-2.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20030113.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20030113-2.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -2139,9 +2139,9 @@
$version = &get_db_version ;
$target = "4.1-0" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20050224.sql") ;
+ &debug ("Upgrading with 20050224-2.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20050224.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20050224-2.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -2219,9 +2219,9 @@
$version = &get_db_version ;
$target = "4.1-4" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20050325-1.sql") ;
+ &debug ("Upgrading with 20050325-2.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20050325-1.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20050325-2.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -2435,9 +2435,9 @@
$version = &get_db_version ;
$target = "4.1-6" ;
if (&is_lesser ($version, $target)) {
- &debug ("Upgrading with 20050325-3.sql") ;
+ &debug ("Upgrading with 20050325-5.sql") ;
- @reqlist = @{ &parse_sql_file ("$sqldir/20050325-3.sql") } ;
+ @reqlist = @{ &parse_sql_file ("$sqldir/20050325-5.sql") } ;
foreach my $s (@reqlist) {
$query = $s ;
# debug $query ;
@@ -2680,14 +2680,14 @@
# If the view doesn't exists apply
if (! &view_exists ($dbh, 'activity_vw')) {
&update_with_sql("20050812","4.5.15-10merge");
- &update_with_sql("20050822","4.5.15-11merge");
+ &update_with_sql("20050822-2","4.5.15-11merge");
&update_with_sql("20050823","4.5.15-12merge");
&update_with_sql("20050824","4.5.15-13merge");
&update_with_sql("20050831","4.5.15-14merge");
&update_with_sql("20060113","4.5.15-15");
&update_with_sql("20060214","4.5.15-16");
- &update_with_sql("20060216-nocommit","4.5.15-17");
+ &update_with_sql("20060216-2-debian-nocommit","4.5.15-17");
}
$version = &get_db_version ;
More information about the Fusionforge-commits
mailing list