Adding versioning

This commit is contained in:
2013-10-09 03:34:27 -07:00
parent 5a94d69b3d
commit ebc696814e
11 changed files with 101 additions and 46 deletions

View File

@@ -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

View 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