volume_instances
Creates, updates, deletes, gets or lists a volume_instances resource.
Overview​
| Name | volume_instances |
| Type | Resource |
| Id | railway.storage.volume_instances |
Fields​
The following fields are returned by SELECT queries:
- get
- list
One VolumeInstance row.
| Name | Datatype | Description |
|---|---|---|
id | string | |
environment_id | string | |
external_id | string | |
service_id | string | |
volume_id | string | |
created_at | string (date-time) | |
current_size_mb | number | |
deleted_at | string (date-time) | |
environment | object | Environment object |
is_pending_deletion | boolean | |
mount_path | string | |
region | string | |
size_mb | integer | |
state | string | (DELETED, DELETING, ERROR, MIGRATING, MIGRATION_PENDING, READY, RESTORING, UPDATING) |
volume | object | Volume object |
One row per VolumeInstance.
| Name | Datatype | Description |
|---|---|---|
id | string | |
environment_id | string | |
external_id | string | |
service_id | string | |
volume_id | string | |
created_at | string (date-time) | |
current_size_mb | number | |
deleted_at | string (date-time) | |
environment | object | Environment object |
is_pending_deletion | boolean | |
mount_path | string | |
region | string | |
size_mb | integer | |
state | string | (DELETED, DELETING, ERROR, MIGRATING, MIGRATION_PENDING, READY, RESTORING, UPDATING) |
volume | object | Volume object |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | id | Get a single volume instance by id. Backed by the Railway GraphQL query volumeInstance. | |
list | select | environment_id | project_id | Lists VolumeInstance objects of a Environment. Backed by the Railway GraphQL query environment.volumeInstances. |
update | update | volume_id | Update a volume instance. If no environmentId is provided, all volume instances for the volume will be updated. Backed by the Railway GraphQL mutation volumeInstanceUpdate. | |
pitr_restore | exec | target_timestamp, volume_instance_id | new_service_name, source_repo_path | Point-in-time restore. Creates a brand-new database service in the project, recovered to the target timestamp from the source service's backup history. The source service stays online and untouched. Backed by the Railway GraphQL mutation volumeInstancePITRRestore. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
environment_id | string | |
id | string | |
project_id | string | |
new_service_name | string | Optional name for the new restored service. Defaults to '<source>-restored-YYYYMMDD-HHMM'. |
source_repo_path | string | Opaque identifier for one archive history, from the multi-history picker when the source bucket holds more than one. It scopes both the restore-window pre-check and the restored fork's archive source, treating the selected history as frozen. Pass null to restore the source's current history. |
target_timestamp | string (date-time) | Point-in-time target. Must be within the available restore window. |
volume_id | string | The id of the volume to update. |
volume_instance_id | string | The id of the volume instance to restore from. |
SELECT examples​
- get
- list
Get a single volume instance by id. Backed by the Railway GraphQL query volumeInstance.
SELECT
id,
environment_id,
external_id,
service_id,
volume_id,
created_at,
current_size_mb,
deleted_at,
environment,
is_pending_deletion,
mount_path,
region,
size_mb,
state,
volume
FROM railway.storage.volume_instances
WHERE id = '{{ id }}' -- required
;
Lists VolumeInstance objects of a Environment. Backed by the Railway GraphQL query environment.volumeInstances.
SELECT
id,
environment_id,
external_id,
service_id,
volume_id,
created_at,
current_size_mb,
deleted_at,
environment,
is_pending_deletion,
mount_path,
region,
size_mb,
state,
volume
FROM railway.storage.volume_instances
WHERE environment_id = '{{ environment_id }}' -- required
AND project_id = '{{ project_id }}'
;
UPDATE examples​
- update
Update a volume instance. If no environmentId is provided, all volume instances for the volume will be updated. Backed by the Railway GraphQL mutation volumeInstanceUpdate.
UPDATE railway.storage.volume_instances
SET
environment_id = '{{ environment_id }}',
mount_path = '{{ mount_path }}',
service_id = '{{ service_id }}',
state = '{{ state }}'
WHERE
volume_id = '{{ volume_id }}' --required
RETURNING
result;
Lifecycle Methods​
- pitr_restore
Point-in-time restore. Creates a brand-new database service in the project, recovered to the target timestamp from the source service's backup history. The source service stays online and untouched. Backed by the Railway GraphQL mutation volumeInstancePITRRestore.
EXEC railway.storage.volume_instances.pitr_restore
@target_timestamp='{{ target_timestamp }}', --required
@volume_instance_id='{{ volume_instance_id }}', --required
@new_service_name='{{ new_service_name }}',
@source_repo_path='{{ source_repo_path }}'
;