Sha256: 51a2b82f753d5eecf9cf747bdf773acc0dd393356a8883fce66cba1c7028f287
Contents?: true
Size: 661 Bytes
Versions: 44
Compression:
Stored size: 661 Bytes
Contents
require_relative "migration_helper" Sequel.migration do up do if PactBroker::MigrationHelper.postgres? row = from(:verification_sequence_number).select(:value).limit(1).first start = row ? row[:value] + 100 : 1 run("CREATE SEQUENCE verification_number_sequence START WITH #{start}") end end down do if PactBroker::MigrationHelper.postgres? nextval = execute("SELECT nextval('verification_number_sequence') as val") { |v| v.first["val"].to_i } # Add a safety margin! from(:verification_sequence_number).update(value: nextval + 100) run("DROP SEQUENCE verification_number_sequence") end end end
Version data entries
44 entries across 44 versions & 1 rubygems