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.0.0.pre.b6 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-6.0.0.pre.b5 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-6.0.0.pre.b4 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-6.0.0.b3 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-6.0.0.b2 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-6.0.0.b1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.2.1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.4 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.0.4 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.3 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.2.0 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.2.0.rc1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.2.0.b1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.2 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.0.3 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.0 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.0.2 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.0.rc1 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb
alchemy_cms-5.1.0.beta2 lib/alchemy/upgrader/tasks/harden_gutentag_migrations.rb