Module: Tracker::Migration

Defined in:
lib/tracker/migration.rb

Defined Under Namespace

Classes: Options

Instance Method Summary collapse

Instance Method Details

#migrate!Object



9
10
11
12
13
14
15
16
# File 'lib/tracker/migration.rb', line 9

def migrate!
  template = File.read(File.dirname(__FILE__) + "/tracker.sql")
  renderer = ERB.new(template)

  options = Options.new(reinstall: false)
  sql = options.render(renderer)
  ActiveRecord::Base.connection.execute sql
end

#track_table!(table) ⇒ Object



18
19
20
21
# File 'lib/tracker/migration.rb', line 18

def track_table!(table)
  sql = "SELECT tracker.track_table('#{table}', 'id', array['created_at','updated_at', 'tsv', 'pg_search'])"
  ActiveRecord::Base.connection.execute sql
end