You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The new opendata slugs incorporated a constraint in the database, requiring unique (space_id, open_data_slug). If the space is not "enabled" with open-data, no unit have any open_data_slug.
For units specifically, creating a new entry doesn't add <null> but an empty string as the open_data_slug. This makes it impossible to add more units.
How to fix: Creating a new unit should use a NULL open_data_slug instead of an empty string.
Workaround: one needs to open the database, and manually change the open_data_slug from empty strings to NULL.
Relevant logs
Docker logs:
2023-06-23 17:31:20.397 UTC [3238] ERROR: duplicate key value violates unique constraint "unit_unique_open_data_slug_per_space"
2023-06-23 17:31:20.397 UTC [3238] DETAIL: Key (space_id, open_data_slug)=(1, ) already exists.
2023-06-23 17:31:20.397 UTC [3238] STATEMENT: INSERT INTO "cookbook_unit" ("name", "plural_name", "description", "base_unit", "open_data_slug", "space_id") VALUES ('cup', 'cups', 'US Legal cup', NULL, '', 1) RETURNING "cookbook_unit"."id"
Database state
My table cookbook_unit after creating the entry "lb"; used \pset null '<null>' to show the null values:
ok so fixed the uniqueness check by setting the field to none in the serializer. Not the nicest solutuion but i need to constraint to make bulk updating/inserting possible when importing from the open data repo (need to improve that as well, but works for now)
Tandoor Version
1.5.1
Setup
Docker / Docker-Compose
Reverse Proxy
Traefik
Other
No response
Bug description
The new opendata slugs incorporated a constraint in the database, requiring unique
(space_id, open_data_slug)
. If the space is not "enabled" with open-data, no unit have any open_data_slug.For units specifically, creating a new entry doesn't add
<null>
but an empty string as the open_data_slug. This makes it impossible to add more units.How to fix: Creating a new unit should use a NULL
open_data_slug
instead of an empty string.Workaround: one needs to open the database, and manually change the
open_data_slug
from empty strings to NULL.Relevant logs
Docker logs:
Database state
My table
cookbook_unit
after creating the entry "lb"; used\pset null '<null>'
to show thenull
values:The text was updated successfully, but these errors were encountered: