Sha256: 8aab9c431b9ac1f1d23a1887e5f932e4a32fe727e58972620582a5e63c453236

Contents?: true

Size: 823 Bytes

Versions: 95

Compression:

Stored size: 823 Bytes

Contents

require_relative 'migration_helper'

Sequel.migration do
  change do
    create_view(:latest_tagged_version_orders,
      PactBroker::MigrationHelper.sqlite_safe("
        select v.pacticipant_id, t.name as tag_name, max(v.order) as latest_version_order, 1 as latest
        from tags t
        inner join versions v
        on v.id = t.version_id
        group by v.pacticipant_id, t.name
      ")
    )

    create_view(:tags_with_latest_flag,
      PactBroker::MigrationHelper.sqlite_safe("
        select t.*, ltvo.latest
        from tags t
        inner join versions v
        on v.id = t.version_id
        left outer join latest_tagged_version_orders ltvo
        on t.name = ltvo.tag_name
        and v.pacticipant_id = ltvo.pacticipant_id
        and v.order = ltvo.latest_version_order
      ")
    )
  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

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