Skip to content

Add Super U to PostgreSQL native enum #86

@SkypLabs

Description

@SkypLabs

The Origin enum in the Source model is implemented as a native enum in PostgreSQL but as simple strings in SQLite:

@unique
class Origin(StrEnum):
"""
The origin is used to filter the
"""
AUCHAN = "Auchan"
BIOCOOP = "Biocoop"
CARREFOUR = "Carrefour"
CASINO = "Casino"
ELECLERC = "E.Leclerc"
LA_VIE_CLAIRE = "La Vie Claire"
INTERMARCHE = "Intermarché"
LIDL = "Lidl"
OPEN_FOOD_FACTS = "OpenFoodFacts"
PICARD = "Picard"
SUPER_U = "Super U"

As a result, when adding a new item to the Origin enum in Python, it causes a conflict with PostgreSQL's own enum for which the new item's value is unknown:

psycopg2.errors.InvalidTextRepresentation: invalid input value for enum origin: "SUPER_U"

PostgreSQL's native enum needs to be updated via a migration script to include Super U as origin value.

Metadata

Metadata

Assignees

Labels

databaseRelated to the database.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions