@migramon/migrate
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Migramon is a library for migration your databases, etc.

npm

Install

yarn add @migramon/migrate

or

npm i -S @migramon/migrate

Setup

Add migramon.yml config file ro root of your project. With config like this:

require:
  - ./polyfill.js

migrator: ./migrations/.config/migramon-setup.ts
dir: ./migrations

migramon-setup.ts setup file example:

import Migrator from '@migramon/migrate'
import { PgPlugin, PgStore } from '@migramon/postgres-plugin'

async function setup() {
  // here you can wait for db connection

  const pgPlugin = new PgPlugin({ client })
  // you can use store only variant (without plugin)
  // const store = new PgStore({client})

  const migrator = new Migrator({
    store: pgPlugin.store,
    plugins: [pgPlugin],
  })

  return migrator
}

export default setup

File migramon-setup.ts is needed for cmd usage at first point. If you need programmatic usage, you can just import this file like this:

import migrationSetup from './migramon-setup.ts'

async function start() {
  const migramon = await migrationSetup()
  await migramon.start()
}

start()

Commands

Migramon has few command-line commands:

migramon create new-migration-file
// command will create file like this: 1658763216005-new-migration-file.js


migramon migrate
// command will start migration process

You can always use migramon --help for more instructions.

Advanced

Full migramon.yml config example

require:
  - ./polyfill.js

migrator: ./libs/migramon/setup.ts

dir: ./migrations

file:
  name: "{name}.ts"
  template_file: ./migrations/.config/template.ts

Plugins

Package Sidebar

Install

npm i @migramon/migrate

Weekly Downloads

8

Version

0.0.6

License

ISC

Unpacked Size

86.4 kB

Total Files

49

Last publish

Collaborators

  • zvs001