Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
add_index :stories, [:user_id, :account_id, :journal_id]
add_column :journals, :stories_count, :integer
end
def self.down
remove_index :stories, [:user_id, :account_id, :journal_id]
drop_table :stories
remove_column :journals, :stories_count
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.