@js-migrations/core

6.2.3 • Public • Published

core

Provides a common service for migrations in JavaScript.

Usage

  1. Install it with npm i @js-migrations/core.
  2. Create a repository facade.
  3. Use the factory to create the service facade.

Create a repository facade

This package contains the RepoFacade TypeScript interface. You can create a facade to match the interface using the factories below.

Use the factory

import migrationsServiceFactory from '@js-migrations/core/dist/factory';

const migrationsServiceFacade = migrationsServiceFactory({
  repo: migrationsRepoFacade,
});

Intentions

  • Create an API for processing migrations in applications storing data in multiple ways (e.g. databases and files).
  • Allow processed migrations to be recorded in a common format across databases.
  • Focus on functions rather than files to improve type checking and composability.
  • Focus on migrations being a function of the application rather than just a developer tool.

Avoiding downtime

To avoid downtime caused by deleting columns in migrations it's recommended that you make two releases as explained below where the code changes are deployed before the migrations are processed.

  • Initial release
    • Code change: Stop reading deleted columns.
    • Migration: Make columns to be deleted optional (if not already).
  • Final release
    • Code change: Stop writing to deleted columns.
    • Migration: Delete the columns.

Readme

Keywords

none

Package Sidebar

Install

npm i @js-migrations/core

Weekly Downloads

11

Version

6.2.3

License

GPL-3.0

Unpacked Size

212 kB

Total Files

153

Last publish

Collaborators

  • ryansmith94