Sha256: 0a80e1758d1b45ddb0eb9bcda65f71f6d6d4e2881c8b653a44df55abb871441e
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module AR module Sequence module SchemaDumper def header(stream) super sequences(stream) end def sequences(stream) sequences = @connection.check_sequences return if sequences.empty? sequences.each do |seq| next unless @connection.custom_sequence?(seq["sequence_name"]) start_value = seq["start_value"] increment = seq["increment"] options = [] if start_value && Integer(start_value) != 1 options << "start: #{start_value}" end if increment && Integer(increment) != 1 options << "increment: #{increment}" end statement = [ "create_sequence", seq["sequence_name"].inspect ].join(" ") if options.any? statement << (options.any? ? ", #{options.join(', ')}" : "") end stream.puts " #{statement}" end stream.puts end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ar-sequence-0.2.0 | lib/ar/sequence/schema_dumper.rb |