> ## Documentation Index
> Fetch the complete documentation index at: https://docs.a7manager.se/llms.txt
> Use this file to discover all available pages before exploring further.

# Projects and Users tables

> Tenancy and access control.

Tenancy and access control.

A **✓** in the Null column means the field is optional. Constraint definitions are
reproduced verbatim from PostgreSQL, so they are the exact rule being enforced.
Descriptions come from the models; a blank one means the field carries no
description yet, not that it has no meaning.

### `project`

| Column               | Type         | Null | Default | Description |
| -------------------- | ------------ | :--: | ------- | ----------- |
| `id`                 | uuid         |      |         |             |
| `created_at`         | timestamptz  |      |         |             |
| `updated_at`         | timestamptz  |      |         |             |
| `name`               | varchar(255) |      |         |             |
| `description`        | text         |   ✓  |         |             |
| `is_active`          | bool         |      |         |             |
| `created_by_user_id` | uuid         |      |         |             |

<Accordion title="Constraints — 1 unique, 1 foreign key, 1 primary key">
  | Kind        | Name               | Definition                                       |
  | ----------- | ------------------ | ------------------------------------------------ |
  | Foreign key |                    | `(created_by_user_id) REFERENCES users_user(id)` |
  | Primary key |                    | `(id)`                                           |
  | Unique      | `project_name_key` | `(name)`                                         |
</Accordion>

### `user_project_role`

| Column       | Type        | Null | Default | Description |
| ------------ | ----------- | :--: | ------- | ----------- |
| `id`         | uuid        |      |         |             |
| `created_at` | timestamptz |      |         |             |
| `updated_at` | timestamptz |      |         |             |
| `role`       | varchar(20) |      |         |             |
| `project_id` | uuid        |      |         |             |
| `user_id`    | uuid        |      |         |             |

<Accordion title="Constraints — 1 unique, 2 foreign keys, 1 primary key">
  | Kind        | Name                                                      | Definition                            |
  | ----------- | --------------------------------------------------------- | ------------------------------------- |
  | Foreign key |                                                           | `(project_id) REFERENCES project(id)` |
  | Foreign key |                                                           | `(user_id) REFERENCES users_user(id)` |
  | Primary key |                                                           | `(id)`                                |
  | Unique      | `user_project_role_user_id_project_id_role_c597ddb6_uniq` | `(user_id, project_id, role)`         |
</Accordion>

### `users_user`

| Column                 | Type         | Null | Default | Description                                                                                                                  |
| ---------------------- | ------------ | :--: | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `password`             | varchar(128) |      |         |                                                                                                                              |
| `last_login`           | timestamptz  |   ✓  |         |                                                                                                                              |
| `is_superuser`         | bool         |      |         | Designates that this user has all permissions without explicitly assigning them.                                             |
| `first_name`           | varchar(150) |      |         |                                                                                                                              |
| `last_name`            | varchar(150) |      |         |                                                                                                                              |
| `is_staff`             | bool         |      |         | Designates whether the user can log into this admin site.                                                                    |
| `is_active`            | bool         |      |         | Designates whether this user should be treated as active. Unselect this instead of deleting accounts.                        |
| `date_joined`          | timestamptz  |      |         |                                                                                                                              |
| `id`                   | uuid         |      |         |                                                                                                                              |
| `username`             | varchar(150) |      |         | Required. 150 characters or fewer. Letters, digits, underscores, and hyphens only.                                           |
| `email`                | varchar(254) |      |         |                                                                                                                              |
| `must_change_password` | bool         |      |         | When True, user must change password before accessing any other functionality. Set by admin password reset or user creation. |

<Accordion title="Constraints — 2 unique, 1 primary key">
  | Kind        | Name                      | Definition   |
  | ----------- | ------------------------- | ------------ |
  | Primary key |                           | `(id)`       |
  | Unique      | `users_user_email_key`    | `(email)`    |
  | Unique      | `users_user_username_key` | `(username)` |
</Accordion>
