Adding versioning
This commit is contained in:
@@ -2,7 +2,7 @@ class CreateSpaces < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :spaces do |t|
|
||||
t.string :name
|
||||
t.string :type
|
||||
t.string :category
|
||||
t.string :address
|
||||
t.string :hours
|
||||
t.string :phone
|
||||
|
||||
18
db/migrate/20131009051102_create_versions.rb
Normal file
18
db/migrate/20131009051102_create_versions.rb
Normal file
@@ -0,0 +1,18 @@
|
||||
class CreateVersions < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :versions do |t|
|
||||
t.string :item_type, :null => false
|
||||
t.integer :item_id, :null => false
|
||||
t.string :event, :null => false
|
||||
t.string :whodunnit
|
||||
t.text :object
|
||||
t.datetime :created_at
|
||||
end
|
||||
add_index :versions, [:item_type, :item_id]
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :versions, [:item_type, :item_id]
|
||||
drop_table :versions
|
||||
end
|
||||
end
|
||||
15
db/schema.rb
15
db/schema.rb
@@ -11,11 +11,11 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20131009050712) do
|
||||
ActiveRecord::Schema.define(version: 20131009051102) do
|
||||
|
||||
create_table "spaces", force: true do |t|
|
||||
t.string "name"
|
||||
t.string "type"
|
||||
t.string "category"
|
||||
t.string "address"
|
||||
t.string "hours"
|
||||
t.string "phone"
|
||||
@@ -26,4 +26,15 @@ ActiveRecord::Schema.define(version: 20131009050712) do
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "versions", force: true do |t|
|
||||
t.string "item_type", null: false
|
||||
t.integer "item_id", null: false
|
||||
t.string "event", null: false
|
||||
t.string "whodunnit"
|
||||
t.text "object"
|
||||
t.datetime "created_at"
|
||||
end
|
||||
|
||||
add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user