Sha256: 5d6a08476d422d6c1f84aab6612de77b43aba577e92759c147bc50ad837de761

Contents?: true

Size: 492 Bytes

Versions: 159

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

159 entries across 159 versions & 1 rubygems

Version Path
pact_broker-2.79.1 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.79.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.78.1 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.78.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.77.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.76.2 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.76.1 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.76.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.75.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.74.1 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.74.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.73.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.72.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.71.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.70.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.69.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.68.1 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.68.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.67.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb
pact_broker-2.66.0 db/migrations/000017_migrate_json_content_to_pact_version_content_table.rb