Sha256: 92c9b65d1ca49a70493867c74f1697db69a5b5be39b0eef7ab2e242cfcacf24f

Contents?: true

Size: 815 Bytes

Versions: 6

Compression:

Stored size: 815 Bytes

Contents

require "rails"

module Fx
  module SchemaDumper
    # @api private
    module Function
      def tables(stream)
        if Fx.configuration.dump_functions_at_beginning_of_schema
          functions(stream)
          empty_line(stream)
        end

        super

        unless Fx.configuration.dump_functions_at_beginning_of_schema
          functions(stream)
          empty_line(stream)
        end
      end

      def empty_line(stream)
        stream.puts if dumpable_functions_in_database.any?
      end

      def functions(stream)
        dumpable_functions_in_database.each do |function|
          stream.puts(function.to_schema)
        end
      end

      private

      def dumpable_functions_in_database
        @_dumpable_functions_in_database ||= Fx.database.functions
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
fx-0.8.0 lib/fx/schema_dumper/function.rb
fx-0.7.0 lib/fx/schema_dumper/function.rb
fx-jets-0.6.3s lib/fx/schema_dumper/function.rb
fx-0.6.2 lib/fx/schema_dumper/function.rb
fx-0.6.1 lib/fx/schema_dumper/function.rb
fx-0.6.0 lib/fx/schema_dumper/function.rb