Sha256: 8731ac9eac5e6ccb2674401d086aa612921c73a1b65af03a3722753534326eec

Contents?: true

Size: 492 Bytes

Versions: 44

Compression:

Stored size: 492 Bytes

Contents

require "digest/sha1"
require_relative "migration_helper"

Sequel.migration do
  change do
    self[:pacts].each do | row |
      sha = Digest::SHA1.hexdigest(row[:json_content])
      if self[:pact_version_contents].where(sha: sha).count == 0
        self[:pact_version_contents].insert(sha: sha, content: row[:json_content], created_at: row[:created_at], updated_at: row[:updated_at])
      end
      self[:pacts].where(id: row[:id]).update(pact_version_content_sha: sha)
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

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