Sha256: 364e321c69169d19826c645290af44ff9b04bdad67e7c4a2b66101324ba61ceb

Contents?: true

Size: 872 Bytes

Versions: 8

Compression:

Stored size: 872 Bytes

Contents

require "rails/generators"
require "rails/generators/active_record/migration"

module Alchemy
  module PgSearch
    class InstallGenerator < ::Rails::Generators::Base
      include ActiveRecord::Generators::Migration

      desc "Install Alchemy PgSearch - Gem into Rails App."

      source_root(File.expand_path("../../../..", __dir__))

      def install_migrations
        # Install pg_search multisearch - migration - the pg_search is not testing if the migration already exists
        generate("pg_search:migration:multisearch", abort_on_failure: true) unless self.class.migration_exists?("db/migrate", 'create_pg_search_documents')

        # Copy the migrations of the gem
        rake("alchemy_pg_search:install:migrations", abort_on_failure: true)
        
        # run migrations
        rake("db:migrate", abort_on_failure: true)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alchemy-pg_search-6.1.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-6.0.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-5.2.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-5.1.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-5.0.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-4.2.0 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-4.1.1 lib/generators/alchemy/pg_search/install/install_generator.rb
alchemy-pg_search-4.1.0 lib/generators/alchemy/pg_search/install/install_generator.rb