Skip to content

Commit

Permalink
Ensure TRUNCATE queries got to primary database
Browse files Browse the repository at this point in the history
  • Loading branch information
lloydwatkin committed Apr 18, 2024
1 parent a032d8d commit 1338299
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class JanusMysql2Adapter < ActiveRecord::ConnectionAdapters::Mysql2Adapter
SQL_REPLICA_MATCHERS = [/\A\s*(select|with.+\)\s*select)\s/i].freeze
SQL_ALL_MATCHERS = [/\A\s*set\s/i].freeze
SQL_SKIP_ALL_MATCHERS = [/\A\s*set\s+local\s/i].freeze
WRITE_PREFIXES = %w(INSERT UPDATE DELETE LOCK CREATE GRANT DROP ALTER).freeze
WRITE_PREFIXES = %w(INSERT UPDATE DELETE LOCK CREATE GRANT DROP ALTER TRUNCATE FLUSH).freeze

attr_reader :config

Expand Down
2 changes: 1 addition & 1 deletion lib/janus/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Janus
unless defined?(::Janus::VERSION)
module VERSION
MAJOR = 0
MINOR = 13
MINOR = 14
PATCH = 0
PRE = nil

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
it { expect(described_class::SQL_REPLICA_MATCHERS).to eq([/\A\s*(select|with.+\)\s*select)\s/i]) }
it { expect(described_class::SQL_ALL_MATCHERS).to eq([/\A\s*set\s/i]) }
it { expect(described_class::WRITE_PREFIXES).to eq %w(INSERT UPDATE DELETE LOCK CREATE GRANT DROP ALTER) }
it { expect(described_class::WRITE_PREFIXES).to eq %w(INSERT UPDATE DELETE LOCK CREATE GRANT DROP ALTER TRUNCATE FLUSH) }

let(:database) { 'test' }
let(:primary_config) do
Expand Down

0 comments on commit 1338299

Please sign in to comment.