Sha256: 79b1ed0d8b35ef9647694c74ad9ea115b58e0c8aa8f0f703444781886b3469ad

Contents?: true

Size: 916 Bytes

Versions: 44

Compression:

Stored size: 916 Bytes

Contents

require "pact_broker/db/data_migrations/helpers"

module PactBroker
  module DB
    module DataMigrations
      class SetCreatedAtForLatestVerifications
        def self.call connection
          connection[:latest_verification_id_for_pact_version_and_provider_version]
          query = "UPDATE latest_verification_id_for_pact_version_and_provider_version
                  SET created_at = (SELECT created_at
                    FROM verifications
                    WHERE id = latest_verification_id_for_pact_version_and_provider_version.verification_id)
                  WHERE created_at is null"
          connection.run(query)
        end

        def self.columns_exist?(connection)
          column_exists?(connection, :latest_verification_id_for_pact_version_and_provider_version, :created_at) &&
            column_exists?(connection, :verifications, :created_at)
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
pact_broker-2.112.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.111.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.109.1 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.109.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.108.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.107.1 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.107.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.107.0.beta.1 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.106.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.105.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.104.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.103.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.102.2 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.102.1 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.102.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.101.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.100.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.99.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.98.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb
pact_broker-2.97.0 lib/pact_broker/db/data_migrations/set_created_at_for_latest_verifications.rb