Sha256: a58d9d3196db8f5c89c5599224484ac864b7ef53f4abff4b703f337ed3669059

Contents?: true

Size: 563 Bytes

Versions: 52

Compression:

Stored size: 563 Bytes

Contents

class MigrateNonExclusiveLocksToLinks < ActiveRecord::Migration[5.0]
  def up
    execute <<-SQL
      INSERT INTO foreman_tasks_links(task_id, resource_type, resource_id)
      SELECT DISTINCT locks.task_id, locks.resource_type, locks.resource_id
      FROM foreman_tasks_locks AS locks
      LEFT JOIN foreman_tasks_links AS links
        ON links.task_id = locks.task_id
          AND links.resource_type = locks.resource_type
          AND links.resource_id = locks.resource_id
      WHERE locks.exclusive = FALSE AND links.task_id IS NULL;
    SQL
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
foreman-tasks-8.1.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.1.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.1.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.0.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.0.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.0.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-7.2.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-7.1.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-7.2.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-7.1.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-6.0.3 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-7.0.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-6.0.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-4.1.6 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-5.2.3 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-6.0.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-5.2.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-6.0.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-5.2.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-5.3.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb