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-10.0.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-10.0.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.2.3 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.2.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.2.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.2.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.1.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.0.4 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.1.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.0.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.0.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.3.3 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-9.0.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.2.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.1.4 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.3.2 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.3.1 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.1.3 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.3.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb
foreman-tasks-8.2.0 db/migrate/20181206124952_migrate_non_exclusive_locks_to_links.foreman_tasks.rb