Make the current_activity field in IDF_Project nullable and fix

a problem in the migration 25's down method (issue 800)
This commit is contained in:
Thomas Keller 2012-05-15 22:38:27 +02:00
parent 6bb886b92a
commit 831439120c
5 changed files with 60 additions and 8 deletions

View File

@ -2,15 +2,17 @@
## Bugfixes
- If an anonymous or authenticated user had no access
to any project in a forge, all projects were listed
for him (but still no one was actually accessible).
This has been fixed.
- If an anonymous or authenticated user had no access to any project in a
forge, all projects were listed for him (but still no one was actually
accessible). This has been fixed.
- Fixed a problem where the SyncGit plugin doesn't properly
updates the authorized_keys file when the public key
data contained slashes (thanks to Simon Gareste for the
fix!)
- Fixed a problem where the SyncGit plugin doesn't properly updates the
authorized_keys file when the public key data contained slashes (thanks
to Simon Gareste for the fix!)
- Under PostgreSQL new projects could not be created due to a failing
foreign key relation. Adding project tags was not possible for a similar
reason. This has been fixed (issue 800, continued).
# InDefero 1.3.2 - Wed May 09 20:05 2012 UTC

View File

@ -37,6 +37,7 @@ function IDF_Migrations_25NullableProjectInTag_up($params=null)
function IDF_Migrations_25NullableProjectInTag_down($params=null)
{
$engine = Pluf::f('db_engine');
$db = Pluf::db();
if ($engine === 'PostgreSQL') {
$db->execute('ALTER TABLE '.$db->pfx.'idf_tags ALTER COLUMN project SET NOT NULL');

View File

@ -0,0 +1,46 @@
<?php
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
# ***** BEGIN LICENSE BLOCK *****
# This file is part of InDefero, an open source project management application.
# Copyright (C) 2008-2012 Céondo Ltd and contributors.
#
# InDefero 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.
#
# InDefero 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# ***** END LICENSE BLOCK ***** */
function IDF_Migrations_26NullableActivityInProject_up($params=null)
{
$engine = Pluf::f('db_engine');
$db = Pluf::db();
if ($engine === 'PostgreSQL') {
$db->execute('ALTER TABLE '.$db->pfx.'idf_projects ALTER COLUMN current_activity DROP NOT NULL');
} else if ($engine === 'MySQL') {
$db->execute('ALTER TABLE '.$db->pfx.'idf_projects MODIFY current_activity MEDIUMINT NULL');
// this is only needed for non-transactional setups where MySQL set 0 as default value
$db->execute('UPDATE '.$db->pfx.'idf_projects SET current_activity=NULL WHERE current_activity=0');
}
}
function IDF_Migrations_26NullableActivityInProject_down($params=null)
{
$engine = Pluf::f('db_engine');
$db = Pluf::db();
if ($engine === 'PostgreSQL') {
$db->execute('ALTER TABLE '.$db->pfx.'idf_projects ALTER COLUMN current_activity SET NOT NULL');
} else if ($engine === 'MySQL') {
$db->execute('ALTER TABLE '.$db->pfx.'idf_projects MODIFY current_activity MEDIUMINT NOT NULL');
}
}

View File

@ -105,6 +105,8 @@ class IDF_Project extends Pluf_Model
'type' => 'Pluf_DB_Field_Foreignkey',
'model' => 'IDF_ProjectActivity',
'blank' => true,
'is_null' => true,
'default' => null,
'verbose' => __('current project activity'),
),
);

View File

@ -50,6 +50,7 @@ class IDF_Tag extends Pluf_Model
'model' => 'IDF_Project',
'blank' => true,
'is_null' => true,
'default' => null,
'verbose' => __('project'),
),
'class' =>