Open LuisSarmientoM opened 3 months ago
@LuisSarmientoM Thank you!
Can you explain how would you going to use that visibility
type if we will bring custom types to ChartDB :)?
Sure, here I define a relation between users and certifications, each certification has a TYPE value whose only valid value is Certification or License, otherwise prevent the creation or update.
Hey @johnnyfish, can I work on this one?
@johnnyfish I'm already working on this issue, but I have a question
There are different ways the DBs support enums (or don't support them natively but can be emulate)
Here are some examples
PostgreSQL
CREATE TYPE mood AS ENUM ('happy', 'sad', 'neutral'); CREATE TABLE person ( name text, current_mood mood );
MySQL
CREATE TABLE person ( name VARCHAR(50), mood ENUM('happy', 'sad', 'neutral') );
SQL Server, SQLite
CREATE TABLE person ( name NVARCHAR(50), mood NVARCHAR(50) CHECK (mood IN ('happy', 'sad', 'neutral')) );
Besides PostgreSQL, the enums are defined in the table, so should I do it that way for all DBs?
@johnnyfish I'm already working on this issue, but I have a question
There are different ways the DBs support enums (or don't support them natively but can be emulate)
Here are some examples
PostgreSQL
`CREATE TYPE mood AS ENUM ('happy', 'sad', 'neutral');
CREATE TABLE person (
name text,
current_mood mood
);`
MySQL
`CREATE TABLE person (
name VARCHAR(50),
mood ENUM('happy', 'sad', 'neutral')
);`
SQL Server, SQLite
`CREATE TABLE person (
name NVARCHAR(50),
mood NVARCHAR(50) CHECK (mood IN ('happy', 'sad', 'neutral'))
);`
Besides PostgreSQL, the enums are defined in the table, so should I do it that way for all DBs?
Hey @MrJ8585, sorry I missed your comment here. It's a bit complicated issue and I have already started working on it.
It has 2 parts: 1) importing from the database. 2) visualizing it.
I will handle this. It would be a bit different from what @LuisSarmientoM Hey @MrJ8585, sorry I missed your comment here. It's a bit complicated issue and I have already started working on it.
It has 2 parts: 1) importing from the database. 2) visualizing it.
I will handle this. It would be a bit different from what @LuisSarmientoM showed because the custom type is shared between multiple tables.
We will build it as an object similar to tables/relationships. I will finish that soon!
Appreciate your willingness to help! showed because the custom type is shared between multiple tables.
We will build it as an object similar to tables/relationships. I will finish that soon!
Appreciate your willingness to help!
Aside from enums, what about database specific types? Eg. TEXT[][]
in postgres
Tables can contain a custom type created by the user with
CREATE TYPE visibility AS ENUM ('public', 'private', 'mixed');
to use as an enum on some values