Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove MiqQueue rows containing a class removed in Rails 5. #14418

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class RemoveOidIntegerArgsFromMiqQueue < ActiveRecord::Migration[5.0]
class MiqQueue < ActiveRecord::Base; end
def up
say_with_time("Removing MiqQueue rows with args column values containing a class removed from Rails 5: PostgreSQL::OID::Integer.") do
MiqQueue.where("args LIKE '%PostgreSQL::OID::Integer%'").delete_all
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require_migration

describe RemoveOidIntegerArgsFromMiqQueue do
let(:queue_stub) { migration_stub(:MiqQueue) }

migration_context :up do
it 'deletes rows with PostgreSQL::OID:Integer class serialized in args' do
args = <<-EOS
---
- !ruby/object:ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer
precision:
scale:
limit: 8
range: !ruby/range
begin: -9223372036854775808
end: 9223372036854775808
excl: true
EOS
queue_stub.create(:state => "ready", :args => args)
queue_stub.create(:state => "ready", :method_name => "stuff")
migrate

expect(queue_stub.count).to eq(1)
expect(queue_stub.where(:method_name => "stuff").count).to eq(1)
end
end
end