Skip to content

Commit

Permalink
Support MariaDB versioned tables, closes #549
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Aug 21, 2023
1 parent 35c12f7 commit c045363
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ecto/adapters/myxql.ex
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ defmodule Ecto.Adapters.MyXQL do
"This may happen if you have trigger or other database conditions rejecting operations. " <>
"The emitted SQL was: #{sql}"

{:ok, %{num_rows: 1, last_insert_id: last_insert_id}} ->
{:ok, last_insert_id(key, last_insert_id)}

{:ok, %{num_rows: 2, last_insert_id: last_insert_id}} ->
# We were used to check if num_rows was 1 or 2 (in case of upserts)
# but MariaDB supports tables with System Versioning, and in those
# cases num_rows can be more than 2.
{:ok, %{last_insert_id: last_insert_id}} ->
{:ok, last_insert_id(key, last_insert_id)}

{:error, err} ->
Expand Down

0 comments on commit c045363

Please sign in to comment.