Skip to content

Instantly share code, notes, and snippets.

@intjonathan
Created September 30, 2011 22:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save intjonathan/1255168 to your computer and use it in GitHub Desktop.
Save intjonathan/1255168 to your computer and use it in GitHub Desktop.
class AddStoriesCountToJournals < ActiveRecord::Migration
def self.up
add_column :journals, :stories_count, :integer
end
def self.down
remove_column :journals, :stories_count
end
end
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
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