MD_LIST_DIVE_VERSIONS
Returns every version of a single Dive, newest first. Each row carries the version's metadata; fetch a version's component code with MD_GET_DIVE_VERSION.
Syntax
SELECT * FROM MD_LIST_DIVE_VERSIONS(
id := '<dive_id>',
"limit" := <n>,
"offset" := <n>
);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | UUID | Yes | Identifier of the Dive. |
limit | UINTEGER | No | Maximum number of versions to return. |
offset | UINTEGER | No | Skip this many versions before returning. |
limit and offset collide with SQL keywords and must be quoted with double quotes when passed as named arguments.
Return columns
| Column | Type | Description |
|---|---|---|
id | UUID | Identifier of the version (not the Dive). |
version | UINTEGER | Version number, newest first. |
storage_url | VARCHAR | Internal storage location of the version's content. |
description | VARCHAR | Description attached to the version, or NULL. |
created_at | TIMESTAMP WITH TIME ZONE | When the version was created. |
api_version | UINTEGER | Dive API version of the content. |
required_resources | LIST(STRUCT(name VARCHAR, alias VARCHAR, url VARCHAR, id UUID, resource_type VARCHAR)) | Databases and shares this version queries. |
Examples
Get the full version history:
SELECT version, description, created_at
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>');
Just the latest version:
SELECT version, created_at
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>', "limit" := 1);
Skip the latest, get the rest:
SELECT version
FROM MD_LIST_DIVE_VERSIONS(id := '<dive_id>', "offset" := 1);
Related
MD_GET_DIVE_VERSION— Fetch a single version's content.MD_UPDATE_DIVE_CONTENT— Publish a new version.