$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 ;
$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 ;
$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 ;
$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 ;
$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 ;
$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 ;
$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 ;
# 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 ;
&update_with_sql("20090402-add-projecttags-constraints","4.7.99-1");
&update_with_sql("20090402-forum-attachment-types","4.7.99-2");
+ &update_with_sql("20090507-add_artifact_workflow","4.8.99-1");
+ &update_with_sql("20090507-add_element_pos","4.8.99-2");
+ &update_with_sql("20090507-add_project_query","4.8.99-3");
+ &update_with_sql("20090507-browse_list","4.8.99-4");
+
+ $version = &get_db_version ;
+ $target = "4.8.99-5" ;
+ if (&is_lesser ($version, $target)) {
+ &debug ("Initialising tracker workflows") ;
+
+
+ $query = "SELECT group_id, artifact_group_list.group_artifact_id, element_id, artifact_extra_field_elements.extra_field_id
+ FROM artifact_extra_field_list, artifact_extra_field_elements, artifact_group_list
+ WHERE artifact_extra_field_list.extra_field_id=artifact_extra_field_elements.extra_field_id
+ AND artifact_group_list.group_artifact_id = artifact_extra_field_list.group_artifact_id
+ AND field_type=7" ;
+ # &debug ($query) ;
+ $sth = $dbh->prepare ($query) ;
+ $sth->execute () ;
+ while (@array = $sth->fetchrow_array) {
+ my $gid = $array[0];
+ my $gaid = $array[1];
+ my $eid = $array[2];
+
+ my $query2 = "SELECT extra_field_id
+ FROM artifact_extra_field_list
+ WHERE group_artifact_id=$gaid
+ AND field_type = 7
+ ORDER BY field_type ASC" ;
+ my $sth2 = $dbh->prepare ($query2) ;
+ $sth2->execute () ;
+
+ if (my @array2 = $sth2->fetchrow_array) {
+ my $efid = $array2[0];
+ $sth2->finish () ;
+
+ $query2 = "SELECT element_id,element_name,status_id
+ FROM artifact_extra_field_elements
+ WHERE extra_field_id = $efid
+ ORDER BY element_pos ASC, element_id ASC" ;
+ # debug $query2;
+ $sth2 = $dbh->prepare ($query2) ;
+ $sth2->execute () ;
+ while (@array2 = $sth2->fetchrow_array) {
+ my $eid2 = $array2[0];
+ if ($eid2 != $eid) {
+ my $query3 = "INSERT INTO artifact_workflow_event
+ (group_artifact_id, field_id, from_value_id, to_value_id)
+ VALUES ($gaid, $efid, $eid, $eid2)";
+ # debug $query3;
+ my $sth3 = $dbh->prepare ($query3) ;
+ $sth3->execute () ;
+ $sth3->finish () ;
+ $query3 = "INSERT INTO artifact_workflow_event
+ (group_artifact_id, field_id, from_value_id, to_value_id)
+ VALUES ($gaid, $efid, $eid2, $eid)";
+ # debug $query3;
+ $sth3 = $dbh->prepare ($query3) ;
+ $sth3->execute () ;
+ $sth3->finish () ;
+ }
+ }
+ $sth2->finish () ;
+ my $query3 = "INSERT INTO artifact_workflow_event
+ (group_artifact_id, field_id, from_value_id, to_value_id)
+ VALUES ($gaid, $efid, 100, $eid)";
+ # debug $query3;
+ my $sth3 = $dbh->prepare ($query3) ;
+ $sth3->execute () ;
+ $sth3->finish () ;
+ }
+ }
+ $sth->finish () ;
+
+ @reqlist = () ;
+ &update_db_version ($target) ;
+ &debug ("Committing.") ;
+ $dbh->commit () ;
+ }
+
+ &update_with_sql("20100308-forum-attachment-types","4.8.99-6");
+
+ &update_with_sql("20100330-add-system-event","5.0.0-1");
+ &update_with_sql("20100331-alter-system-event","5.0.0-2");
+
########################### INSERT HERE #################################
&debug ("It seems your database $action went well and smoothly. That's cool.") ;
- &debug ("Please enjoy using GForge.") ;
+ &debug ("Please enjoy using FusionForge.") ;
# There should be a commit at the end of every block above.
# If there is not, then it might be symptomatic of a problem.