Skip to content
Browse files

add :generated flag support to drop_trigger, fixes #10

  • Loading branch information...
1 parent e0c518c commit 28b8c7878ba53238a4b23571607eeb0f83cfd8b1 @jenseng committed
Showing with 7 additions and 3 deletions.
  1. +1 −0 README.rdoc
  2. +1 −1 VERSION
  3. +3 −1 lib/hair_trigger/builder.rb
  4. +2 −1 lib/hair_trigger/migration_reader.rb
View
1 README.rdoc
@@ -258,6 +258,7 @@ you want to support.
== Version History
+* 0.1.13 drop_trigger fix
* 0.1.12 DB-specific trigger body support, bugfixes
* 0.1.11 Safer migration loading, some speedups
* 0.1.10 Sped up migration evaluation
View
2 VERSION
@@ -1 +1 @@
-0.1.12
+0.1.13
View
4 lib/hair_trigger/builder.rb
@@ -195,7 +195,9 @@ def generate(validate = true)
def to_ruby(indent = '', always_generated = true)
prepare!
if options[:drop]
- "#{indent}drop_trigger(#{prepared_name.inspect}, #{options[:table].inspect})"
+ str = "#{indent}drop_trigger(#{prepared_name.inspect}, #{options[:table].inspect}"
+ str << ", :generated => true" if always_generated || options[:generated]
+ str << ")"
else
if @trigger_group
str = "t." + chained_calls_to_ruby + " do\n"
View
3 lib/hair_trigger/migration_reader.rb
@@ -53,7 +53,8 @@ def generate_create_trigger(*arguments)
end
def generate_drop_trigger(*arguments)
- ::HairTrigger::Builder.new(arguments[0], {:table => arguments[1], :drop => true})
+ options = arguments[2] || {}
+ ::HairTrigger::Builder.new(arguments[0], options.update({:table => arguments[1], :drop => true}))
end
def generator

0 comments on commit 28b8c78

Please sign in to comment.
Something went wrong with that request. Please try again.