| # | Column Name | Nullable | Data Type | Max Length | Description |
|---|---|---|---|---|---|
| 1 | user_id | integer | 0 | The primary key of the table, which is also a serial field. | |
| 2 | role_id | integer | 0 | ||
| 3 | office_id | integer | 0 | ||
| 4 | user_name | character varying | 50 | ||
| 5 | full_name | character varying | 100 | ||
| 6 | can_change_password | boolean | 0 | ||
| 7 | password | text | 0 | ||
| 8 | elevated | boolean | 0 | ||
| 9 | audit_user_id | integer | 0 | Contains the id of the user who last inserted or updated the corresponding row. | |
| 10 | audit_ts | timestamp with time zone | 0 | Contains the date and timestamp of the last insert or update action. |
| # | Column Name | Key Name | References |
|---|---|---|---|
| 2 | role_id | users_role_id_fkey | office.roles.role_id |
| 3 | office_id | users_office_id_fkey | office.offices.office_id |
| 9 | audit_user_id | users_audit_user_id_fkey | office.users.user_id |
| Index Name | Owner | Access Method | Definition | Description |
|---|---|---|---|---|
| users_pkey | postgres | btree | user_id | |
| users_user_name_uix | postgres | btree | upper(user_name::text) |
| Constraint Name | Description |
|---|---|
| users_elevated_chk CHECK (NOT office.is_admin(user_id) AND NOT elevated OR office.is_admin(user_id)) |
| # | Column Name | Default |
|---|---|---|
| 1 | user_id | nextval('office.users_user_id_seq'::regclass) |
| 6 | can_change_password | true |
| 8 | elevated | false |
| 10 | audit_ts | now() |
| Trigger Name | Targets | On Event | Timing | Condition | Order | Orientation | Description |
|---|---|---|---|---|---|---|---|
| office.hash_password | office.hash_password | INSERT | AFTER | 0 | ROW | ||
| office.user_trigger | office.user_trigger | UPDATE | AFTER | 0 | ROW | ||
| office.user_trigger | office.user_trigger | INSERT | AFTER | 0 | ROW |