Sha256: e1852ad8609e3e83fea00de9889772dcdd7f9c62e478c401a6d5f19d874d3a3d
Contents?: true
Size: 661 Bytes
Versions: 18
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
18 entries across 18 versions & 1 rubygems