Copy as Markdown[View as Markdown](/docs/sdk/functions/versionDataStore.md)

***

# Function: versionDataStore()

> **versionDataStore**(`directory`): (`id`) => `Promise`<`void`>

Defined in: data-stores.ts:68

Version an data store (e.g. database, cache, etc.) by its id.

Takes the latest data store and moves it to a versioned directory. All files with this data store are also versioned (e.g /containers/orders-db/schema.json)

## Parameters[​](#parameters "Direct link to Parameters")

| Parameter   | Type     |
| ----------- | -------- |
| `directory` | `string` |

## Returns[​](#returns "Direct link to Returns")

`Function`

### Parameters[​](#parameters-1 "Direct link to Parameters")

| Parameter | Type     |
| --------- | -------- |
| `id`      | `string` |

### Returns[​](#returns-1 "Direct link to Returns")

`Promise`<`void`>

## Examples[​](#examples "Direct link to Examples")

```
import utils from '@eventcatalog/utils';

const { versionDataStore } = utils('/path/to/eventcatalog');

// moves the latest orders-db data store to a versioned directory
// the version within that data store is used as the version number.
await versionDataStore('orders-db');
```

```
import utils from '@eventcatalog/utils';

const { versionContainer } = utils('/path/to/eventcatalog');

// moves the latest orders-db container to a versioned directory
// the version within that container is used as the version number.
await versionContainer('orders-db');
```
