Class: Breathing::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/breathing/installer.rb

Instance Method Summary collapse

Instance Method Details

#installObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/breathing/installer.rb', line 10

def install
  raise Breathing::UnsupportedError, "Version MySQL 5.6 is not supported." unless database_supported_version?

  create_log_table

  models.each do |model|
    column_names = model.columns.map(&:name)
    if column_names.include?('id') && column_names.include?('updated_at')
      Breathing::Trigger.new(model, log_table_name).create
    end
  end
end

#uninstallObject



23
24
25
26
# File 'lib/breathing/installer.rb', line 23

def uninstall
  drop_log_table
  models.each { |model| Breathing::Trigger.new(model, log_table_name).drop }
end