Class: Textacular::TrigramInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/textacular/trigram_installer.rb

Instance Method Summary collapse

Instance Method Details

#generate_migrationObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/textacular/trigram_installer.rb', line 2

def generate_migration
  content = "class InstallTrigram < ActiveRecord::Migration[5.0]\ndef self.up\n  ActiveRecord::Base.connection.execute(\"CREATE EXTENSION IF NOT EXISTS pg_trgm;\")\nend\n\ndef self.down\n  ActiveRecord::Base.connection.execute(\"DROP EXTENSION pg_trgm;\")\nend\nend\n"
  filename = "install_trigram"
  generator = Textacular::MigrationGenerator.new(filename, content)
  generator.generate_migration
end