Have ideas to improve npm?Join in the discussion! »

    migrate-state-store-redis

    2.0.0 • Public • Published

    node-migrate state storage for Redis

    This is a state storage implementation for the node-migrate framework. It will store your migration state in Redis.

    In case you’re using node-migrate for migrating your Redis, it makes sense to keep the state within the database itself, instead of a separate file which is used by node-migrate per default.

    Installation

    $ yarn add migrate-state-store-redis redis

    Requirements

    version Node.js peerDependencies
    2.x 10+ redis >=^3.0.0
    1.x 8+ redis >=^2.8.0

    Usage

    Basic

    import * as migrate from 'migrate';
    import RedisStateStore from 'migrate-state-store-redis';
     
    migrate.load({
      stateStore: new RedisStateStore(),
      // further configuration …
    }, (err, set) => {
      // your code …
    });

    Passing configuration via constructor

    import * as migrate from 'migrate';
    import RedisStateStore from 'migrate-state-store-redis';
     
    const config = {
      storeUrl: 'redis://localhost:6379/10',
      migrationKey: 'my-migrations-key',
      lastRunKey: 'my-last-run-key',
    };
     
    migrate.load({
      stateStore: new RedisStateStore(config),
      // further configuration …
    }, (err, set) => {
      // your code …
    });

    Passing configuration via environment variables

    import * as migrate from 'migrate';
    import RedisStateStore from 'migrate-state-store-redis';
     
    process.env.REDIS_STATE_STORE_URL = 'redis://localhost:6379/10';
    process.env.REDIS_STATE_MIGRATION_KEY = 'my-migrations-key';
    process.env.REDIS_STATE_LAST_RUN_KEY = 'my-last-run-key';
     
    migrate.load({
      stateStore: new RedisStateStore(),
      // further configuration …
    }, (err, set) => {
      // your code …
    });

    Command-line

    $ migrate up --env .env --store migrate-state-store-redis

    License

    The MIT License (MIT)
    
    Copyright (c) Alexey Kucherenko
    
    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.
    

    Install

    npm i migrate-state-store-redis

    DownloadsWeekly Downloads

    53

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    6

    Last publish

    Collaborators

    • avatar