CREATE TABLE users (
    id              CHAR(36) NOT NULL PRIMARY KEY,

    updated_at      DATETIME NOT NULL,
    created_at      DATETIME NOT NULL,

    updated_by      CHAR(36) DEFAULT NULL,
    INDEX updated_by_index (updated_by),
    FOREIGN KEY (updated_by) REFERENCES users(id),
    created_by      CHAR(36) DEFAULT NULL,
    INDEX created_by_index (created_by),
    FOREIGN KEY (created_by) REFERENCES users(id),

    fullname        VARCHAR(255)   NOT NULL,
    gender          ENUM('M', 'F', '?') NOT NULL DEFAULT '?',
    role            VARCHAR(255)   NOT NULL,
    email           VARCHAR(255)   NOT NULL UNIQUE,
    passwd          VARCHAR(255)   NOT NULL,
    is_active       BOOLEAN        NOT NULL DEFAULT TRUE,
    description     TEXT           NOT NULL DEFAULT '',
    api_key         VARCHAR(36)    NULL UNIQUE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
