Skip to content

Commit

Permalink
chore: don't overwrite psql table with mysql table
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Sep 7, 2024
1 parent 8aa7257 commit d4728ce
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions lib/resource/transformers/create_version_resource.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ defmodule AshPaperTrail.Resource.Transformers.CreateVersionResource do

data_layer = version_extensions[:data_layer] || Ash.DataLayer.data_layer(dsl_state)

{postgres?, table, repo} =
if data_layer == AshPostgres.DataLayer do
{true, apply(AshPostgres, :table, [dsl_state]), apply(AshPostgres, :repo, [dsl_state])}
else
{false, nil, nil}
end

{sqlite?, table, repo} =
if data_layer == AshSqlite.DataLayer do
{true, apply(AshSqlite.DataLayer.Info, :table, [dsl_state]), apply(AshSqlite.DataLayer.Info, :repo, [dsl_state])}
else
{false, nil, nil}
{postgres?, sqlite?, table, repo} =
cond do
data_layer == AshPostgres.DataLayer ->
{true, false, apply(AshPostgres, :table, [dsl_state]),
apply(AshPostgres, :repo, [dsl_state])}

data_layer == AshSqlite.DataLayer ->
{false, true, apply(AshSqlite.DataLayer.Info, :table, [dsl_state]),
apply(AshSqlite.DataLayer.Info, :repo, [dsl_state])}

true ->
{false, false, nil, nil}
end

{ets?, private?} =
Expand Down

0 comments on commit d4728ce

Please sign in to comment.