diff --git a/lib/resource/transformers/create_version_resource.ex b/lib/resource/transformers/create_version_resource.ex index f65a0eb..2e71313 100644 --- a/lib/resource/transformers/create_version_resource.ex +++ b/lib/resource/transformers/create_version_resource.ex @@ -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?} =