> ## 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.

# High-Value Components tables

> The repair-loop audit trail over assets_component.

The repair-loop audit trail over assets\_component.

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.

### `component_status_update`

| Column         | Type        | Null | Default | Description                                      |
| -------------- | ----------- | :--: | ------- | ------------------------------------------------ |
| `id`           | uuid        |      |         |                                                  |
| `created_at`   | timestamptz |      |         |                                                  |
| `updated_at`   | timestamptz |      |         |                                                  |
| `new_status`   | varchar(30) |      |         | Status after the transition                      |
| `message`      | text        |   ✓  |         | Optional message accompanying the transition     |
| `component_id` | uuid        |      |         | Target component                                 |
| `project_id`   | uuid        |      |         | Parent project (auto-derived from the component) |
| `user_id`      | uuid        |      |         | User who triggered the transition                |

<Accordion title="Constraints — 3 foreign keys, 1 primary key">
  | Kind        | Name | Definition                                       |
  | ----------- | ---- | ------------------------------------------------ |
  | Foreign key |      | `(component_id) REFERENCES assets_component(id)` |
  | Foreign key |      | `(project_id) REFERENCES project(id)`            |
  | Foreign key |      | `(user_id) REFERENCES users_user(id)`            |
  | Primary key |      | `(id)`                                           |
</Accordion>

### `component_comment`

| Column         | Type        | Null | Default | Description                                      |
| -------------- | ----------- | :--: | ------- | ------------------------------------------------ |
| `id`           | uuid        |      |         |                                                  |
| `created_at`   | timestamptz |      |         |                                                  |
| `updated_at`   | timestamptz |      |         |                                                  |
| `content`      | text        |      |         | Comment text                                     |
| `component_id` | uuid        |      |         | Target component                                 |
| `project_id`   | uuid        |      |         | Parent project (auto-derived from the component) |
| `user_id`      | uuid        |      |         | Comment author                                   |

<Accordion title="Constraints — 3 foreign keys, 1 primary key">
  | Kind        | Name | Definition                                       |
  | ----------- | ---- | ------------------------------------------------ |
  | Foreign key |      | `(component_id) REFERENCES assets_component(id)` |
  | Foreign key |      | `(project_id) REFERENCES project(id)`            |
  | Foreign key |      | `(user_id) REFERENCES users_user(id)`            |
  | Primary key |      | `(id)`                                           |
</Accordion>

### `component_attachment`

| Column         | Type          | Null | Default | Description                                                         |
| -------------- | ------------- | :--: | ------- | ------------------------------------------------------------------- |
| `id`           | uuid          |      |         |                                                                     |
| `created_at`   | timestamptz   |      |         |                                                                     |
| `updated_at`   | timestamptz   |      |         |                                                                     |
| `name`         | varchar(255)  |      |         | Display name / filename                                             |
| `client_id`    | uuid          |      |         | Client-generated UUID for upload retry idempotency.                 |
| `file_url`     | varchar(1024) |   ✓  |         | Permanent Azure Blob URL; null until finalize confirms upload.      |
| `uploaded_at`  | timestamptz   |   ✓  |         | Set by DocumentService.finalize\_upload when the blob is confirmed. |
| `mime_type`    | varchar(100)  |   ✓  |         | MIME type (e.g., application/pdf)                                   |
| `file_size`    | int8          |   ✓  |         | File size in bytes                                                  |
| `component_id` | uuid          |      |         | Target component                                                    |
| `project_id`   | uuid          |      |         | Parent project (auto-derived from the component)                    |
| `user_id`      | uuid          |      |         | User who registered the attachment                                  |

<Accordion title="Constraints — 2 unique, 3 foreign keys, 1 primary key">
  | Kind        | Name                                             | Definition                                       |
  | ----------- | ------------------------------------------------ | ------------------------------------------------ |
  | Foreign key |                                                  | `(component_id) REFERENCES assets_component(id)` |
  | Foreign key |                                                  | `(project_id) REFERENCES project(id)`            |
  | Foreign key |                                                  | `(user_id) REFERENCES users_user(id)`            |
  | Primary key |                                                  | `(id)`                                           |
  | Unique      | `component_attachment_client_id_key`             | `(client_id)`                                    |
  | Unique      | `component_attachment_unique_name_per_component` | `(component_id, name)`                           |
</Accordion>
