Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vectorface/redis-migrate
CLI tool to create and run redis key migrations
https://github.com/vectorface/redis-migrate
Last synced: 3 months ago
JSON representation
CLI tool to create and run redis key migrations
- Host: GitHub
- URL: https://github.com/vectorface/redis-migrate
- Owner: Vectorface
- License: mit
- Created: 2014-04-19T20:11:20.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-04-27T00:51:28.000Z (almost 11 years ago)
- Last Synced: 2024-10-08T12:11:55.129Z (4 months ago)
- Language: JavaScript
- Size: 230 KB
- Stars: 7
- Watchers: 14
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
redis-migrate
=============CLI tool to create and run redis key migrations.
[![Build Status](https://travis-ci.org/Vectorface/redis-migrate.png)](https://travis-ci.org/Vectorface/redis-migrate)
## Overview
A migration file consists of a single exported object with two keys: `up` and
`down`. The current release is designed to be backwards compatible with Redis
2.6 and 2.4. As such, it uses `KEYS`, which is blocking and should not be used
on a production db when dealing with any significant number of keys. Future
releases will allow for non-blocking operation using `SCAN`, `HSCAN`, etc.## Installation
It can be installed via `npm` using:
```
npm install -g redis-migrate
```## Usage
```
Usage: redis-migrate [up|down|create]Options:
-h, --help output usage information
-V, --version output the version number
```## Example Migration File
``` javascript
exports.up = [
{
cmd: 'moveKeysToHashFields',
src: {key: /(app:user:\d+):address/},
dst: {key: '$1:properties', field: 'address'}
},
{
cmd: 'renameKeys',
src: {key: /(app:post:\d+):lastModifiedTimestamp/},
dst: {key: '$1:lastModified'}
}
];exports.down = [
{
cmd: 'moveHashFieldsToKeys',
src: {key: /(app:user:\d+):properties/, field: 'address'},
dst: {key: '$1:address'}
},
{
cmd: 'renameKeys',
src: {key: /(app:post:\d+):lastModified/},
dst: {key: '$1:lastModifiedTimestamp'}
}
];
```