Skip to content

Commit e2d7b34

Browse files
committed
Schema.up should really be called Schema.migrate -- add an alias.
1 parent f54c4b2 commit e2d7b34

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Diff for: README.rdoc

+11-8
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,17 @@ behavior:
9696
=== Schema
9797

9898
Add the <tt>Songkick::OAuth2::Provider</tt> tables to your app's schema. This is
99-
done using <tt>Songkick::OAuth2::Model::Schema.up</tt>, which can be used inside
100-
an <tt>ActiveRecord</tt> migration like so:
101-
102-
class CreateOauth2ProviderModels < ActiveRecord::Migration
103-
def up
104-
Songkick::OAuth2::Model::Schema.up
105-
end
106-
end
99+
done using <tt>Songkick::OAuth2::Model::Schema.migrate</tt>, which will run all
100+
the gem's migrations that have not yet been applied to your database.
101+
102+
Songkick::OAuth2::Model::Schema.migrate
103+
I, [2012-10-31T14:52:33.801428 #7002] INFO -- : Migrating to SongkickOauth2SchemaOriginalSchema (20120828112156)
104+
== SongkickOauth2SchemaOriginalSchema: migrating =============================
105+
-- create_table(:oauth2_clients)
106+
-> 0.0029s
107+
-- add_index(:oauth2_clients, [:client_id])
108+
-> 0.0009s
109+
...
107110

108111

109112
=== Model Mixins

Diff for: lib/songkick/oauth2/schema.rb

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ module Songkick
22
module OAuth2
33

44
class Schema
5-
def self.up
5+
def self.migrate
66
ActiveRecord::Base.logger ||= Logger.new(StringIO.new)
77
ActiveRecord::Migrator.up(migrations_path)
88
end
9+
class << self
10+
alias :up :migrate
11+
end
912

1013
def self.migrations_path
1114
File.expand_path('../schema', __FILE__)

0 commit comments

Comments
 (0)