diff --git a/.gitignore b/.gitignore index b1f7195..d97a0bf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ spec/dummy/log/*.log spec/dummy/db/*.sqlite3* spec/dummy/tmp/* spec/dummy/public/* +spec/dummy/db/migrate/* spec/dummy/uploads/* .ruby-* node_modules diff --git a/README.md b/README.md index 86864de..59184ae 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Alchemy CMS Postgresql Fulltext Search -This gem provides full text search for projects using postgresql databases to Alchemy CMS 6.0 and above. +This gem provides full text search for projects using postgresql databases to Alchemy CMS 7.0 and above. ## Requirements diff --git a/db/migrate/20141211105526_add_searchable_to_alchemy_essence_texts.rb b/db/migrate/20141211105526_add_searchable_to_alchemy_essence_texts.rb deleted file mode 100644 index 8084819..0000000 --- a/db/migrate/20141211105526_add_searchable_to_alchemy_essence_texts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSearchableToAlchemyEssenceTexts < ActiveRecord::Migration[6.1] - def change - add_column :alchemy_essence_texts, :searchable, :boolean, default: true, if_not_exists: true - end -end diff --git a/db/migrate/20141211105942_add_searchable_to_alchemy_essence_richtexts.rb b/db/migrate/20141211105942_add_searchable_to_alchemy_essence_richtexts.rb deleted file mode 100644 index 3bb426a..0000000 --- a/db/migrate/20141211105942_add_searchable_to_alchemy_essence_richtexts.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSearchableToAlchemyEssenceRichtexts < ActiveRecord::Migration[6.1] - def change - add_column :alchemy_essence_richtexts, :searchable, :boolean, default: true, if_not_exists: true - end -end diff --git a/db/migrate/20141211110126_add_searchable_to_alchemy_essence_pictures.rb b/db/migrate/20141211110126_add_searchable_to_alchemy_essence_pictures.rb deleted file mode 100644 index 1593021..0000000 --- a/db/migrate/20141211110126_add_searchable_to_alchemy_essence_pictures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSearchableToAlchemyEssencePictures < ActiveRecord::Migration[6.1] - def change - add_column :alchemy_essence_pictures, :searchable, :boolean, default: true, if_not_exists: true - end -end diff --git a/db/migrate/20210923081905_move_searchable_to_contents.rb b/db/migrate/20210923081905_move_searchable_to_contents.rb deleted file mode 100644 index 480ebe7..0000000 --- a/db/migrate/20210923081905_move_searchable_to_contents.rb +++ /dev/null @@ -1,45 +0,0 @@ -class MoveSearchableToContents < ActiveRecord::Migration[6.1] - def change - if column_exists? :alchemy_contents, :searchable - return - end - - add_column :alchemy_contents, :searchable, :boolean, default: true - - { - Text: "texts", - Richtext: "richtexts", - Picture: "pictures", - }.each do |klass, table| - reversible do |dir| - dir.up do - Alchemy::Content.connection.execute <<~SQL - UPDATE alchemy_contents - SET searchable = alchemy_essence_#{table}.searchable - FROM alchemy_essence_#{table} - WHERE - alchemy_contents.essence_type = 'Alchemy::Essence#{klass}' - AND - alchemy_contents.essence_id = alchemy_essence_#{table}.id - SQL - end - - dir.down do - Alchemy::Content.connection.execute <<~SQL - UPDATE alchemy_essence_#{table} - SET searchable = alchemy_contents.searchable - FROM alchemy_contents - WHERE - alchemy_contents.essence_type = 'Alchemy::Essence#{klass}' - AND - alchemy_contents.essence_id = alchemy_essence_#{table}.id - SQL - end - end - - remove_column "alchemy_essence_#{table}", :searchable, default: true - end - - change_column_null :alchemy_contents, :searchable, false, true - end -end diff --git a/spec/dummy/db/migrate/20220606143533_gutentag_tables.gutentag.rb b/spec/dummy/db/migrate/20220606143533_gutentag_tables.gutentag.rb deleted file mode 100644 index ae04656..0000000 --- a/spec/dummy/db/migrate/20220606143533_gutentag_tables.gutentag.rb +++ /dev/null @@ -1,30 +0,0 @@ -# frozen_string_literal: true -# This migration comes from gutentag (originally 1) - -class GutentagTables < ActiveRecord::Migration[4.2] - def up - create_table :gutentag_taggings do |t| - t.integer :tag_id, :null => false - t.integer :taggable_id, :null => false - t.string :taggable_type, :null => false - t.timestamps :null => false - end - - add_index :gutentag_taggings, :tag_id - add_index :gutentag_taggings, %i[ taggable_type taggable_id ] - add_index :gutentag_taggings, %i[ taggable_type taggable_id tag_id ], - :unique => true, :name => "unique_taggings" - - create_table :gutentag_tags do |t| - t.string :name, :null => false - t.timestamps :null => false - end - - add_index :gutentag_tags, :name, :unique => true - end - - def down - drop_table :gutentag_tags - drop_table :gutentag_taggings - end -end diff --git a/spec/dummy/db/migrate/20220606143534_gutentag_cache_counter.gutentag.rb b/spec/dummy/db/migrate/20220606143534_gutentag_cache_counter.gutentag.rb deleted file mode 100644 index ec60353..0000000 --- a/spec/dummy/db/migrate/20220606143534_gutentag_cache_counter.gutentag.rb +++ /dev/null @@ -1,18 +0,0 @@ -# frozen_string_literal: true -# This migration comes from gutentag (originally 2) - -class GutentagCacheCounter < ActiveRecord::Migration[4.2] - def up - add_column :gutentag_tags, :taggings_count, :integer, :default => 0 - add_index :gutentag_tags, :taggings_count - - Gutentag::Tag.reset_column_information - Gutentag::Tag.pluck(:id).each do |tag_id| - Gutentag::Tag.reset_counters tag_id, :taggings - end - end - - def down - remove_column :gutentag_tags, :taggings_count - end -end diff --git a/spec/dummy/db/migrate/20220606143535_no_null_counters.gutentag.rb b/spec/dummy/db/migrate/20220606143535_no_null_counters.gutentag.rb deleted file mode 100644 index b6af377..0000000 --- a/spec/dummy/db/migrate/20220606143535_no_null_counters.gutentag.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true -# This migration comes from gutentag (originally 3) - -class NoNullCounters < ActiveRecord::Migration[4.2] - def up - change_column :gutentag_tags, :taggings_count, :integer, - :default => 0, - :null => false - end - - def down - change_column :gutentag_tags, :taggings_count, :integer, - :default => 0, - :null => true - end -end diff --git a/spec/dummy/db/migrate/20220606143557_alchemy_four_point_four.alchemy.rb b/spec/dummy/db/migrate/20220606143557_alchemy_four_point_four.alchemy.rb deleted file mode 100644 index 4811a79..0000000 --- a/spec/dummy/db/migrate/20220606143557_alchemy_four_point_four.alchemy.rb +++ /dev/null @@ -1,314 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200226213334) - -class AlchemyFourPointFour < ActiveRecord::Migration[6.0] - def up - unless table_exists?("alchemy_attachments") - create_table "alchemy_attachments" do |t| - t.string "name" - t.string "file_name" - t.string "file_mime_type" - t.integer "file_size" - t.references "creator" - t.references "updater" - t.timestamps - t.string "file_uid" - t.index ["file_uid"], name: "index_alchemy_attachments_on_file_uid" - end - end - - unless table_exists?("alchemy_contents") - create_table "alchemy_contents" do |t| - t.string "name" - t.references "essence", null: false, polymorphic: true, index: { unique: true } - t.references "element", null: false - end - end - - unless table_exists?("alchemy_elements") - create_table "alchemy_elements" do |t| - t.string "name" - t.integer "position" - t.references "page", null: false, index: false - t.boolean "public", default: true - t.boolean "folded", default: false - t.boolean "unique", default: false - t.timestamps - t.references "creator" - t.references "updater" - t.references "parent_element", index: false - t.boolean "fixed", default: false, null: false - t.index ["fixed"], name: "index_alchemy_elements_on_fixed" - t.index ["page_id", "parent_element_id"], name: "index_alchemy_elements_on_page_id_and_parent_element_id" - t.index ["page_id", "position"], name: "index_elements_on_page_id_and_position" - end - end - - unless table_exists?("alchemy_elements_alchemy_pages") - create_table "alchemy_elements_alchemy_pages", id: false do |t| - t.references "element" - t.references "page" - end - end - - unless table_exists?("alchemy_essence_booleans") - create_table "alchemy_essence_booleans" do |t| - t.boolean "value" - t.index ["value"], name: "index_alchemy_essence_booleans_on_value" - end - end - - unless table_exists?("alchemy_essence_dates") - create_table "alchemy_essence_dates" do |t| - t.datetime "date" - end - end - - unless table_exists?("alchemy_essence_files") - create_table "alchemy_essence_files" do |t| - t.references "attachment" - t.string "title" - t.string "css_class" - t.string "link_text" - end - end - - unless table_exists?("alchemy_essence_htmls") - create_table "alchemy_essence_htmls" do |t| - t.text "source" - end - end - - unless table_exists?("alchemy_essence_links") - create_table "alchemy_essence_links" do |t| - t.string "link" - t.string "link_title" - t.string "link_target" - t.string "link_class_name" - end - end - - unless table_exists?("alchemy_essence_pages") - create_table "alchemy_essence_pages" do |t| - t.references "page" - end - end - - unless table_exists?("alchemy_essence_pictures") - create_table "alchemy_essence_pictures" do |t| - t.references "picture" - t.string "caption" - t.string "title" - t.string "alt_tag" - t.string "link" - t.string "link_class_name" - t.string "link_title" - t.string "css_class" - t.string "link_target" - t.string "crop_from" - t.string "crop_size" - t.string "render_size" - end - end - - unless table_exists?("alchemy_essence_richtexts") - create_table "alchemy_essence_richtexts" do |t| - t.text "body" - t.text "stripped_body" - t.boolean "public" - end - end - - unless table_exists?("alchemy_essence_selects") - create_table "alchemy_essence_selects" do |t| - t.string "value" - t.index ["value"], name: "index_alchemy_essence_selects_on_value" - end - end - - unless table_exists?("alchemy_essence_texts") - create_table "alchemy_essence_texts" do |t| - t.text "body" - t.string "link" - t.string "link_title" - t.string "link_class_name" - t.boolean "public", default: false - t.string "link_target" - end - end - - unless table_exists?("alchemy_folded_pages") - create_table "alchemy_folded_pages" do |t| - t.references "page", null: false, index: false - t.references "user", null: false, index: false - t.boolean "folded", default: false - t.index ["page_id", "user_id"], name: "index_alchemy_folded_pages_on_page_id_and_user_id", unique: true - end - end - - unless table_exists?("alchemy_languages") - create_table "alchemy_languages" do |t| - t.string "name" - t.string "language_code" - t.string "frontpage_name" - t.string "page_layout", default: "intro" - t.boolean "public", default: false - t.timestamps - t.references "creator" - t.references "updater" - t.boolean "default", default: false - t.string "country_code", default: "", null: false - t.references "site", null: false - t.string "locale" - t.index ["language_code", "country_code"], name: "index_alchemy_languages_on_language_code_and_country_code" - t.index ["language_code"], name: "index_alchemy_languages_on_language_code" - end - end - - unless table_exists?("alchemy_legacy_page_urls") - create_table "alchemy_legacy_page_urls" do |t| - t.string "urlname", null: false - t.references "page", null: false - t.timestamps - t.index ["urlname"], name: "index_alchemy_legacy_page_urls_on_urlname" - end - end - - unless table_exists?("alchemy_nodes") - create_table "alchemy_nodes" do |t| - t.string "name" - t.string "title" - t.string "url" - t.boolean "nofollow", default: false, null: false - t.boolean "external", default: false, null: false - t.boolean "folded", default: false, null: false - t.references "parent" - t.integer "lft", null: false - t.integer "rgt", null: false - t.integer "depth", default: 0, null: false - t.references "page" - t.references "language", null: false - t.references "creator" - t.references "updater" - t.timestamps - t.references "site", null: false - t.index ["lft"], name: "index_alchemy_nodes_on_lft" - t.index ["rgt"], name: "index_alchemy_nodes_on_rgt" - end - end - - unless table_exists?("alchemy_pages") - create_table "alchemy_pages" do |t| - t.string "name" - t.string "urlname" - t.string "title" - t.string "language_code" - t.boolean "language_root" - t.string "page_layout" - t.text "meta_keywords" - t.text "meta_description" - t.integer "lft" - t.integer "rgt" - t.references "parent", index: false - t.integer "depth" - t.boolean "visible", default: false - t.integer "locked_by" - t.boolean "restricted", default: false - t.boolean "robot_index", default: true - t.boolean "robot_follow", default: true - t.boolean "sitemap", default: true - t.boolean "layoutpage", default: false - t.timestamps - t.references "creator" - t.references "updater" - t.references "language" - t.datetime "published_at" - t.datetime "public_on" - t.datetime "public_until" - t.datetime "locked_at" - t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by" - t.index ["parent_id", "lft"], name: "index_pages_on_parent_id_and_lft" - t.index ["public_on", "public_until"], name: "index_alchemy_pages_on_public_on_and_public_until" - t.index ["rgt"], name: "index_alchemy_pages_on_rgt" - t.index ["urlname"], name: "index_pages_on_urlname" - end - end - - unless table_exists?("alchemy_pictures") - create_table "alchemy_pictures" do |t| - t.string "name" - t.string "image_file_name" - t.integer "image_file_width" - t.integer "image_file_height" - t.timestamps - t.references "creator" - t.references "updater" - t.string "upload_hash" - t.string "image_file_uid" - t.integer "image_file_size" - t.string "image_file_format" - end - end - - unless table_exists?("alchemy_sites") - create_table "alchemy_sites" do |t| - t.string "host" - t.string "name" - t.timestamps - t.boolean "public", default: false - t.text "aliases" - t.boolean "redirect_to_primary_host" - t.index ["host", "public"], name: "alchemy_sites_public_hosts_idx" - t.index ["host"], name: "index_alchemy_sites_on_host" - end - end - - unless foreign_key_exists?("alchemy_contents", column: "element_id") - add_foreign_key "alchemy_contents", "alchemy_elements", column: "element_id", on_update: :cascade, on_delete: :cascade - end - - unless foreign_key_exists?("alchemy_elements", column: "page_id") - add_foreign_key "alchemy_elements", "alchemy_pages", column: "page_id", on_update: :cascade, on_delete: :cascade - end - - unless foreign_key_exists?("alchemy_essence_pages", column: "page_id") - add_foreign_key "alchemy_essence_pages", "alchemy_pages", column: "page_id" - end - - unless foreign_key_exists?("alchemy_nodes", column: "language_id") - add_foreign_key "alchemy_nodes", "alchemy_languages", column: "language_id" - end - - unless foreign_key_exists?("alchemy_nodes", column: "page_id") - add_foreign_key "alchemy_nodes", "alchemy_pages", column: "page_id", on_delete: :cascade - end - - unless foreign_key_exists?("alchemy_nodes", column: "site_id") - add_foreign_key "alchemy_nodes", "alchemy_sites", column: "site_id", on_delete: :cascade - end - end - - def down - drop_table "alchemy_attachments" if table_exists?("alchemy_attachments") - drop_table "alchemy_contents" if table_exists?("alchemy_contents") - drop_table "alchemy_elements" if table_exists?("alchemy_elements") - drop_table "alchemy_elements_alchemy_pages" if table_exists?("alchemy_elements_alchemy_pages") - drop_table "alchemy_essence_booleans" if table_exists?("alchemy_essence_booleans") - drop_table "alchemy_essence_dates" if table_exists?("alchemy_essence_dates") - drop_table "alchemy_essence_files" if table_exists?("alchemy_essence_files") - drop_table "alchemy_essence_htmls" if table_exists?("alchemy_essence_htmls") - drop_table "alchemy_essence_links" if table_exists?("alchemy_essence_links") - drop_table "alchemy_essence_pages" if table_exists?("alchemy_essence_pages") - drop_table "alchemy_essence_pictures" if table_exists?("alchemy_essence_pictures") - drop_table "alchemy_essence_richtexts" if table_exists?("alchemy_essence_richtexts") - drop_table "alchemy_essence_selects" if table_exists?("alchemy_essence_selects") - drop_table "alchemy_essence_texts" if table_exists?("alchemy_essence_texts") - drop_table "alchemy_folded_pages" if table_exists?("alchemy_folded_pages") - drop_table "alchemy_languages" if table_exists?("alchemy_languages") - drop_table "alchemy_legacy_page_urls" if table_exists?("alchemy_legacy_page_urls") - drop_table "alchemy_nodes" if table_exists?("alchemy_nodes") - drop_table "alchemy_pages" if table_exists?("alchemy_pages") - drop_table "alchemy_pictures" if table_exists?("alchemy_pictures") - drop_table "alchemy_sites" if table_exists?("alchemy_sites") - end -end diff --git a/spec/dummy/db/migrate/20220606143558_create_alchemy_essence_nodes.alchemy.rb b/spec/dummy/db/migrate/20220606143558_create_alchemy_essence_nodes.alchemy.rb deleted file mode 100644 index 64d374c..0000000 --- a/spec/dummy/db/migrate/20220606143558_create_alchemy_essence_nodes.alchemy.rb +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200423073425) - -class CreateAlchemyEssenceNodes < ActiveRecord::Migration[6.0] - def change - create_table :alchemy_essence_nodes do |t| - t.references "node" - t.timestamps - end - add_foreign_key "alchemy_essence_nodes", "alchemy_nodes", column: "node_id" - end -end diff --git a/spec/dummy/db/migrate/20220606143559_remove_site_id_from_nodes.alchemy.rb b/spec/dummy/db/migrate/20220606143559_remove_site_id_from_nodes.alchemy.rb deleted file mode 100644 index 59564ec..0000000 --- a/spec/dummy/db/migrate/20220606143559_remove_site_id_from_nodes.alchemy.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200504210159) -class RemoveSiteIdFromNodes < ActiveRecord::Migration[6.0] - def up - remove_foreign_key :alchemy_nodes, :alchemy_sites - remove_index :alchemy_nodes, :site_id - remove_column :alchemy_nodes, :site_id, :integer, null: false - end - - def down - add_column :alchemy_nodes, :site_id, :integer, null: true - sql = <<~SQL - UPDATE alchemy_nodes - SET site_id = ( - SELECT alchemy_languages.site_id FROM alchemy_languages WHERE alchemy_nodes.language_id = alchemy_languages.id - ) WHERE - EXISTS ( - SELECT * - FROM alchemy_languages - WHERE alchemy_languages.id = alchemy_nodes.language_id - ); - SQL - - connection.execute(sql) - change_column :alchemy_nodes, :site_id, :integer, null: false - add_index :alchemy_nodes, :site_id - add_foreign_key :alchemy_nodes, :alchemy_sites, column: :site_id - end -end diff --git a/spec/dummy/db/migrate/20220606143560_add_language_id_foreign_key_to_alchemy_pages.alchemy.rb b/spec/dummy/db/migrate/20220606143560_add_language_id_foreign_key_to_alchemy_pages.alchemy.rb deleted file mode 100644 index 2987f68..0000000 --- a/spec/dummy/db/migrate/20220606143560_add_language_id_foreign_key_to_alchemy_pages.alchemy.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200505215518) - -class AddLanguageIdForeignKeyToAlchemyPages < ActiveRecord::Migration[6.0] - def change - add_foreign_key :alchemy_pages, :alchemy_languages, column: :language_id - change_column_null :alchemy_pages, :language_id, false, Alchemy::Language.default&.id - end -end diff --git a/spec/dummy/db/migrate/20220606143561_add_menu_type_to_alchemy_nodes.alchemy.rb b/spec/dummy/db/migrate/20220606143561_add_menu_type_to_alchemy_nodes.alchemy.rb deleted file mode 100644 index 9e98022..0000000 --- a/spec/dummy/db/migrate/20220606143561_add_menu_type_to_alchemy_nodes.alchemy.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200511113603) -class AddMenuTypeToAlchemyNodes < ActiveRecord::Migration[6.0] - class LocalNode < ActiveRecord::Base - self.table_name = :alchemy_nodes - acts_as_nested_set scope: :language_id - - def self.root_for(node) - return node if node.parent_id.nil? - - root_for(node.parent) - end - end - - def up - add_column :alchemy_nodes, :menu_type, :string - LocalNode.all.each do |node| - root = LocalNode.root_for(node) - menu_type = root.name.parameterize.underscore - node.update(menu_type: menu_type) - end - change_column_null :alchemy_nodes, :menu_type, false - end - - def down - remove_column :alchemy_nodes, :menu_type - end -end diff --git a/spec/dummy/db/migrate/20220606143562_make_page_layoutpage_null_false.alchemy.rb b/spec/dummy/db/migrate/20220606143562_make_page_layoutpage_null_false.alchemy.rb deleted file mode 100644 index c96ca75..0000000 --- a/spec/dummy/db/migrate/20220606143562_make_page_layoutpage_null_false.alchemy.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200514091507) -class MakePageLayoutpageNullFalse < ActiveRecord::Migration[6.0] - def change - change_column_null :alchemy_pages, :layoutpage, false, false - end -end diff --git a/spec/dummy/db/migrate/20220606143563_remove_visible_from_alchemy_pages.alchemy.rb b/spec/dummy/db/migrate/20220606143563_remove_visible_from_alchemy_pages.alchemy.rb deleted file mode 100644 index 31dd81f..0000000 --- a/spec/dummy/db/migrate/20220606143563_remove_visible_from_alchemy_pages.alchemy.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200519073500) -class RemoveVisibleFromAlchemyPages < ActiveRecord::Migration[6.0] - class LocalPage < ActiveRecord::Base - self.table_name = "alchemy_pages" - - scope :invisible, -> { where(visible: [false, nil]) } - scope :contentpages, -> { where(layoutpage: [false, nil]) } - end - - def up - if LocalPage.invisible.contentpages.where.not(parent_id: nil).any? - abort "You have invisible pages in your database! " \ - "Please re-structure your page tree before running this migration. " \ - "You might also downgrade to Alchemy 4.6 and " \ - "run the `alchemy:upgrade:4.6:restructure_page_tree` rake task." - end - - remove_column :alchemy_pages, :visible - end - - def down - add_column :alchemy_pages, :visible, :boolean, default: false - end -end diff --git a/spec/dummy/db/migrate/20220606143564_create_alchemy_picture_thumbs.alchemy.rb b/spec/dummy/db/migrate/20220606143564_create_alchemy_picture_thumbs.alchemy.rb deleted file mode 100644 index e5e965c..0000000 --- a/spec/dummy/db/migrate/20220606143564_create_alchemy_picture_thumbs.alchemy.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200617110713) - -class CreateAlchemyPictureThumbs < ActiveRecord::Migration[6.0] - def up - return if table_exists?(:alchemy_picture_thumbs) - - create_table :alchemy_picture_thumbs do |t| - t.references :picture, foreign_key: { to_table: :alchemy_pictures }, null: false - t.string :signature, null: false - t.text :uid, null: false - end - add_index :alchemy_picture_thumbs, :signature, unique: true - end - - def down - return unless table_exists?(:alchemy_picture_thumbs) - - remove_foreign_key :alchemy_picture_thumbs, :alchemy_pictures, column: :picture_id - remove_index :alchemy_picture_thumbs, :signature - drop_table :alchemy_picture_thumbs - end -end diff --git a/spec/dummy/db/migrate/20220606143565_remove_tri_state_booleans.alchemy.rb b/spec/dummy/db/migrate/20220606143565_remove_tri_state_booleans.alchemy.rb deleted file mode 100644 index 6907933..0000000 --- a/spec/dummy/db/migrate/20220606143565_remove_tri_state_booleans.alchemy.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20200907111332) - -class RemoveTriStateBooleans < ActiveRecord::Migration[6.0] - def change - change_column_null :alchemy_elements, :public, false, false - change_column_default :alchemy_elements, :public, true - - change_column_null :alchemy_elements, :folded, false - change_column_null :alchemy_elements, :unique, false - - change_column_null :alchemy_essence_richtexts, :public, false, false - change_column_default :alchemy_essence_richtexts, :public, false - - change_column_null :alchemy_essence_texts, :public, false - - change_column_null :alchemy_folded_pages, :folded, false - - change_column_null :alchemy_languages, :public, false - change_column_null :alchemy_languages, :default, false - - change_column_null :alchemy_pages, :language_root, false, false - change_column_default :alchemy_pages, :language_root, false - - change_column_null :alchemy_pages, :restricted, false - change_column_null :alchemy_pages, :robot_index, false - change_column_null :alchemy_pages, :robot_follow, false - change_column_null :alchemy_pages, :sitemap, false - - change_column_null :alchemy_sites, :public, false - change_column_null :alchemy_sites, :redirect_to_primary_host, false, false - change_column_default :alchemy_sites, :redirect_to_primary_host, false - end -end diff --git a/spec/dummy/db/migrate/20220606143566_create_page_versions.alchemy.rb b/spec/dummy/db/migrate/20220606143566_create_page_versions.alchemy.rb deleted file mode 100644 index e2b0ea3..0000000 --- a/spec/dummy/db/migrate/20220606143566_create_page_versions.alchemy.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20201207131309) - -class CreatePageVersions < ActiveRecord::Migration[6.0] - def change - create_table :alchemy_page_versions do |t| - t.references :page, - null: false, - index: true, - foreign_key: { - to_table: :alchemy_pages, - on_delete: :cascade, - } - t.datetime :public_on - t.datetime :public_until - t.index [:public_on, :public_until] - t.timestamps - end - end -end diff --git a/spec/dummy/db/migrate/20220606143567_add_page_version_id_to_alchemy_elements.alchemy.rb b/spec/dummy/db/migrate/20220606143567_add_page_version_id_to_alchemy_elements.alchemy.rb deleted file mode 100644 index 4ec5dfd..0000000 --- a/spec/dummy/db/migrate/20220606143567_add_page_version_id_to_alchemy_elements.alchemy.rb +++ /dev/null @@ -1,77 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20201207135820) - -class AddPageVersionIdToAlchemyElements < ActiveRecord::Migration[6.0] - class LocalPage < ActiveRecord::Base - self.table_name = :alchemy_pages - has_many :elements, class_name: "LocalElement", inverse_of: :page - has_many :versions, class_name: "LocalVersion", inverse_of: :page, foreign_key: :page_id - end - - class LocalVersion < ActiveRecord::Base - self.table_name = :alchemy_page_versions - belongs_to :page, class_name: "LocalPage", inverse_of: :versions - has_many :elements, class_name: "LocalElement", inverse_of: :versions - end - - class LocalElement < ActiveRecord::Base - self.table_name = :alchemy_elements - belongs_to :page, class_name: "LocalPage", inverse_of: :elements - belongs_to :page_version, class_name: "LocalVersion", inverse_of: :elements - end - - def change - add_reference :alchemy_elements, :page_version, - index: false, - foreign_key: { - to_table: :alchemy_page_versions, - on_delete: :cascade, - } - add_index :alchemy_elements, [:page_version_id, :parent_element_id], - name: "idx_alchemy_elements_on_page_version_id_and_parent_element_id" - add_index :alchemy_elements, [:page_version_id, :position], - name: "idx_alchemy_elements_on_page_version_id_and_position" - - # Add a page version for each page so we can add a not null constraint - reversible do |dir| - dir.up do - say_with_time "Create draft version for each page." do - LocalPage.find_each do |page| - next if page.versions.any? - - page.versions.create!.tap do |version| - Alchemy::Element.where(page_id: page.id).update_all(page_version_id: version.id) - end - end - LocalVersion.count - end - end - end - - change_column_null :alchemy_elements, :page_version_id, false - - # Remove the existing page relation - remove_reference :alchemy_elements, :page, - null: false, - index: false, - foreign_key: { - to_table: :alchemy_pages, - on_delete: :cascade, - on_update: :cascade, - } - if index_exists? :alchemy_elements, - :parent_element_id, - name: "index_alchemy_elements_on_page_id_and_parent_element_id" - remove_index :alchemy_elements, - column: [:parent_element_id], - name: "index_alchemy_elements_on_page_id_and_parent_element_id" - end - if index_exists? :alchemy_elements, - :position, - name: "index_elements_on_page_id_and_position" - remove_index :alchemy_elements, - column: [:position], - name: "index_elements_on_page_id_and_position" - end - end -end diff --git a/spec/dummy/db/migrate/20220606143568_rename_public_on_and_public_until_on_alchemy_pages.alchemy.rb b/spec/dummy/db/migrate/20220606143568_rename_public_on_and_public_until_on_alchemy_pages.alchemy.rb deleted file mode 100644 index 91e1799..0000000 --- a/spec/dummy/db/migrate/20220606143568_rename_public_on_and_public_until_on_alchemy_pages.alchemy.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210205143548) - -class RenamePublicOnAndPublicUntilOnAlchemyPages < ActiveRecord::Migration[6.0] - def change - remove_index :alchemy_pages, column: [:public_on, :public_until], - name: "index_alchemy_pages_on_public_on_and_public_until" - rename_column :alchemy_pages, :public_on, :legacy_public_on - rename_column :alchemy_pages, :public_until, :legacy_public_until - end -end diff --git a/spec/dummy/db/migrate/20220606143569_add_sanitized_body_to_alchemy_essence_richtexts.alchemy.rb b/spec/dummy/db/migrate/20220606143569_add_sanitized_body_to_alchemy_essence_richtexts.alchemy.rb deleted file mode 100644 index 97f9ae4..0000000 --- a/spec/dummy/db/migrate/20220606143569_add_sanitized_body_to_alchemy_essence_richtexts.alchemy.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210326105046) - -class AddSanitizedBodyToAlchemyEssenceRichtexts < ActiveRecord::Migration[6.0] - def change - add_column :alchemy_essence_richtexts, :sanitized_body, :text - end -end diff --git a/spec/dummy/db/migrate/20220606143570_add_alchemy_essence_headlines.alchemy.rb b/spec/dummy/db/migrate/20220606143570_add_alchemy_essence_headlines.alchemy.rb deleted file mode 100644 index ae64aef..0000000 --- a/spec/dummy/db/migrate/20220606143570_add_alchemy_essence_headlines.alchemy.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210406093436) - -class AddAlchemyEssenceHeadlines < ActiveRecord::Migration[6.0] - def change - create_table :alchemy_essence_headlines do |t| - t.text :body - t.integer :level - t.integer :size - t.timestamps - end - end -end diff --git a/spec/dummy/db/migrate/20220606143571_create_essence_audios.alchemy.rb b/spec/dummy/db/migrate/20220606143571_create_essence_audios.alchemy.rb deleted file mode 100644 index fa7606e..0000000 --- a/spec/dummy/db/migrate/20220606143571_create_essence_audios.alchemy.rb +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210506135919) - -class CreateEssenceAudios < ActiveRecord::Migration[6.0] - def up - return if table_exists? :alchemy_essence_audios - - create_table :alchemy_essence_audios do |t| - t.references :attachment - t.boolean :controls, default: true, null: false - t.boolean :autoplay, default: false - t.boolean :loop, default: false, null: false - t.boolean :muted, default: false, null: false - end - end - - def down - drop_table :alchemy_essence_audios - end -end diff --git a/spec/dummy/db/migrate/20220606143572_create_essence_videos.alchemy.rb b/spec/dummy/db/migrate/20220606143572_create_essence_videos.alchemy.rb deleted file mode 100644 index d3725a8..0000000 --- a/spec/dummy/db/migrate/20220606143572_create_essence_videos.alchemy.rb +++ /dev/null @@ -1,24 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210506140258) - -class CreateEssenceVideos < ActiveRecord::Migration[6.0] - def up - return if table_exists? :alchemy_essence_videos - - create_table :alchemy_essence_videos do |t| - t.references :attachment - t.string :width - t.string :height - t.boolean :allow_fullscreen, default: true, null: false - t.boolean :autoplay, default: false, null: false - t.boolean :controls, default: true, null: false - t.boolean :loop, default: false, null: false - t.boolean :muted, default: false, null: false - t.string :preload - end - end - - def down - drop_table :alchemy_essence_videos - end -end diff --git a/spec/dummy/db/migrate/20220606143573_create_alchemy_ingredients.alchemy.rb b/spec/dummy/db/migrate/20220606143573_create_alchemy_ingredients.alchemy.rb deleted file mode 100644 index 2bea037..0000000 --- a/spec/dummy/db/migrate/20220606143573_create_alchemy_ingredients.alchemy.rb +++ /dev/null @@ -1,23 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20210508091432) - -class CreateAlchemyIngredients < ActiveRecord::Migration[6.0] - def change - create_table :alchemy_ingredients do |t| - t.references :element, null: false, foreign_key: { to_table: :alchemy_elements, on_delete: :cascade } - t.string :type, index: true, null: false - t.string :role, null: false - t.text :value - if ActiveRecord::Migration.connection.adapter_name.match?(/postgres/i) - t.jsonb :data, default: {} - else - t.json :data - end - t.belongs_to :related_object, null: true, polymorphic: true, index: false - t.index [:element_id, :role], unique: true - t.index [:related_object_id, :related_object_type], name: "idx_alchemy_ingredient_relation" - - t.timestamps - end - end -end diff --git a/spec/dummy/db/migrate/20220606143574_add_searchable_to_alchemy_essence_texts.alchemy_pg_search.rb b/spec/dummy/db/migrate/20220606143574_add_searchable_to_alchemy_essence_texts.alchemy_pg_search.rb deleted file mode 100644 index e8f7a56..0000000 --- a/spec/dummy/db/migrate/20220606143574_add_searchable_to_alchemy_essence_texts.alchemy_pg_search.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from alchemy_pg_search (originally 20141211105526) -class AddSearchableToAlchemyEssenceTexts < ActiveRecord::Migration[5.1] - def change - add_column :alchemy_essence_texts, :searchable, :boolean, default: true - end -end diff --git a/spec/dummy/db/migrate/20220606143575_add_searchable_to_alchemy_essence_richtexts.alchemy_pg_search.rb b/spec/dummy/db/migrate/20220606143575_add_searchable_to_alchemy_essence_richtexts.alchemy_pg_search.rb deleted file mode 100644 index d418672..0000000 --- a/spec/dummy/db/migrate/20220606143575_add_searchable_to_alchemy_essence_richtexts.alchemy_pg_search.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from alchemy_pg_search (originally 20141211105942) -class AddSearchableToAlchemyEssenceRichtexts < ActiveRecord::Migration[5.1] - def change - add_column :alchemy_essence_richtexts, :searchable, :boolean, default: true - end -end diff --git a/spec/dummy/db/migrate/20220606143576_add_searchable_to_alchemy_essence_pictures.alchemy_pg_search.rb b/spec/dummy/db/migrate/20220606143576_add_searchable_to_alchemy_essence_pictures.alchemy_pg_search.rb deleted file mode 100644 index a1903fd..0000000 --- a/spec/dummy/db/migrate/20220606143576_add_searchable_to_alchemy_essence_pictures.alchemy_pg_search.rb +++ /dev/null @@ -1,6 +0,0 @@ -# This migration comes from alchemy_pg_search (originally 20141211110126) -class AddSearchableToAlchemyEssencePictures < ActiveRecord::Migration[5.1] - def change - add_column :alchemy_essence_pictures, :searchable, :boolean, default: true - end -end diff --git a/spec/dummy/db/migrate/20220606143577_move_searchable_to_contents.alchemy_pg_search.rb b/spec/dummy/db/migrate/20220606143577_move_searchable_to_contents.alchemy_pg_search.rb deleted file mode 100644 index bf60f8a..0000000 --- a/spec/dummy/db/migrate/20220606143577_move_searchable_to_contents.alchemy_pg_search.rb +++ /dev/null @@ -1,42 +0,0 @@ -# This migration comes from alchemy_pg_search (originally 20210923081905) -class MoveSearchableToContents < ActiveRecord::Migration[5.0] - def change - add_column :alchemy_contents, :searchable, :boolean, default: true - - { - Text: "texts", - Richtext: "richtexts", - Picture: "pictures", - }.each do |klass, table| - reversible do |dir| - dir.up do - Alchemy::Content.connection.execute <<~SQL - UPDATE alchemy_contents - SET searchable = alchemy_essence_#{table}.searchable - FROM alchemy_essence_#{table} - WHERE - alchemy_contents.essence_type = 'Alchemy::Essence#{klass}' - AND - alchemy_contents.essence_id = alchemy_essence_#{table}.id - SQL - end - - dir.down do - Alchemy::Content.connection.execute <<~SQL - UPDATE alchemy_essence_#{table} - SET searchable = alchemy_contents.searchable - FROM alchemy_contents - WHERE - alchemy_contents.essence_type = 'Alchemy::Essence#{klass}' - AND - alchemy_contents.essence_id = alchemy_essence_#{table}.id - SQL - end - end - - remove_column "alchemy_essence_#{table}", :searchable, default: true - end - - change_column_null :alchemy_contents, :searchable, false, true - end -end diff --git a/spec/dummy/db/migrate/20220826125412_create_pg_search_documents.rb b/spec/dummy/db/migrate/20220826125412_create_pg_search_documents.rb deleted file mode 100644 index a234851..0000000 --- a/spec/dummy/db/migrate/20220826125412_create_pg_search_documents.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreatePgSearchDocuments < ActiveRecord::Migration[6.0] - def up - say_with_time("Creating table for pg_search multisearch") do - create_table :pg_search_documents do |t| - t.text :content - t.belongs_to :searchable, polymorphic: true, index: true - t.timestamps null: false - end - end - end - - def down - say_with_time("Dropping table for pg_search multisearch") do - drop_table :pg_search_documents - end - end -end diff --git a/spec/dummy/db/migrate/20220826125413_add_page_id_column_to_pg_search_documents.rb b/spec/dummy/db/migrate/20220826125413_add_page_id_column_to_pg_search_documents.rb deleted file mode 100644 index 6c89db2..0000000 --- a/spec/dummy/db/migrate/20220826125413_add_page_id_column_to_pg_search_documents.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPageIdColumnToPgSearchDocuments < ActiveRecord::Migration[6.0] - def change - add_reference :pg_search_documents, :page, index: true - end -end diff --git a/spec/dummy/db/migrate/20230119143813_restrict_on_delete_page_id_foreign_key_from_alchemy_nodes.alchemy.rb b/spec/dummy/db/migrate/20230119143813_restrict_on_delete_page_id_foreign_key_from_alchemy_nodes.alchemy.rb deleted file mode 100644 index 9286904..0000000 --- a/spec/dummy/db/migrate/20230119143813_restrict_on_delete_page_id_foreign_key_from_alchemy_nodes.alchemy.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20220514072456) - -class RestrictOnDeletePageIdForeignKeyFromAlchemyNodes < ActiveRecord::Migration[6.0] - def up - remove_foreign_key :alchemy_nodes, :alchemy_pages - add_foreign_key :alchemy_nodes, :alchemy_pages, column: :page_id, on_delete: :restrict - end - - def down - remove_foreign_key :alchemy_nodes, :alchemy_pages - add_foreign_key :alchemy_nodes, :alchemy_pages, column: :page_id, on_delete: :cascade - end -end diff --git a/spec/dummy/db/migrate/20230119143814_add_playsinline_to_alchemy_essence_videos.alchemy.rb b/spec/dummy/db/migrate/20230119143814_add_playsinline_to_alchemy_essence_videos.alchemy.rb deleted file mode 100644 index 57a529e..0000000 --- a/spec/dummy/db/migrate/20230119143814_add_playsinline_to_alchemy_essence_videos.alchemy.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20220622130905) - -class AddPlaysinlineToAlchemyEssenceVideos < ActiveRecord::Migration[6.0] - def change - return if column_exists?(:alchemy_essence_videos, :playsinline) - - add_column :alchemy_essence_videos, :playsinline, :boolean, default: false, null: false - end -end diff --git a/spec/dummy/db/migrate/20230119143815_add_searchable_to_alchemy_pages.alchemy.rb b/spec/dummy/db/migrate/20230119143815_add_searchable_to_alchemy_pages.alchemy.rb deleted file mode 100644 index c526e02..0000000 --- a/spec/dummy/db/migrate/20230119143815_add_searchable_to_alchemy_pages.alchemy.rb +++ /dev/null @@ -1,8 +0,0 @@ -# This migration comes from alchemy (originally 20230119112425) -class AddSearchableToAlchemyPages < ActiveRecord::Migration[6.0] - def change - return if column_exists?(:alchemy_pages, :searchable) - - add_column :alchemy_pages, :searchable, :boolean, default: true, null: false - end -end diff --git a/spec/dummy/db/migrate/20230724074128_alchemy_six_point_one.alchemy.rb b/spec/dummy/db/migrate/20230724074128_alchemy_six_point_one.alchemy.rb deleted file mode 100644 index 6ec5b47..0000000 --- a/spec/dummy/db/migrate/20230724074128_alchemy_six_point_one.alchemy.rb +++ /dev/null @@ -1,249 +0,0 @@ -# frozen_string_literal: true -# This migration comes from alchemy (originally 20230121212637) - -class AlchemySixPointOne < ActiveRecord::Migration[ActiveRecord::Migration.current_version] - def up - unless table_exists?("alchemy_attachments") - create_table "alchemy_attachments" do |t| - t.string "name" - t.string "file_name" - t.string "file_mime_type" - t.integer "file_size" - t.integer "creator_id" - t.integer "updater_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "file_uid" - t.index ["creator_id"], name: "index_alchemy_attachments_on_creator_id" - t.index ["file_uid"], name: "index_alchemy_attachments_on_file_uid" - t.index ["updater_id"], name: "index_alchemy_attachments_on_updater_id" - end - end - - unless table_exists?("alchemy_elements_alchemy_pages") - create_table "alchemy_elements_alchemy_pages", id: false do |t| - t.integer "element_id" - t.integer "page_id" - t.index ["element_id"], name: "index_alchemy_elements_alchemy_pages_on_element_id" - t.index ["page_id"], name: "index_alchemy_elements_alchemy_pages_on_page_id" - end - end - - unless table_exists?("alchemy_folded_pages") - create_table "alchemy_folded_pages" do |t| - t.integer "page_id", null: false - t.integer "user_id", null: false - t.boolean "folded", default: false, null: false - t.index ["page_id", "user_id"], name: "index_alchemy_folded_pages_on_page_id_and_user_id", unique: true - end - end - - unless table_exists?("alchemy_sites") - create_table "alchemy_sites" do |t| - t.string "host" - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "public", default: false, null: false - t.text "aliases" - t.boolean "redirect_to_primary_host", default: false, null: false - t.index ["host", "public"], name: "alchemy_sites_public_hosts_idx" - t.index ["host"], name: "index_alchemy_sites_on_host" - end - end - - unless table_exists?("alchemy_languages") - create_table "alchemy_languages" do |t| - t.string "name" - t.string "language_code" - t.string "frontpage_name" - t.string "page_layout", default: "intro" - t.boolean "public", default: false, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "creator_id" - t.integer "updater_id" - t.boolean "default", default: false, null: false - t.string "country_code", default: "", null: false - t.references "site", null: false, foreign_key: {to_table: :alchemy_sites} - t.string "locale" - t.index ["creator_id"], name: "index_alchemy_languages_on_creator_id" - t.index ["language_code", "country_code"], name: "index_alchemy_languages_on_language_code_and_country_code" - t.index ["language_code"], name: "index_alchemy_languages_on_language_code" - t.index ["updater_id"], name: "index_alchemy_languages_on_updater_id" - end - end - - unless table_exists?("alchemy_legacy_page_urls") - create_table "alchemy_legacy_page_urls" do |t| - t.string "urlname", null: false - t.integer "page_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["page_id"], name: "index_alchemy_legacy_page_urls_on_page_id" - t.index ["urlname"], name: "index_alchemy_legacy_page_urls_on_urlname" - end - end - - unless table_exists?("alchemy_pages") - create_table "alchemy_pages" do |t| - t.string "name" - t.string "urlname" - t.string "title" - t.string "language_code" - t.boolean "language_root", default: false, null: false - t.string "page_layout" - t.text "meta_keywords" - t.text "meta_description" - t.integer "lft" - t.integer "rgt" - t.integer "parent_id" - t.integer "depth" - t.integer "locked_by" - t.boolean "restricted", default: false, null: false - t.boolean "robot_index", default: true, null: false - t.boolean "robot_follow", default: true, null: false - t.boolean "sitemap", default: true, null: false - t.boolean "layoutpage", default: false, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "creator_id" - t.integer "updater_id" - t.references "language", null: false, foreign_key: {to_table: :alchemy_languages} - t.datetime "published_at", precision: nil - t.datetime "locked_at", precision: nil - t.index ["creator_id"], name: "index_alchemy_pages_on_creator_id" - t.index ["locked_at", "locked_by"], name: "index_alchemy_pages_on_locked_at_and_locked_by" - t.index ["parent_id", "lft"], name: "index_pages_on_parent_id_and_lft" - t.index ["rgt"], name: "index_alchemy_pages_on_rgt" - t.index ["updater_id"], name: "index_alchemy_pages_on_updater_id" - t.index ["urlname"], name: "index_pages_on_urlname" - end - end - - unless table_exists?("alchemy_page_versions") - create_table "alchemy_page_versions" do |t| - t.references "page", null: false, foreign_key: {to_table: :alchemy_pages, on_delete: :cascade} - t.datetime "public_on", precision: nil - t.datetime "public_until", precision: nil - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["public_on", "public_until"], name: "index_alchemy_page_versions_on_public_on_and_public_until" - end - end - - unless table_exists?("alchemy_elements") - create_table "alchemy_elements" do |t| - t.string "name" - t.integer "position" - t.boolean "public", default: true, null: false - t.boolean "folded", default: false, null: false - t.boolean "unique", default: false, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "creator_id" - t.integer "updater_id" - t.integer "parent_element_id" - t.boolean "fixed", default: false, null: false - t.references "page_version", null: false, foreign_key: {to_table: :alchemy_page_versions, on_delete: :cascade} - t.index ["creator_id"], name: "index_alchemy_elements_on_creator_id" - t.index ["fixed"], name: "index_alchemy_elements_on_fixed" - t.index ["page_version_id", "parent_element_id"], name: "idx_alchemy_elements_on_page_version_id_and_parent_element_id" - t.index ["page_version_id", "position"], name: "idx_alchemy_elements_on_page_version_id_and_position" - t.index ["updater_id"], name: "index_alchemy_elements_on_updater_id" - end - end - - unless table_exists?("alchemy_ingredients") - create_table "alchemy_ingredients" do |t| - t.references "element", null: false, foreign_key: {to_table: :alchemy_elements, on_delete: :cascade} - t.string "type", null: false - t.string "role", null: false - t.text "value" - if ActiveRecord::Migration.connection.adapter_name.match?(/postgres/i) - t.jsonb :data, default: {} - else - t.json :data - end - t.string "related_object_type" - t.integer "related_object_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["element_id", "role"], name: "index_alchemy_ingredients_on_element_id_and_role", unique: true - t.index ["related_object_id", "related_object_type"], name: "idx_alchemy_ingredient_relation" - t.index ["type"], name: "index_alchemy_ingredients_on_type" - end - end - - unless table_exists?("alchemy_nodes") - create_table "alchemy_nodes" do |t| - t.string "name" - t.string "title" - t.string "url" - t.boolean "nofollow", default: false, null: false - t.boolean "external", default: false, null: false - t.boolean "folded", default: false, null: false - t.integer "parent_id" - t.integer "lft", null: false - t.integer "rgt", null: false - t.integer "depth", default: 0, null: false - t.references "page", foreign_key: {to_table: :alchemy_pages, on_delete: :restrict} - t.references "language", null: false, foreign_key: {to_table: :alchemy_languages} - t.integer "creator_id" - t.integer "updater_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "menu_type", null: false - t.index ["creator_id"], name: "index_alchemy_nodes_on_creator_id" - t.index ["lft"], name: "index_alchemy_nodes_on_lft" - t.index ["parent_id"], name: "index_alchemy_nodes_on_parent_id" - t.index ["rgt"], name: "index_alchemy_nodes_on_rgt" - t.index ["updater_id"], name: "index_alchemy_nodes_on_updater_id" - end - end - - unless table_exists?("alchemy_pictures") - create_table "alchemy_pictures" do |t| - t.string "name" - t.string "image_file_name" - t.integer "image_file_width" - t.integer "image_file_height" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "creator_id" - t.integer "updater_id" - t.string "upload_hash" - t.string "image_file_uid" - t.integer "image_file_size" - t.string "image_file_format" - t.index ["creator_id"], name: "index_alchemy_pictures_on_creator_id" - t.index ["updater_id"], name: "index_alchemy_pictures_on_updater_id" - end - end - - unless table_exists?("alchemy_picture_thumbs") - create_table "alchemy_picture_thumbs" do |t| - t.references "picture", null: false, foreign_key: {to_table: :alchemy_pictures} - t.string "signature", null: false - t.text "uid", null: false - t.index ["signature"], name: "index_alchemy_picture_thumbs_on_signature", unique: true - end - end - end - - def down - drop_table "alchemy_attachments" if table_exists?("alchemy_attachments") - drop_table "alchemy_elements" if table_exists?("alchemy_elements") - drop_table "alchemy_elements_alchemy_pages" if table_exists?("alchemy_elements_alchemy_pages") - drop_table "alchemy_folded_pages" if table_exists?("alchemy_folded_pages") - drop_table "alchemy_ingredients" if table_exists?("alchemy_ingredients") - drop_table "alchemy_languages" if table_exists?("alchemy_languages") - drop_table "alchemy_legacy_page_urls" if table_exists?("alchemy_legacy_page_urls") - drop_table "alchemy_nodes" if table_exists?("alchemy_nodes") - drop_table "alchemy_page_versions" if table_exists?("alchemy_page_versions") - drop_table "alchemy_pages" if table_exists?("alchemy_pages") - drop_table "alchemy_picture_thumbs" if table_exists?("alchemy_picture_thumbs") - drop_table "alchemy_pictures" if table_exists?("alchemy_pictures") - drop_table "alchemy_sites" if table_exists?("alchemy_sites") - end -end diff --git a/spec/dummy/db/migrate/20230724074129_add_indexes_to_alchemy_pictures.alchemy.rb b/spec/dummy/db/migrate/20230724074129_add_indexes_to_alchemy_pictures.alchemy.rb deleted file mode 100644 index cf1b9fa..0000000 --- a/spec/dummy/db/migrate/20230724074129_add_indexes_to_alchemy_pictures.alchemy.rb +++ /dev/null @@ -1,7 +0,0 @@ -# This migration comes from alchemy (originally 20230505132743) -class AddIndexesToAlchemyPictures < ActiveRecord::Migration[ActiveRecord::Migration.current_version] - def change - add_index :alchemy_pictures, :name, if_not_exists: true - add_index :alchemy_pictures, :image_file_name, if_not_exists: true - end -end diff --git a/spec/dummy/db/migrate/20231218165617_add_searchable_content.rb b/spec/dummy/db/migrate/20231218165617_add_searchable_content.rb deleted file mode 100644 index 72a666b..0000000 --- a/spec/dummy/db/migrate/20231218165617_add_searchable_content.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddSearchableContent < ActiveRecord::Migration[7.0] - def change - add_column :pg_search_documents, :searchable_content, :virtual, - type: :tsvector, - as: "to_tsvector('#{Alchemy::PgSearch.config.fetch(:dictionary, "simple")}', coalesce(content, ''))", - stored: true, - if_not_exists: true - end -end diff --git a/spec/dummy/db/schema.rb b/spec/dummy/db/schema.rb index 805ca13..c0d84e2 100644 --- a/spec/dummy/db/schema.rb +++ b/spec/dummy/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.0].define(version: 2023_12_18_165617) do +ActiveRecord::Schema[7.1].define(version: 2024_10_08_083843) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -19,8 +19,8 @@ t.string "file_name" t.string "file_mime_type" t.integer "file_size" - t.bigint "creator_id" - t.bigint "updater_id" + t.integer "creator_id" + t.integer "updater_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "file_uid" @@ -29,24 +29,6 @@ t.index ["updater_id"], name: "index_alchemy_attachments_on_updater_id" end - create_table "alchemy_cells", id: :serial, force: :cascade do |t| - t.integer "page_id", null: false - t.string "name" - t.datetime "created_at", precision: nil, null: false - t.datetime "updated_at", precision: nil, null: false - t.index ["page_id"], name: "index_alchemy_cells_on_page_id" - end - - create_table "alchemy_contents", force: :cascade do |t| - t.string "name" - t.string "essence_type", null: false - t.bigint "essence_id", null: false - t.bigint "element_id", null: false - t.boolean "searchable", default: true, null: false - t.index ["element_id"], name: "index_alchemy_contents_on_element_id" - t.index ["essence_type", "essence_id"], name: "index_alchemy_contents_on_essence_type_and_essence_id", unique: true - end - create_table "alchemy_elements", force: :cascade do |t| t.string "name" t.integer "position" @@ -55,136 +37,29 @@ t.boolean "unique", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "creator_id" - t.bigint "updater_id" - t.bigint "parent_element_id" + t.integer "creator_id" + t.integer "updater_id" + t.integer "parent_element_id" t.boolean "fixed", default: false, null: false t.bigint "page_version_id", null: false t.index ["creator_id"], name: "index_alchemy_elements_on_creator_id" t.index ["fixed"], name: "index_alchemy_elements_on_fixed" t.index ["page_version_id", "parent_element_id"], name: "idx_alchemy_elements_on_page_version_id_and_parent_element_id" t.index ["page_version_id", "position"], name: "idx_alchemy_elements_on_page_version_id_and_position" + t.index ["page_version_id"], name: "index_alchemy_elements_on_page_version_id" t.index ["updater_id"], name: "index_alchemy_elements_on_updater_id" end create_table "alchemy_elements_alchemy_pages", id: false, force: :cascade do |t| - t.bigint "element_id" - t.bigint "page_id" + t.integer "element_id" + t.integer "page_id" t.index ["element_id"], name: "index_alchemy_elements_alchemy_pages_on_element_id" t.index ["page_id"], name: "index_alchemy_elements_alchemy_pages_on_page_id" end - create_table "alchemy_essence_audios", force: :cascade do |t| - t.bigint "attachment_id" - t.boolean "controls", default: true, null: false - t.boolean "autoplay", default: false - t.boolean "loop", default: false, null: false - t.boolean "muted", default: false, null: false - t.index ["attachment_id"], name: "index_alchemy_essence_audios_on_attachment_id" - end - - create_table "alchemy_essence_booleans", force: :cascade do |t| - t.boolean "value" - t.index ["value"], name: "index_alchemy_essence_booleans_on_value" - end - - create_table "alchemy_essence_dates", force: :cascade do |t| - t.datetime "date", precision: nil - end - - create_table "alchemy_essence_files", force: :cascade do |t| - t.bigint "attachment_id" - t.string "title" - t.string "css_class" - t.string "link_text" - t.index ["attachment_id"], name: "index_alchemy_essence_files_on_attachment_id" - end - - create_table "alchemy_essence_headlines", force: :cascade do |t| - t.text "body" - t.integer "level" - t.integer "size" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "alchemy_essence_htmls", force: :cascade do |t| - t.text "source" - end - - create_table "alchemy_essence_links", force: :cascade do |t| - t.string "link" - t.string "link_title" - t.string "link_target" - t.string "link_class_name" - end - - create_table "alchemy_essence_nodes", force: :cascade do |t| - t.bigint "node_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["node_id"], name: "index_alchemy_essence_nodes_on_node_id" - end - - create_table "alchemy_essence_pages", force: :cascade do |t| - t.bigint "page_id" - t.index ["page_id"], name: "index_alchemy_essence_pages_on_page_id" - end - - create_table "alchemy_essence_pictures", force: :cascade do |t| - t.bigint "picture_id" - t.string "caption" - t.string "title" - t.string "alt_tag" - t.string "link" - t.string "link_class_name" - t.string "link_title" - t.string "css_class" - t.string "link_target" - t.string "crop_from" - t.string "crop_size" - t.string "render_size" - t.index ["picture_id"], name: "index_alchemy_essence_pictures_on_picture_id" - end - - create_table "alchemy_essence_richtexts", force: :cascade do |t| - t.text "body" - t.text "stripped_body" - t.boolean "public", default: false, null: false - t.text "sanitized_body" - end - - create_table "alchemy_essence_selects", force: :cascade do |t| - t.string "value" - t.index ["value"], name: "index_alchemy_essence_selects_on_value" - end - - create_table "alchemy_essence_texts", force: :cascade do |t| - t.text "body" - t.string "link" - t.string "link_title" - t.string "link_class_name" - t.boolean "public", default: false, null: false - t.string "link_target" - end - - create_table "alchemy_essence_videos", force: :cascade do |t| - t.bigint "attachment_id" - t.string "width" - t.string "height" - t.boolean "allow_fullscreen", default: true, null: false - t.boolean "autoplay", default: false, null: false - t.boolean "controls", default: true, null: false - t.boolean "loop", default: false, null: false - t.boolean "muted", default: false, null: false - t.string "preload" - t.boolean "playsinline", default: false, null: false - t.index ["attachment_id"], name: "index_alchemy_essence_videos_on_attachment_id" - end - create_table "alchemy_folded_pages", force: :cascade do |t| - t.bigint "page_id", null: false - t.bigint "user_id", null: false + t.integer "page_id", null: false + t.integer "user_id", null: false t.boolean "folded", default: false, null: false t.index ["page_id", "user_id"], name: "index_alchemy_folded_pages_on_page_id_and_user_id", unique: true end @@ -196,7 +71,7 @@ t.text "value" t.jsonb "data", default: {} t.string "related_object_type" - t.bigint "related_object_id" + t.integer "related_object_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["element_id", "role"], name: "index_alchemy_ingredients_on_element_id_and_role", unique: true @@ -213,8 +88,8 @@ t.boolean "public", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "creator_id" - t.bigint "updater_id" + t.integer "creator_id" + t.integer "updater_id" t.boolean "default", default: false, null: false t.string "country_code", default: "", null: false t.bigint "site_id", null: false @@ -228,7 +103,7 @@ create_table "alchemy_legacy_page_urls", force: :cascade do |t| t.string "urlname", null: false - t.bigint "page_id", null: false + t.integer "page_id", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false t.index ["page_id"], name: "index_alchemy_legacy_page_urls_on_page_id" @@ -242,14 +117,14 @@ t.boolean "nofollow", default: false, null: false t.boolean "external", default: false, null: false t.boolean "folded", default: false, null: false - t.bigint "parent_id" + t.integer "parent_id" t.integer "lft", null: false t.integer "rgt", null: false t.integer "depth", default: 0, null: false t.bigint "page_id" t.bigint "language_id", null: false - t.bigint "creator_id" - t.bigint "updater_id" + t.integer "creator_id" + t.integer "updater_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "menu_type", null: false @@ -262,6 +137,12 @@ t.index ["updater_id"], name: "index_alchemy_nodes_on_updater_id" end + create_table "alchemy_page_mutexes", force: :cascade do |t| + t.bigint "page_id", null: false + t.datetime "created_at", precision: nil + t.index ["page_id"], name: "index_alchemy_page_mutexes_on_page_id", unique: true + end + create_table "alchemy_page_versions", force: :cascade do |t| t.bigint "page_id", null: false t.datetime "public_on", precision: nil @@ -283,7 +164,7 @@ t.text "meta_description" t.integer "lft" t.integer "rgt" - t.bigint "parent_id" + t.integer "parent_id" t.integer "depth" t.integer "locked_by" t.boolean "restricted", default: false, null: false @@ -293,12 +174,10 @@ t.boolean "layoutpage", default: false, null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "creator_id" - t.bigint "updater_id" + t.integer "creator_id" + t.integer "updater_id" t.bigint "language_id", null: false t.datetime "published_at", precision: nil - t.datetime "legacy_public_on", precision: nil - t.datetime "legacy_public_until", precision: nil t.datetime "locked_at", precision: nil t.boolean "searchable", default: true, null: false t.index ["creator_id"], name: "index_alchemy_pages_on_creator_id" @@ -325,8 +204,8 @@ t.integer "image_file_height" t.datetime "created_at", null: false t.datetime "updated_at", null: false - t.bigint "creator_id" - t.bigint "updater_id" + t.integer "creator_id" + t.integer "updater_id" t.string "upload_hash" t.string "image_file_uid" t.integer "image_file_size" @@ -378,7 +257,7 @@ t.bigint "page_id" t.virtual "searchable_content", type: :tsvector, as: "to_tsvector('simple'::regconfig, COALESCE(content, ''::text))", stored: true t.index ["page_id"], name: "index_pg_search_documents_on_page_id" - t.index ["searchable_type", "searchable_id"], name: "index_pg_search_documents_on_searchable_type_and_searchable_id" + t.index ["searchable_type", "searchable_id"], name: "index_pg_search_documents_on_searchable" end create_table "users", force: :cascade do |t| @@ -388,13 +267,12 @@ t.datetime "updated_at", null: false end - add_foreign_key "alchemy_contents", "alchemy_elements", column: "element_id", on_update: :cascade, on_delete: :cascade add_foreign_key "alchemy_elements", "alchemy_page_versions", column: "page_version_id", on_delete: :cascade - add_foreign_key "alchemy_essence_nodes", "alchemy_nodes", column: "node_id" - add_foreign_key "alchemy_essence_pages", "alchemy_pages", column: "page_id" add_foreign_key "alchemy_ingredients", "alchemy_elements", column: "element_id", on_delete: :cascade + add_foreign_key "alchemy_languages", "alchemy_sites", column: "site_id" add_foreign_key "alchemy_nodes", "alchemy_languages", column: "language_id" add_foreign_key "alchemy_nodes", "alchemy_pages", column: "page_id", on_delete: :restrict + add_foreign_key "alchemy_page_mutexes", "alchemy_pages", column: "page_id" add_foreign_key "alchemy_page_versions", "alchemy_pages", column: "page_id", on_delete: :cascade add_foreign_key "alchemy_pages", "alchemy_languages", column: "language_id" add_foreign_key "alchemy_picture_thumbs", "alchemy_pictures", column: "picture_id"