users
Overview
System users. There is no explicit registration step; a user is created automatically the first time an authenticated request arrives.
Table Definition
| Logical name | Physical name | Column | Type | PK | Relation | Unique | Nullable | Default | Notes |
|---|---|---|---|---|---|---|---|---|---|
| User | users | id | uuid | โฏ | gen_random_uuid() | ||||
| name | varchar(255) | Display name, updated from the auth headers | |||||||
| varchar(255) | โฏ | Stored normalized to lower case | |||||||
| is_admin | boolean | false | Derived automatically from SURVEY_ADMIN_EMAILS | ||||||
| created_at | timestamptz | now() | |||||||
| updated_at | timestamptz | now() |
Relations
- Referenced by:
surveys.created_by/surveys.updated_by(restrict) - Referenced by:
survey_permissions.user_id(cascade) - Referenced by:
survey_versions.created_by(restrict) - Referenced by:
user_survey_favorites.user_id(cascade) - Referenced by:
question_library_items.created_by(set null) - Referenced by:
external_surveys.imported_by(set null)
Indexes
- Primary key (id)
- UNIQUE: email
Notes
is_adminis compared againstSURVEY_ADMIN_EMAILSon every request and updated if it changed. Editing the database directly has no lasting effect; the environment variable is authoritative- Administrators can view and edit every survey regardless of permission records
- Calling the import API with API key authentication and no
x-user-emailcreatesimport-bot@local(display nameImport Bot) automatically - Soft deletion is not supported