Project

General

Profile

Actions

Defect #2699

closed

db:migrate does not take into account custom table prefix

Added by Stefan Urbanek almost 16 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Database
Target version:
Start date:
2009-02-08
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

I need to have a table prefix for redmine, so I have put this in the environment.db file:
config.active_record.table_name_prefix = 'rm_'

When I do "rake db:migrate" to initialize redmine, it fails at: SetTopicAuthorsAsWatchers with following message:

==  SetTopicAuthorsAsWatchers: migrating ======================================
rake aborted!
An error has occurred, all later migrations canceled:

Mysql::Error: Table 'my_scheme.watchers' doesn't exist: INSERT INTO watchers (watchable_type, watchable_id, user_id) SELECT DISTINCT 'Message', COALESCE(messages.parent_id, messages.id), messages.author_id FROM messages, users WHERE messages.author_id = users.id AND users.status = 1

Very quick fix is to put the prefix into the INSERT statement. For example, I have prefix rm_ so I change it to:

INSERT INTO rm_watchers ..... FROM rm_messages messages, rm_users users....

I have no time now to find proper solution, I am just writing it here to let you know, that this issue exists.

Actions

Also available in: Atom PDF