Finish the CMS upgrade and fix #2098

This commit is contained in:
Brenda Wallace
2019-11-19 15:14:08 +13:00
parent 35c2073bd8
commit 0958a134ed
2 changed files with 65 additions and 21 deletions

View File

@@ -0,0 +1,34 @@
class UpgradeCms < ActiveRecord::Migration[5.2]
def change
rename_table :comfy_cms_blocks, :comfy_cms_fragments
rename_column :comfy_cms_fragments, :blockable_id, :record_id
rename_column :comfy_cms_fragments, :blockable_type, :record_type
add_column :comfy_cms_fragments, :tag, :string, null: false, default: 'text'
add_column :comfy_cms_fragments, :datetime, :datetime
add_column :comfy_cms_fragments, :boolean, :boolean, null: false, default: false
change_column :comfy_cms_files, :label, :string, null: false, default: ''
change_column :comfy_cms_files, :file_file_name, :string, null: true
remove_column :comfy_cms_files, :file_content_type
remove_column :comfy_cms_files, :file_file_size
remove_index :comfy_cms_sites, :is_mirrored
remove_column :comfy_cms_sites, :is_mirrored
remove_column :comfy_cms_layouts, :is_shared
remove_column :comfy_cms_pages, :is_shared
remove_column :comfy_cms_snippets, :is_shared
limit = 16777215
create_table :comfy_cms_translations, force: true do |t|
t.string :locale, null: false
t.integer :page_id, null: false
t.integer :layout_id
t.string :label, null: false
t.text :content_cache, limit: limit
t.boolean :is_published, null: false, default: true
t.timestamps
t.index [:page_id]
t.index [:locale]
t.index [:is_published]
end
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2019_10_29_024101) do
ActiveRecord::Schema.define(version: 2019_11_19_020643) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -35,17 +35,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.index ["member_id"], name: "index_authentications_on_member_id"
end
create_table "comfy_cms_blocks", id: :serial, force: :cascade do |t|
t.string "identifier", null: false
t.text "content"
t.string "blockable_type"
t.integer "blockable_id"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["blockable_id", "blockable_type"], name: "index_comfy_cms_blocks_on_blockable_id_and_blockable_type"
t.index ["identifier"], name: "index_comfy_cms_blocks_on_identifier"
end
create_table "comfy_cms_categories", id: :serial, force: :cascade do |t|
t.integer "site_id", null: false
t.string "label", null: false
@@ -63,10 +52,8 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
create_table "comfy_cms_files", id: :serial, force: :cascade do |t|
t.integer "site_id", null: false
t.integer "block_id"
t.string "label", null: false
t.string "file_file_name", null: false
t.string "file_content_type", null: false
t.integer "file_file_size", null: false
t.string "label", default: "", null: false
t.string "file_file_name"
t.string "description", limit: 2048
t.integer "position", default: 0, null: false
t.datetime "created_at"
@@ -77,6 +64,20 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.index ["site_id", "position"], name: "index_comfy_cms_files_on_site_id_and_position"
end
create_table "comfy_cms_fragments", id: :serial, force: :cascade do |t|
t.string "identifier", null: false
t.text "content"
t.string "record_type"
t.integer "record_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "tag", default: "text", null: false
t.datetime "datetime"
t.boolean "boolean", default: false, null: false
t.index ["identifier"], name: "index_comfy_cms_fragments_on_identifier"
t.index ["record_id", "record_type"], name: "index_comfy_cms_fragments_on_record_id_and_record_type"
end
create_table "comfy_cms_layouts", id: :serial, force: :cascade do |t|
t.integer "site_id", null: false
t.integer "parent_id"
@@ -87,7 +88,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.text "css"
t.text "js"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index ["parent_id", "position"], name: "index_comfy_cms_layouts_on_parent_id_and_position"
@@ -106,7 +106,6 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.integer "position", default: 0, null: false
t.integer "children_count", default: 0, null: false
t.boolean "is_published", default: true, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index ["parent_id", "position"], name: "index_comfy_cms_pages_on_parent_id_and_position"
@@ -127,9 +126,7 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.string "hostname", null: false
t.string "path"
t.string "locale", default: "en", null: false
t.boolean "is_mirrored", default: false, null: false
t.index ["hostname"], name: "index_comfy_cms_sites_on_hostname"
t.index ["is_mirrored"], name: "index_comfy_cms_sites_on_is_mirrored"
end
create_table "comfy_cms_snippets", id: :serial, force: :cascade do |t|
@@ -138,13 +135,26 @@ ActiveRecord::Schema.define(version: 2019_10_29_024101) do
t.string "identifier", null: false
t.text "content"
t.integer "position", default: 0, null: false
t.boolean "is_shared", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.index ["site_id", "identifier"], name: "index_comfy_cms_snippets_on_site_id_and_identifier", unique: true
t.index ["site_id", "position"], name: "index_comfy_cms_snippets_on_site_id_and_position"
end
create_table "comfy_cms_translations", force: :cascade do |t|
t.string "locale", null: false
t.integer "page_id", null: false
t.integer "layout_id"
t.string "label", null: false
t.text "content_cache"
t.boolean "is_published", default: true, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["is_published"], name: "index_comfy_cms_translations_on_is_published"
t.index ["locale"], name: "index_comfy_cms_translations_on_locale"
t.index ["page_id"], name: "index_comfy_cms_translations_on_page_id"
end
create_table "comments", id: :serial, force: :cascade do |t|
t.integer "post_id", null: false
t.integer "author_id", null: false