This project is archived and is in readonly mode.

#3671 ✓committed
Jeffrey Hardy

Allow AR::Schema's migrations_path to be overwritten by subclasses

Reported by Jeffrey Hardy | January 8th, 2010 @ 09:05 PM

Extracts the hard-coded migrations path so it can be customized by subclasses. This is useful when you have a separate schema and migrations using a different connection. Otherwise, the default path of 'db/migrate' causes assume_migrated_up_to make the wrong assumption about prior migrations.

class SignalId::Schema < ActiveRecord::Schema
  def self.migrations_path
    SignalId.root + '/db/migrate'
  end
end

Ideally, we'd have something like a SchemaLoader that took a schema and a migration path. Since Schema is a Migration, Migrator could reasonably assume this responsibility as well. But that would be incompatible with normal usage which is simiply load 'schema.rb'.

Patch applies to master and 2-3-stable.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments