big refactor of windows models

This commit is contained in:
Lee Lawlor
2014-07-22 19:13:11 -04:00
parent 0739b17989
commit 0c5097803b
43 changed files with 211 additions and 411 deletions

View File

@ -0,0 +1,7 @@
class AddFieldsToWindows < ActiveRecord::Migration
def change
add_column :windows, :content_id, :integer
add_column :windows, :options, :text
end
end

View File

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

View File

@ -0,0 +1,6 @@
class RemoveWindowType < ActiveRecord::Migration
def change
remove_column :windows, :type
end
end

View File

@ -0,0 +1,6 @@
class RenameWindowsWtypeToWindowsWindowType < ActiveRecord::Migration
def change
rename_column :windows, :wtype, :window_type
end
end

View File

@ -0,0 +1,6 @@
class AddIndexesToWindows < ActiveRecord::Migration
def change
add_index :windows, [:window_type, :content_id]
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140630153108) do
ActiveRecord::Schema.define(version: 20140722162824) do
create_table "active_admin_comments", force: true do |t|
t.string "namespace"
@ -405,7 +405,6 @@ ActiveRecord::Schema.define(version: 20140630153108) do
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.string "authentication_token"
t.datetime "terms_agreed_at"
end
add_index "users", ["api_key"], name: "index_users_on_api_key", using: :btree
@ -431,13 +430,15 @@ ActiveRecord::Schema.define(version: 20140630153108) do
t.text "html"
t.integer "col"
t.string "title"
t.string "wtype"
t.string "window_type"
t.string "name"
t.string "type"
t.boolean "private_flag", default: false
t.boolean "show_flag", default: true
t.integer "content_id"
t.text "options"
end
add_index "windows", ["channel_id"], name: "index_windows_on_channel_id", using: :btree
add_index "windows", ["window_type", "content_id"], name: "index_windows_on_window_type_and_content_id", using: :btree
end