Project

General

Profile

Actions

Defect #8747

closed

Upgrade Redmine 1.0.2 -> 1.2.0, PostgreSQL DB Migration issues

Added by Bernhard Schauer almost 14 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
-
Start date:
2011-07-05
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Ruby Version: 1.8.7
PostgreSQL Version: 8.4.5
Rails Version: 2.3.11
Redmine Version: 1.2.0

Two scripts block the upgrade from Redmine 1.0.2 to 1.2.0 when using PostgreSQL database. Both JDBC and native database connectors are affected. I think this happens cause PostgreSQL is more strict than MySQL.

The issue happens, cause the migration scripts set newly created table columns to be "not null" before assigning a default value to all existing entries. As I do not know Ruby I can't submit a patch for them, but I hope I'm able to report the issue as good as possible.

  • db/migrate/20110220160626_add_workflows_assignee_and_author.rb
    add_column :workflows, :assignee, :boolean, :null => false, :default => false
    add_column :workflows, :author, :boolean, :null => false, :default => false
    Workflow.update_all("assignee = #{Workflow.connection.quoted_false}")
    Workflow.update_all("author = #{Workflow.connection.quoted_false}")

here the values are set with "update_all" but the script fails at the first add_column. I've removed the :null=>false and afterwards I set the "not null" on database level.

  • db/migrate/20110412065600_add_issues_is_private.rb:
    add_column :issues, :is_private, :boolean, :default => false, :null => false

here no "update" is done, so I performed an "UPDATE issues SET is_private=DEFAULT WHERE is_default is null" on database level and also set the "not null" afterwards.

I think both scripts should be fixed to first change the schema, then update all fields and last set not null on the columns. I hope this helps someone

Actions

Also available in: Atom PDF