npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@synor/cli

v0.9.2

Published

CLI for Synor - Database Schema Migration Tool

Downloads

1,338

Readme

Synor CLI Version License oclif

Synor CLI

CLI for Synor - Database Schema Migration Tool

Installation

using yarn:

yarn add --dev @synor/cli @synor/core

using npm:

npm install --save-dev @synor/cli @synor/core

Configuration

Synor CLI reads config file from one of the following locations:

  • File path passed to --config or -c flag
  • .synorrc.js
  • .synorrc.ts
  • synor.config.js
  • synor.config.ts

The first one found is used by Synor CLI.

Note: ts-node is required for loading config from .ts file

Options in config file is overridden by their available command flag counterparts.

Main Options:

| Name | Description | | ---------------- | --------------------------------------------------------------------------------------------------------------- | | databaseEngine | Database Engine function / package name / module path | | databaseUri | Database Engine URI | | sourceEngine | Source Engine function / package name / module path | | sourceUri | Source Engine URI |

Other Options:

You can also specify other configuration options that Synor Core accepts.

Example:

const path = require('path')

module.exports = {
  databaseEngine: `@synor/database-mysql`,
  databaseUri: `mysql://root:root@localhost:3306/synor`,
  sourceEngine: `@synor/source-file`,
  sourceUri: `file://${path.resolve('migrations')}`,

  baseVersion: '0',
  recordStartId: 1,
  migrationInfoNotation: {
    do: 'do',
    undo: 'undo',
    separator: '.',
    extension: 'sql',
  },
}

Commands

synor completion

completion plugin

USAGE
  $ synor completion

OPTIONS
  -s, --shell=bash|fish|zsh  (required) Name of shell

EXAMPLE
  $ synor completion --shell zsh

See code: oclif-plugin-completion

synor completion:generate

generates completion script

USAGE
  $ synor completion:generate

OPTIONS
  -s, --shell=bash|fish|zsh  (required) Name of shell

EXAMPLE
  $ synor completion:generate --shell zsh

See code: oclif-plugin-completion

synor current

show current migration record

USAGE
  $ synor current

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI
  --columns=columns                    only show provided columns (comma-separated)
  --no-header                          hide table header from output

DESCRIPTION
  This record indicates the current migration version for the database.

EXAMPLES
  $ synor current
  $ synor current --no-header --columns version

See code: src/commands/current.ts

synor drop

drop database

USAGE
  $ synor drop

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI

DESCRIPTION
  This command is DANGEROUS.
  Drops everything in the database.
  It should only be used for development purposes.

EXAMPLE
  $ synor drop

See code: src/commands/drop.ts

synor help [COMMAND]

display help for synor

USAGE
  $ synor help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

synor info

show migration information

USAGE
  $ synor info

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI
  -x, --extended                       show extra columns
  -z, --outOfOrder                     include out of order pending migrations
  --columns=columns                    only show provided columns (comma-separated)
  --filter=filter                      filter property by partial string matching, ex: name=foo
  --no-header                          hide table header from output

DESCRIPTION
  Shows detailed information about schema migrations.

EXAMPLES
  $ synor info
  $ synor info --outOfOrder
  $ synor info --no-header --columns version --filter state=pending

See code: src/commands/info.ts

synor migrate [TARGETVERSION]

migrate database to specific version

USAGE
  $ synor migrate [TARGETVERSION]

ARGUMENTS
  TARGETVERSION  target migration version

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -f, --from=from                      from migration version
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI
  -t, --to=to                          to migration version
  -z, --outOfOrder                     include out of order pending migrations

DESCRIPTION
  Runs necessary migrations to reach the target migration version.

EXAMPLES
  $ synor migrate 42
  $ synor migrate --from=00 --to=42
  $ synor migrate 42 --outOfOrder

See code: src/commands/migrate.ts

synor repair

repair migration records

USAGE
  $ synor repair

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI

DESCRIPTION
  - Updates the mismatched hashes
  - Deletes the dirty records

EXAMPLE
  $ synor repair

See code: src/commands/repair.ts

synor validate

validate migration records

USAGE
  $ synor validate

OPTIONS
  -D, --databaseEngine=databaseEngine  Database Engine
  -S, --sourceEngine=sourceEngine      Source Engine
  -b, --baseVersion=baseVersion        Version of the Base Migration
  -c, --config=config                  Configuration file path
  -d, --databaseUri=databaseUri        Database URI
  -i, --recordStartId=recordStartId    Migration Record Start ID
  -s, --sourceUri=sourceUri            Source URI
  -x, --extended                       show extra columns

DESCRIPTION
  Validates the records for migrations that are currently applied.

EXAMPLE
  $ synor validate

See code: src/commands/validate.ts