Sha256: 7b848f7b410f913b6cfc8a90464395f7302cf40ef6fa55685511c46bee41d7d4

Contents?: true

Size: 1.29 KB

Versions: 60

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require_relative "tasks/harden_gutentag_migrations"

module Alchemy
  class Upgrader::FivePointZero < Upgrader
    class << self
      def install_gutentag_migrations
        desc "Install Gutentag migrations"
        Rake::Task["gutentag:install:migrations"].invoke
        Alchemy::Upgrader::Tasks::HardenGutentagMigrations.new.patch_migrations
        Rake::Task["db:migrate"].invoke
      end

      def remove_layout_roots
        desc "Remove layout root pages"
        layout_roots = Alchemy::Page.where(layoutpage: true).where("name LIKE 'Layoutroot for%'")
        if layout_roots.size.positive?
          log "Removing #{layout_roots.size} layout root pages."
          layout_roots.delete_all
          Alchemy::Page.where(layoutpage: true).update_all(parent_id: nil)
          log "Done.", :success
        else
          log "No layout root pages found.", :skip
        end
      end

      def remove_root_page
        desc "Remove root page"
        root_page = Alchemy::Page.find_by(parent_id: nil, name: "Root")
        if root_page
          Alchemy::Page.where(parent_id: root_page.id).update_all(parent_id: nil)
          root_page.delete
          log "Done.", :success
        else
          log "Root page not found.", :skip
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
alchemy_cms-6.1.10 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.9 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.8 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.7 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.6 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.5 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.14 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.4 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.13 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.3 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.2 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.1 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.1.0 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.12 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.11 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.10 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.9 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.8 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.7 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.6 lib/alchemy/upgrader/five_point_zero.rb