Module: DbObfuscation::Util::Trigger
Instance Method Summary collapse
- #disable(table) ⇒ Object
- #drop(table) ⇒ Object
- #enable(table) ⇒ Object
- #exists?(table) ⇒ Boolean
- #tables ⇒ Object
Instance Method Details
#disable(table) ⇒ Object
22 23 24 |
# File 'lib/db_obfuscation/util/trigger.rb', line 22 def disable(table) table == :all ? disable_triggers : disable_trigger(table) end |
#drop(table) ⇒ Object
18 19 20 |
# File 'lib/db_obfuscation/util/trigger.rb', line 18 def drop(table) table == :all ? drop_triggers : drop_trigger(table) end |
#enable(table) ⇒ Object
26 27 28 |
# File 'lib/db_obfuscation/util/trigger.rb', line 26 def enable(table) table == :all ? enable_triggers : enable_trigger(table) end |
#exists?(table) ⇒ Boolean
30 31 32 |
# File 'lib/db_obfuscation/util/trigger.rb', line 30 def exists?(table) tables.include?(table.to_s) end |
#tables ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/db_obfuscation/util/trigger.rb', line 7 def tables query = <<-sql SELECT tables.relname as table_name FROM pg_trigger triggers, pg_class tables WHERE triggers.tgrelid = tables.oid AND tables.relname !~ '^pg_' AND triggers.tgname LIKE '#{prefix}%' sql DbObfuscation::DB[query].map(:table_name) end |