Created
September 30, 2011 22:25
-
-
Save intjonathan/1255168 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddStoriesCountToJournals < ActiveRecord::Migration | |
def self.up | |
add_column :journals, :stories_count, :integer | |
end | |
def self.down | |
remove_column :journals, :stories_count | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AddStoriesIndexOnUserAccountAndJournal < ActiveRecord::Migration | |
def self.up | |
add_index :stories, [:user_id, :account_id, :journal_id] | |
end | |
def self.down | |
remove_index :stories, [:user_id, :account_id, :journal_id] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateStoryTable < ActiveRecord::Migration | |
def self.up | |
create_table :stories do |t| | |
t.string :title | |
t.integer :journal_id | |
t.integer :user_id | |
t.integer :account_id | |
t.timestamps | |
end | |
end | |
def self.down | |
drop_table :stories | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment