@bappo/migration-cli

The command line tool for bappo db migration

Usage no npm install needed!

<script type="module">
  import bappoMigrationCli from 'https://cdn.skypack.dev/@bappo/migration-cli';
</script>

README

Bappo migration

Installation

npm install -g @bappo/migration-cli

Supported dbs

Currently only works with mongo. Use sequelize-cli instead for postgres.

Usage

  1. Make sure you are in the migrations folder

  2. Generate a migration

    bappo-migrate generate <migration_name>
    

    This creates a migration script folder with name {timestamp}_{migration_name} in the migrations folder.

  3. Write upgrade script up.js in the newly created migration script folder

  4. Complete test file up.spec.js in the newly created migration script folder

  5. Make sure tests pass

    bappo-migrate test-upgrade <migration_name_with_timestamp>
    
  6. Run upgrade

    bappo-migrate upgrade <migration_name_with_timestamp>