CREATE TABLE identification_apis (
                      id          NUMBER(19) PRIMARY KEY,
                      project_id  NUMBER(19) NOT NULL REFERENCES projects (id),
                      name        VARCHAR2(64 CHAR)        NOT NULL,
                      enabled     NUMBER(1) NOT NULL,
                      deleted     NUMBER(1)                NOT NULL,
                      url varchar2(512) NOT NULL,
                      created_at  TIMESTAMP WITH TIME ZONE NOT NULL,
                      updated_at  TIMESTAMP WITH TIME ZONE NOT NULL,
                      deleted_at  TIMESTAMP WITH TIME ZONE,
                      restored_at TIMESTAMP WITH TIME ZONE
);

CREATE SEQUENCE identification_apis_id_seq;

CREATE INDEX identification_apis_project_ix
    ON identification_apis (project_id);

CREATE UNIQUE INDEX identification_apis_project_enabled_uniq
    ON identification_apis (
             CASE WHEN enabled = 1
                      THEN project_id END);
