Permalink
Browse files

project-ownership-migration

Run the migration generator to see the effect on the app:

    $ hobo generate migration
  • Loading branch information...
bryanlarsen authored and iox committed Jun 3, 2013
1 parent 6bc889d commit 561235cf75e300781afe0e41c7061fa88153f36b
Showing with 17 additions and 1 deletion.
  1. +13 −0 db/migrate/20130109025834_project_ownership.rb
  2. +4 −1 db/schema.rb
@@ -0,0 +1,13 @@
class ProjectOwnership < ActiveRecord::Migration
def self.up
add_column :projects, :owner_id, :integer
add_index :projects, [:owner_id]
end
def self.down
remove_column :projects, :owner_id
remove_index :projects, :name => :index_projects_on_owner_id rescue ActiveRecord::StatementInvalid
end
end
View
@@ -11,15 +11,18 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130109024936) do
ActiveRecord::Schema.define(:version => 20130109025834) do
create_table "projects", :force => true do |t|
t.string "name"
t.integer "stories_count", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "owner_id"
end
add_index "projects", ["owner_id"], :name => "index_projects_on_owner_id"
create_table "stories", :force => true do |t|
t.string "title"
t.text "body"

0 comments on commit 561235c

Please sign in to comment.