A platform for community discussion. Free, open, simple.
DEV: Ensure sequences are never reduced in test environment (#34618)
David Taylor9076fe4b5424
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rbindex 4af28d97497..de0c7c508d7 100644--- a/spec/rails_helper.rb+++ b/spec/rails_helper.rb@@ -504,7 +504,9 @@ RSpec.configure do |config|# instead of 2**31-1 so that the values are easier to read.DB.query("SELECT sequence_name FROM information_schema.sequences WHERE data_type = 'bigint'")- .each { |row| DB.exec "SELECT setval('#{row.sequence_name}', '10000000000')" }+ .each do |row|+ DB.exec "SELECT setval('#{row.sequence_name}', GREATEST((SELECT last_value FROM #{row.sequence_name}), 10000000000))"+ end# Prevents 500 errors for site setting URLs pointing to test.localhost in system specs.SiteIconManager.clear_cache!