+3
Accepted

Enums

raphael.morineau 1 year ago updated by Support 1 year ago 3

Would be nice to be able to define Enum objects instead of only Tables.

Under review

I like your idea, it sounds interesting. But it would be great if you can provide more details about it.

- Do you have a vision how it should be visualized on a diagram?

Any sketches, drafts, screenshots will really help to understand that.

- Any actions for physical model? should we generate script for enum? as user datatype, as table check constraint, as table?

- Do you want to define enum object for each table or should it be re-usable between tables?

- If you know any diagramming tools that uses Enum objects - please tell us which one you like.

- It would be great to know why you prefer Enum than regular lookup table.

Hello,

1. While searching for examples in another context, i stumbled upon this diagram (made with draw.io)

https://github.com/Shinigami92/star-citizen-trade-market-api/blob/development/docs/Star%20Citizen%20Trade%20Market.png

You'll notice the field "type" appears often, with static multiple values. e.g. for a transaction type can be either BUY|CANCEL|SELL, or for permission roles, or for item types ...

Regarding viualisation, i think it would be more flexible to display it on diagram like a table so can move it around, unlike draw.io did.

A variant would be to display those static values like draw.io did (inside entity, under parenthesis) but only if there are like 3 values or less; above 3, values would be displayed externally off the entity like explained above.

2. An enum is by definition a dataType, that's how it is generated.
CREATE TYPE user_roles AS ENUM ('User', 'Member', 'Admin');

3. an enum is not at table level, but per field's.

If analyst uses same static values in different entities, this means an obvious modeling issue. In that case such values should be put in their own table as lookup, then referenced in tables that need them.

So good question as it would mean to raise a warning like "Attention ! You already used those values in [table.field], Do you want to create a lookup table for those values instead ?" => auto-create it with corresponding refs.

4. draw.io but only under parenthesis. I didnot find any other supporting enums.

5. See 3

Accepted

Dear User,

  Thank your for the details about feature to support Enums.


We will discuss it with our team, put it in our development pipeline and work on it.

Thank you for your assistance,

SqlDBM Team