Skip to content

generate_sql_schema - enum clashes #74

Description

@rokf

Hello,

I've recently found out about the generate_sql_schema method that is implemented in this repository. I suppose that the mentioned method is used to generate schema.sql files which are present across the various model-specific repositories.

We've discussed the fact that one currently can't simply take all the schema.sql files and apply them to the same database because some of them have enums that have the same name because some of the columns in the various models have the same name - smart-data-models/dataModel.Device#35.

I believe that this should be fixed and I (or one of my colleagues) can help with a PR if that'd be desired. We'd obviously follow the contribution guidelines - we've already looked at those.

In the linked issue multiple potential solutions were identified:

  • addition of a table prefix for the enums, i.e. Distribution_status_type and DeviceOperation_status_type instead of status_type
  • YAML enums could be encoded as plain text columns (potentially acceptable, information loss)
  • enums could be encoded as check constraints instead, i.e. status TEXT NOT NULL CHECK (status IN ('cancelled','finished','ongoing','planned','scheduled')),

Which solution would you propose that we go forward with?

Thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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