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.0.5 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.4 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.3 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.2 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.1 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc7 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc6 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc5 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc4 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc3 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc2 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.rc1 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.b6 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.b5 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.pre.b4 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.b3 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.b2 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-6.0.0.b1 lib/alchemy/upgrader/five_point_zero.rb
alchemy_cms-5.2.1 lib/alchemy/upgrader/five_point_zero.rb