big refactor of windows models
This commit is contained in:
7
db/migrate/20140716210000_add_fields_to_windows.rb
Normal file
7
db/migrate/20140716210000_add_fields_to_windows.rb
Normal file
@ -0,0 +1,7 @@
|
||||
class AddFieldsToWindows < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :windows, :content_id, :integer
|
||||
add_column :windows, :options, :text
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,7 @@
|
||||
class MoveDataFromWindowDetailsToWindows < ActiveRecord::Migration
|
||||
def change
|
||||
execute "UPDATE windows w, plugin_window_details p SET w.content_id = p.plugin_id WHERE w.id = p.plugin_window_id;"
|
||||
execute "UPDATE windows w, chart_window_details c SET w.content_id = c.field_number, w.options = c.options WHERE w.id = c.chart_window_id;"
|
||||
end
|
||||
end
|
||||
|
6
db/migrate/20140720224408_remove_window_type.rb
Normal file
6
db/migrate/20140720224408_remove_window_type.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class RemoveWindowType < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :windows, :type
|
||||
end
|
||||
end
|
||||
|
@ -0,0 +1,6 @@
|
||||
class RenameWindowsWtypeToWindowsWindowType < ActiveRecord::Migration
|
||||
def change
|
||||
rename_column :windows, :wtype, :window_type
|
||||
end
|
||||
end
|
||||
|
6
db/migrate/20140722162824_add_indexes_to_windows.rb
Normal file
6
db/migrate/20140722162824_add_indexes_to_windows.rb
Normal file
@ -0,0 +1,6 @@
|
||||
class AddIndexesToWindows < ActiveRecord::Migration
|
||||
def change
|
||||
add_index :windows, [:window_type, :content_id]
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user