# Media and archive

<a id="database.medien"></a>

## medien

> **Warning:** This page was automatically generated from the database schema dump and may be incomplete or incorrect.

Master-data table of storage media (archive media). Each row represents a physical or logical volume (disk, cloud bucket, optical medium) on which document files are archived. Referenced by `objectX.medium_doc` and `objectX.medium_dia`.

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `id` | `int` | — | Medium ID (primary key). |
| `name` | `nvarchar` | 100 | Display name / label of the medium. |
| `batch` | `int` | — | Batch ID (write operation). |
| `server_id` | `int` | — | Home server ID. |
| `set_id` | `int` | — | Set identifier (logical grouping). |
| `state` | `int` | — | Status code (e.g. active, full, archived). |
| `medorder` | `int` | — | Sort / order index. |
| `medsize` | `int` | — | Medium size (bytes — see also `medsize2`). |
| `written` | `int` | — | Bytes written / fill level. |
| `mirror_id` | `int` | — | ID of a mirrored medium (for mirror groups). |
| `autolocked` | `int` | — | Auto-lock flag. |
| `cluster_size` | `int` | — | Cluster size. |
| `medsize2` | `int` | — | Medium size (second value; extends `medsize` for large volumes). |

### Related tables

* [medrel](media_and_archive.md#database.medrel) — relations to media sets.
* [archex](media_and_archive.md#database.archex) — mapping of document types to servers for archiving.

<a id="database.medrel"></a>

## medrel

> **Warning:** This page was automatically generated from the database schema dump and may be incomplete or incorrect.

Maps media (`medien.id`) to their sets. Used in storage management to maintain logical media sets (e.g. related volumes, mirror groups).

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `id` | `int` | — | Medium ID. References [medien.id](media_and_archive.md#database.medien). |
| `type` | `smallint` | — | Type identifier (semantics internal). |
| `state` | `smallint` | — | Status value (semantics internal). |
| `set_id` | `int` | — | Set identifier grouping the media. |

### Related tables

* [medien](media_and_archive.md#database.medien) — the media master data.

<a id="database.archex"></a>

## archex

> **Warning:** This page was automatically generated from the database schema dump and may be incomplete or incorrect.

Archive extensions table. Maps document types to the server responsible for their archiving (relevant in multi-tenant / distributed installations).

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `server_id` | `int` | — | ID of the server that archives the document type. |
| `doctype` | `int` | — | Document-type ID (object-type ID, see Object-type ID). |

### Usage by Server-API jobs

* [std.DoArchive](../std.md#std.DoArchive) — archiving job that respects this mapping.
