Class: Hotdog::Commands::Gc

Inherits:
BaseCommand show all
Defined in:
lib/hotdog/commands/gc.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#application, #formatter, #logger, #options, #tags

Instance Method Summary collapse

Methods inherited from BaseCommand

#execute, #initialize

Constructor Details

This class inherits a constructor from Hotdog::Commands::BaseCommand

Instance Method Details

#run(args = []) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/hotdog/commands/gc.rb', line 6

def run(args=[])
  execute("    DELETE FROM hosts WHERE id NOT IN ( SELECT DISTINCT host_id FROM hosts_tags );\n  EOS\n  execute(<<-EOS)\n    DELETE FROM tags WHERE id NOT IN ( SELECT DISTINCT tag_id FROM hosts_tags );\n  EOS\nend\n")