Skip to content

Commit dc984e8

Browse files
committed
fix: avoid empty error on upserts with :nothing
docs: add some small docs for custom extensions
1 parent 9c5dd03 commit dc984e8

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/data_layer.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ defmodule AshPostgres.DataLayer do
12191219
upsert_set
12201220
) do
12211221
:empty ->
1222-
:nothing
1222+
{:replace, options[:upsert_keys] || Ash.Resource.Info.primary_key(resource)}
12231223

12241224
{:ok, query} ->
12251225
query

lib/repo.ex

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ defmodule AshPostgres.Repo do
1212
1313
To configure your list of installed extensions, define `installed_extensions/0`
1414
15+
Extensions can be a string, representing a standard postgres extension, or a module that implements `AshPostgres.CustomExtension`.
16+
That custom extension will be called to generate migrations that serve a specific purpose.
17+
1518
Extensions that are relevant to ash_postgres:
1619
1720
* "ash-functions" - This isn't really an extension, but it expresses that certain functions
@@ -23,7 +26,7 @@ defmodule AshPostgres.Repo do
2326
2427
```
2528
def installed_extensions() do
26-
["pg_trgm", "uuid-ossp", "vector"]
29+
["pg_trgm", "uuid-ossp", "vector", YourCustomExtension]
2730
end
2831
```
2932

0 commit comments

Comments
 (0)