Sha256: 40891a84b7791e92ecfe3873e021a09571b39589c2dae177ed5b655ffd8a5ee9

Contents?: true

Size: 906 Bytes

Versions: 87

Compression:

Stored size: 906 Bytes

Contents

# frozen_string_literal: true

require "thor"

module Alchemy::Upgrader::Tasks
  class HardenGutentagMigrations < Thor
    include Thor::Actions

    no_tasks do
      def patch_migrations
        sentinel = /def up/

        migration_file = Dir.glob("db/migrate/*_gutentag_tables.gutentag.rb").first
        if migration_file
          inject_into_file migration_file,
            "\n    # inserted by Alchemy CMS upgrader\n    return if table_exists?(:gutentag_taggings)\n",
            { after: sentinel, verbose: true }
        end

        migration_file = Dir.glob("db/migrate/*_gutentag_cache_counter.gutentag.rb").first
        if migration_file
          inject_into_file migration_file,
            "\n    # inserted by Alchemy CMS upgrader\n    return if column_exists?(:gutentag_tags, :taggings_count)\n",
            { after: sentinel, verbose: true }
        end
      end
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

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