Class: DbCompile::Trigger
- Defined in:
- lib/dbcompile/trigger.rb
Instance Attribute Summary
Attributes inherited from Construct
#dependencies, #name, #path, #root_path
Instance Method Summary collapse
Methods inherited from Construct
#does_one_exist?, #execute, #initialize, #source
Constructor Details
This class inherits a constructor from DbCompile::Construct
Instance Method Details
#build_path ⇒ Object
3 4 5 |
# File 'lib/dbcompile/trigger.rb', line 3 def build_path @path = File.join('triggers', "#{name}.sql") end |
#verify ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/dbcompile/trigger.rb', line 7 def verify sql = nil case ActiveRecord::Base.connection.class.to_s when 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' sql = "SELECT * FROM pg_trigger WHERE tgname = '#{name}';" end does_one_exist?(sql) end |