Project

General

Profile

Actions

Defect #2699

closed

db:migrate does not take into account custom table prefix

Added by Stefan Urbanek about 15 years ago. Updated about 15 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 #1

Updated by Jean-Philippe Lang about 15 years ago

  • Status changed from New to Resolved
  • Target version set to 0.8.1
  • Affected version (unused) set to devel
  • Resolution set to Fixed

This is fixed in r2415. Thanks.

Actions #2

Updated by Jean-Philippe Lang about 15 years ago

  • Status changed from Resolved to Closed

Merged in 0.8 branch in r2425.

Actions

Also available in: Atom PDF