Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
This reverts commit fd74980.

Until we investigate a more thorough solution, this avoids the performance
penalty of the subquery for us in MariaDB.
  • Loading branch information
amiryal committed Feb 13, 2024
1 parent 8076843 commit d4f321b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/composite_primary_keys/relation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def update_all(updates)
stmt.key = table[primary_key]

# CPK
if @klass.composite?
if @klass.composite? && @klass.connection.visitor.compile(stmt.ast) =~ /['"]#{primary_key.to_s}['"]/
stmt = Arel::UpdateManager.new
stmt.table(arel_table)
cpk_subquery(stmt)
Expand Down Expand Up @@ -74,7 +74,7 @@ def delete_all
stmt.key = table[primary_key]

# CPK
if @klass.composite?
if @klass.composite? && @klass.connection.visitor.compile(stmt.ast) =~ /['"]#{primary_key.to_s}['"]/
stmt = Arel::DeleteManager.new
stmt.from(arel_table)
cpk_subquery(stmt)
Expand Down

0 comments on commit d4f321b

Please sign in to comment.