Skip to content

Commit

Permalink
Schema.up should really be called Schema.migrate -- add an alias.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcoglan committed Oct 31, 2012
1 parent f54c4b2 commit e2d7b34
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
19 changes: 11 additions & 8 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,17 @@ behavior:
=== Schema

Add the <tt>Songkick::OAuth2::Provider</tt> tables to your app's schema. This is
done using <tt>Songkick::OAuth2::Model::Schema.up</tt>, which can be used inside
an <tt>ActiveRecord</tt> migration like so:

class CreateOauth2ProviderModels < ActiveRecord::Migration
def up
Songkick::OAuth2::Model::Schema.up
end
end
done using <tt>Songkick::OAuth2::Model::Schema.migrate</tt>, which will run all
the gem's migrations that have not yet been applied to your database.

Songkick::OAuth2::Model::Schema.migrate
I, [2012-10-31T14:52:33.801428 #7002] INFO -- : Migrating to SongkickOauth2SchemaOriginalSchema (20120828112156)
== SongkickOauth2SchemaOriginalSchema: migrating =============================
-- create_table(:oauth2_clients)
-> 0.0029s
-- add_index(:oauth2_clients, [:client_id])
-> 0.0009s
...


=== Model Mixins
Expand Down
5 changes: 4 additions & 1 deletion lib/songkick/oauth2/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ module Songkick
module OAuth2

class Schema
def self.up
def self.migrate
ActiveRecord::Base.logger ||= Logger.new(StringIO.new)
ActiveRecord::Migrator.up(migrations_path)
end
class << self
alias :up :migrate
end

def self.migrations_path
File.expand_path('../schema', __FILE__)
Expand Down

0 comments on commit e2d7b34

Please sign in to comment.