H2 does not have enums. I ‘solved’ this in the following way:
    DROP TABLE  IF EXISTS typeGroups;
    CREATE TABLE typeGroups (
        typeGroupID     UUID        PRIMARY KEY,
        description     VARCHAR(50) UNIQUE NOT NULL
    );

    DROP TABLE  IF EXISTS types;
    DROP DOMAIN IF EXISTS period;
    CREATE DOMAIN period AS
    VARCHAR(10) DEFAULT 'daily'
    CHECK VALUE IN (
        'daily',
        'weekly',
        'monthly',
        'yearly'
    );
    CREATE TABLE types (
        typeID          UUID          PRIMARY KEY,
        description     VARCHAR(50)   UNIQUE NOT NULL,
        typeGroupID     UUID          NOT NULL,
        ranking         SMALLINT,
        evalPeriod      period,

        FOREIGN KEY     (typeGroupID) REFERENCES typeGroups(typeGroupID)
    );

Is this correct, or is there a better way?

-- 
Cecil Westerhof

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to