Socket
Book a DemoInstallSign in
Socket

sequelize-migration-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequelize-migration-wrapper

A wrapper for migrating databases using Sequelize and Umzug.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

sequelize-migration-wrapper

A wrapper for migrating databases using Sequelize and Umzug.

Table of Contents

  • Requirements
  • Install
  • Usage
  • API
  • Release Notes
  • Maintainer

Requirements

This module is tested with Node.js 14. It might work with Node.js >= 12, but is not tested.

Install

npm install --save sequelize-migration-wrapper

Usage

Initialization

import { setupMigration } from 'sequelize-migration-wrapper'; // TypeScript
const { setupMigration } = require('sequelize-migration-wrapper'); // CommonJS

const sequelize = new Sequelize({...});

setupMigration({
  sequelize,
  path: 'path/to/migration/scripts',
  filePattern: /\.js$/
});

Options

  • sequelize (no default, must be a Sequelize instance; required),
  • path (no default; required),
  • filePattern (default: /\.js$/)

API

migrate()

Runs through all migration scripts in the configured folder. Umzug automatically saves which migration scripts have already been run, so it will not re-run those.

await migrateDb.migrate();

getStatus()

Get the current status of the migration

const status = await migrateDb.getStatus();

migrateNext()

Iteratively run through migration scripts.

for (const i in numberOfScriptsOrSomething) {
  await migrateDb.migrateNext();
}

reset()

Undo the last migration using Umzug's down function. This will only work if your migration scripts provide a down function. See Umzug's documentation for more details.

await migrateDb.reset();

resetPrev()

Iteratively undo a migration. This will only work if your migration scripts provide a down function. See Umzug's documentation for more details.

for (const i in numberOfScriptsOrSomething) {
  await migrateDb.resetPrev();
}

Release Notes

1.0.1

  • Security updates

1.0.0

  • Complete rewrite in TypeScript
  • Support for Sequelize 6

0.1.1

  • Update dependencies to fix security vulnerabilities

0.1.0

  • Initial release

Maintainer

This modules is maintained by Alex Seifert (Website, Github).

Keywords

sequelize

FAQs

Package last updated on 17 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.