Fixed initial setup.
This commit is contained in:
parent
fe2b760612
commit
afa3a34fbf
3 changed files with 14 additions and 5 deletions
|
@ -144,6 +144,11 @@ class CreateBase < ActiveRecord::Migration
|
||||||
add_index :translations, [:source]
|
add_index :translations, [:source]
|
||||||
add_index :translations, [:locale]
|
add_index :translations, [:locale]
|
||||||
|
|
||||||
|
create_table :object_lookups do |t|
|
||||||
|
t.column :name, :string, :limit => 250, :null => false
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :object_lookups, [:name], :unique => true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
class UpdateRecentViewedCreateObjectLookup < ActiveRecord::Migration
|
class UpdateRecentViewedCreateObjectLookup < ActiveRecord::Migration
|
||||||
def up
|
def up
|
||||||
|
|
||||||
create_table :object_lookups do |t|
|
if !ActiveRecord::Base.connection.table_exists? 'object_lookups'
|
||||||
t.column :name, :string, :limit => 250, :null => false
|
create_table :object_lookups do |t|
|
||||||
t.timestamps
|
t.column :name, :string, :limit => 250, :null => false
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
add_index :object_lookups, [:name], :unique => true
|
||||||
end
|
end
|
||||||
add_index :object_lookups, [:name], :unique => true
|
|
||||||
RecentView.all.each {|entry|
|
RecentView.all.each {|entry|
|
||||||
ro = RecentView::Object.find(entry.recent_view_object_id)
|
ro = RecentView::Object.find(entry.recent_view_object_id)
|
||||||
lookup_id = ObjectLookup.by_name( ro.name )
|
lookup_id = ObjectLookup.by_name( ro.name )
|
||||||
|
@ -15,6 +17,8 @@ class UpdateRecentViewedCreateObjectLookup < ActiveRecord::Migration
|
||||||
|
|
||||||
rename_column :recent_views, :recent_view_object_id, :object_lookup_id
|
rename_column :recent_views, :recent_view_object_id, :object_lookup_id
|
||||||
drop_table :recent_view_objects
|
drop_table :recent_view_objects
|
||||||
|
|
||||||
|
Cache.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
|
@ -7,8 +7,8 @@ class UpdateActivityStreamObjectLookup < ActiveRecord::Migration
|
||||||
entry.update_attribute( :activity_stream_object_id, lookup_id )
|
entry.update_attribute( :activity_stream_object_id, lookup_id )
|
||||||
entry.cache_delete
|
entry.cache_delete
|
||||||
}
|
}
|
||||||
|
|
||||||
drop_table :activity_stream_objects
|
drop_table :activity_stream_objects
|
||||||
|
Cache.clear
|
||||||
end
|
end
|
||||||
|
|
||||||
def down
|
def down
|
||||||
|
|
Loading…
Reference in a new issue