CREATE TABLE userGroups
(
    id          UUID UNIQUE PRIMARY KEY                      NOT NULL,
    createdAt   TIMESTAMP DEFAULT CURRENT_TIMESTAMP          NOT NULL,
    updatedAt   TIMESTAMP DEFAULT CURRENT_TIMESTAMP          NOT NULL,
    internal    BOOLEAN   DEFAULT FALSE                      NOT NULL,
    ownerUserId UUID REFERENCES users (id) ON DELETE CASCADE NOT NULL,
    title       TEXT                                         NOT NULL,
    description TEXT      DEFAULT ''                         NOT NULL
);

CREATE TRIGGER userGroups_updated_at
    BEFORE UPDATE
    ON userGroups
    FOR EACH ROW
EXECUTE PROCEDURE updated_at_timestamp();
