Skip to content

SQL schema - clashing enums across repositories #35

@rokf

Description

@rokf

Hello,

We're trying to use SQL schema files from multiple Smart Data Model Git repositories and we've noticed that in some occasions unrelated enums with the same name are defined. This means that it is currently impossible to apply all the Smart Data Model schema files to the same PostgreSQL database because some of them have clashing "building blocks".

Let's take the status_type enum as an example. It's defined in at least two model repositories - the DCAT-AP one and the Device one:

In the Distribution SQL schema the status_type is defined as:

CREATE TYPE status_type AS ENUM ('Completed','Deprecated','Under Development','Withdrawn')

In the DeviceOperation SQL schema it is defined as:

CREATE TYPE status_type AS ENUM ('cancelled','finished','ongoing','planned','scheduled');

Could enums either be rewritten in such a way that they wouldn't clash even if one applies all the available Smart Data Model SQL schema files to a single database? Alternatively they could be removed and replaced with a regular text column? A name change would also work I suppose but ending up with very long (but unique) enum names might not be something we'd want in the long run?

Maybe value constraints (checks) for columns could be a good enough alternative? I.e.

status TEXT NOT NULL CHECK (status IN ('cancelled','finished','ongoing','planned','scheduled')),

https://www.postgresql.org/docs/current/ddl-constraints.html

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions