Project

General

Profile

0.8.0 -> 1.4.0 upgrade: no such column: is_default

Added by Eugene Prokopiev over 12 years ago

Hi,

I tried to upgrade 0.8.0 to 1.4.0 with ruby 1.9 as described in http://www.redmine.org/projects/redmine/wiki/RedmineUpgrade and got:

$ rake db:migrate RAILS_ENV=production 
(in /opt/redmine/redmine-1.4.0)
Please install RDoc 2.4.2+ to generate documentation.
==  BuildProjectsTree: migrating ==============================================
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: no such column: is_default: SELECT * FROM "repositories" WHERE ("repositories".project_id = 6 AND (is_default = 't'))  LIMIT 1

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I tried to fix this problem by hand:

$ sqlite3 db/production.db 
SQLite version 3.7.6.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";" 
sqlite> alter table repositories add column is_default boolean;
sqlite> update repositories set is_default = 1;
sqlite> .quit

But I got another error:

$ rake db:migrate RAILS_ENV=production 
(in /opt/redmine/redmine-1.4.0)
Please install RDoc 2.4.2+ to generate documentation.
==  BuildProjectsTree: migrating ==============================================
...
rake aborted!
An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: duplicate column name: is_default: ALTER TABLE "repositories" ADD "is_default" boolean DEFAULT 'f'

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Why can it be?


Replies (7)

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by Anonymous over 12 years ago

I have the same error, but when upgrading from 1.2.1devel. Any help appreciated...

rake db:migrate:upgrade_plugin_migrations RAILS_ENV=production 
Please install RDoc 2.4.2+ to generate documentation.
rake aborted!
Mysql::Error: Unknown column 'is_default' in 'where clause': SELECT * FROM `repositories` WHERE (`repositories`.project_id = 2 AND (is_default = 1))  LIMIT 1

Tasks: TOP => db:migrate:upgrade_plugin_migrations => environment
(See full trace by running task with --trace)

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by Ivan Cenov over 12 years ago

Hi,

0.8.0 -> 1.4 is a big leap; many things has changed in between. Why don't you try incremental upgrade?
May be you have to take care of rails version? Also, if you use plugins, perhaps some of them are not compatible with Redmine 1.4? Try to upgrade pure Redmine and then add the plugins again (their upgraded versions if any). Routing has changed in Redmine 1.4 and many plugins had to be upgraded.

I has maintained Redmine from 0.9.3 to 1.4 now, not missing a version and never had migration problems.

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by Eugene Prokopiev over 12 years ago

I have no plugns. My problem was resolved by commenting up and down methods in db/migrate/20120115143100_add_repositories_is_default.rb.

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by Edwin Mckain over 12 years ago

Ok, I had the same problem with the tables and I just fixed it,

this is what I just did,

From the terminal, run this command:
rake db:migrate

If you have any error about the rake* command (something about, try with an older version), try with this comamnd:

bundle update rake

Now, you can update or migrate the database with the same command:

rake db:migrate

Voila! It works like a charm! :)

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by L X over 12 years ago

Eugene and Ole, I am experiencing the same problem:

bash-4.1# rake db:migrate RAILS_ENV=production
Please install RDoc 2.4.2+ to generate documentation.
==  BuildProjectsTree: migrating ==============================================
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Unknown column 'is_default' in 'where clause': SELECT * FROM `repositories` WHERE (`repositories`.project_id = 5 AND (is_default = 1))  LIMIT 1

Tasks: TOP => db:migrate
(See full trace by running task with --trace)

I also have no plugins installed.
I ran bundle update rake as suggested by Edwin but that had no effect.

Eugene, I suspect I will have to alter the database as you have done. Do I understand correctly that you had to apply both of the changes you mentioned above?
  1. Add column repositories.is_default
  2. Comment out up and down methods in 20120115143100_add_repositories_is_default.rb

I am working well outside of my realm of experience here. Are there any risks or negative side effects to these changes?

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by L X over 12 years ago

Well, that seems to have worked. Thanks Eugene.

Unfortunately, now I'm back to an error I was getting previously (Error 500 viewing issue lists after upgrade to 1.3.2). I thought going to 1.4.0 instead of 1.3.2 might resolve it; but perhaps I need to go to an older version instead of newer. Then maybe I can do an incremental upgrade to 1.4.0 as Ivan suggests.

RE: 0.8.0 -> 1.4.0 upgrade: no such column: is_default - Added by Anonymous over 12 years ago

I also solved it using Eugenes solution, though I did not quite get qhy it did not work. The column was not there, as it should not have been, and the up method added it, as it should. Still, it would not work, even if I manually only ran that one migration. Finally I did the migration manually, deleting it so that it was not performed twice. Odd, but works for now.

    (1-7/7)