i had the same problem upgrading from mailboxer 0.9.0 to 0.12.4 (on rails 3.2.19).
what i did was to manually edit the migration created by the namespacing_compatibility
generator as follows:
- in the up migration i prefixed the "from" index names with "index_" in the
rename_index
commands.
- in the down migration, i similarly renamed the "to" index names.
- also in the down migration, i found i needed to move the
update_all
command to the beginning, before the rename_table
commands.
my edited migration ended up like this. here i have indicted the edited lines with comments.
class MailboxerNamespacingCompatibility < ActiveRecord::Migration
def self.up
rename_table :conversations, :mailboxer_conversations
rename_table :notifications, :mailboxer_notifications
rename_table :receipts, :mailboxer_receipts
if Rails.version < '4'
# i edited the next two lines by adding the index_ prefix
rename_index :mailboxer_notifications, :index_notifications_on_conversation_id, :mailboxer_notifications_on_conversation_id
rename_index :mailboxer_receipts, :index_receipts_on_notification_id, :mailboxer_receipts_on_notification_id
end
Mailboxer::Notification.where(type: 'Message').update_all(type: 'Mailboxer::Message')
end
def self.down
# i moved this line from the end of the down block to here
Mailboxer::Notification.where(type: 'Mailboxer::Message').update_all(type: 'Message')
rename_table :mailboxer_conversations, :conversations
rename_table :mailboxer_notifications, :notifications
rename_table :mailboxer_receipts, :receipts
if Rails.version < '4'
# i edited the next two lines by adding the index_ prefix
rename_index :notifications, :mailboxer_notifications_on_conversation_id, :index_notifications_on_conversation_id
rename_index :receipts, :mailboxer_receipts_on_notification_id, :index_receipts_on_notification_id
end
end
end
i then ran the migration, ran the other (mailboxer:install) generator, and ran that migration. so far things seem to be working.