actix-surreal/schemas/user.surql
2024-07-24 13:22:50 +02:00

16 lines
769 B
Text

DEFINE TABLE user SCHEMAFULL;
DEFINE FIELD oidc_id ON TABLE user TYPE string;
DEFINE FIELD username ON TABLE user TYPE string;
DEFINE FIELD first_name ON TABLE user TYPE option<string>;
DEFINE FIELD last_name ON TABLE user TYPE option<string>;
DEFINE FIELD email ON TABLE user TYPE option<string>;
DEFINE FIELD superuser ON TABLE user TYPE bool DEFAULT false;
DEFINE FIELD roles ON TABLE user TYPE array<record<role>>;
DEFINE FIELD created_at ON TABLE user TYPE datetime VALUE time::now() READONLY;
DEFINE FIELD updated_at ON TABLE user TYPE datetime VALUE time::now();
DEFINE INDEX userOidcId ON TABLE user COLUMNS oidc_id UNIQUE;
DEFINE INDEX userUsernameIndex ON TABLE user COLUMNS username UNIQUE;
DEFINE INDEX userEmailIndex ON TABLE user COLUMNS email UNIQUE;