Skip to content

Request for docs: How to handle ENUM? #197

@saurabhnanda

Description

@saurabhnanda

Couldn't find how to handle ENUMs in the tutorial docs. How do I make tenant_status in the following schema an ADT in Opaleye?

create type tenant_status as enum('active', 'inactive');
create table tenants(
       id serial primary key
       ,created_at timestamp without time zone not null default current_timestamp
       ,updated_at timestamp without time zone not null default current_timestamp
       ,name text not null
       ,status tenant_status not null default 'inactive'
       ,owner_id integer
       ,backoffice_domain text not null
       constraint ensure_not_null_owner_id check (tenent_status!='active' or owner_id is not null)
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions