module PgSaurus::SchemaDumper::FunctionMethods
Support for dumping database functions.
Public Instance Methods
dump_functions(stream)
click to toggle source
Writes out a command to create each detected function.
# File lib/pg_saurus/schema_dumper/function_methods.rb, line 16 def dump_functions(stream) @connection.functions.each do |function| statement = " create_function '#{function.name}', '#{function.returning}', <<-FUNCTION_DEFINITION.gsub(/^[\s]{4}/, ''), volatility: :#{function.volatility}" statement << "\n#{function.definition.split("\n").map{|line| " #{line}" }.join("\n")}" statement << "\n FUNCTION_DEFINITION\n\n" stream.puts statement end end
tables(stream)
click to toggle source
:nodoc
Calls superclass method
# File lib/pg_saurus/schema_dumper/function_methods.rb, line 5 def tables(stream) # Functions must be dumped before tables. # Some indexes may use defined functions. dump_functions stream super(stream) stream end