Class: Alchemy::PgSearch::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
ActiveRecord::Generators::Migration
Defined in:
lib/generators/alchemy/pg_search/install/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#install_migrationsObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/generators/alchemy/pg_search/install/install_generator.rb', line 13

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