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

xc-migrator

v0.3.2

Published

SQL based schema migrations or evolutions

Downloads

37

Readme

Install & setup

API Reference

Kind: global class
Extends: SqlMigrator

new KnexMigrator()

Class to create an instance of KnexMigrator

knexMigrator.init(args)

Initialises migration project Creates project json file in pwd of where command is run. Creates xmigrator folder in pwd, within which migrations for all dbs will be sored

Kind: instance method of KnexMigrator

| Param | Type | Description | | --- | --- | --- | | args | object | | | args.type | String | type of database (mysql | pg | oracle | mssql | sqlite) | | args.title | String | Name of Project | | args.folder | String | Project Dir |

knexMigrator.sync()

Sync is called after init() or any change to config.xc.json file This initialises databases and migration tables within each connection of config.xc.json

Kind: instance method of KnexMigrator

knexMigrator.clean(args)

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | Object | | args.env | Object | | args.dbAlias | Object | | args.json | Object |

knexMigrator.migrationsCreate(args) ⇒ object | String | String

Creates up and down migration files within migration folders

Kind: instance method of KnexMigrator
Returns: object - filesString - files.upString - files.down

| Param | Type | Description | | --- | --- | --- | | args | object | | | args.dbAlias | String | Database alias within environment |

knexMigrator.migrationsDelete(args) ⇒ String | String

Creates up and down migration files within migration folders

Kind: instance method of KnexMigrator
Returns: String - files.upString - files.down

| Param | Type | | --- | --- | | args | object | | args.env | String | | args.dbAlias | String |

knexMigrator.migrationsUp(args)

migrationsUp

Kind: instance method of KnexMigrator

| Param | Type | Description | | --- | --- | --- | | args | object | | | args.env | String | | | args.dbAlias | String | | | args.folder | String | | | args.steps | Number | number of steps to migrate | | args.file | String | till which file to migration | | args.sqlContentMigrate | Number | defaults to 1 , on zero sqlContent is ignored and only filenames are migrated to _evolution table |

knexMigrator.migrationsDown(args)

migrationsDown

Kind: instance method of KnexMigrator

| Param | Type | Description | | --- | --- | --- | | args | object | | | args.env | String | | | args.dbAlias | String | | | args.folder | String | | | args.steps | Number | number of steps to migrate | | args.file | String | till which file to migration | | args.sqlContentMigrate | Number | defaults to 1 , on zero sqlContent is ignored and only filenames are migrated to _evolution table |

knexMigrator.migrationsWrite(args)

Migrations write

Kind: instance method of KnexMigrator

| Param | Type | Description | | --- | --- | --- | | args | * | | | args.env | String | | | args.dbAlias | String | | | args.folder | String | | | args.upStatement | Array.<Object> | array of sql statements in obj | | args.upStatement[].sql | String | sql statements without ';' | | args.downStatement | Array.<Object> | | | args.downStatement[].sql | String | sql statements without ';' | | args.up | String | up filename - up filename (only name not entire path) | | args.down | String | down filename - down filename (only name not entire path) |

knexMigrator.migrationsList(args) ⇒ Object | Object | Object | String | String

Migrations List

Kind: instance method of KnexMigrator
Returns: Object - ResultObject - Result.dataObject - Result.data.objectString - Result.data.object.listString - Result.data.object.pending

| Param | Type | Description | | --- | --- | --- | | args | object | | | args.env | String | | | args.dbAlias | String | | | args.steps | Number | number of steps to migrate | | args.file | String | till which file to migration |

knexMigrator.migrationsToSql(args) ⇒ Object | Object | Object | String | String

Migrations to SQL

Kind: instance method of KnexMigrator
Returns: Object - ResultObject - Result.dataObject - Result.data.objectString - Result.data.object.upString - Result.data.object.down

| Param | Type | | --- | --- | | args | * | | args.env | String | | args.dbAlias | String | | args.folder | String |

knexMigrator.migrationsSquash(args)

Migrations Squash

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | * | | args.env | String | | args.dbAlias | String | | args.folder | String | | args.file | String | | args.steps | String | | args.up | String | | args.down | String |

knexMigrator.migrationsCreateManually(args)

Migrations Create Manual

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | * | | args.env | String | | args.dbAlias | String | | args.folder | String | | args.file | String | | args.steps | String | | args.up | String | | args.down | String |

knexMigrator.migrationsRenameProjectKey(args) ⇒ Result

Kind: instance method of KnexMigrator

| Param | Type | Description | | --- | --- | --- | | args | | | | args.folder | String | defaults to process.cwd() | | args.key | String | | | args.value | String | |

knexMigrator.migrationsCreateEnv(args) ⇒ Promise.<void>

update json update sqlite project reopen

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | | | args.folder | String | | args.env | String | | args.envValue | String |

knexMigrator.migrationsDeleteEnv(args) ⇒ Promise.<void>

update json update sqlite project reopen

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | | | args.folder | String | | args.env | String |

knexMigrator.migrationsCreateEnvDb(args) ⇒ Result

Kind: instance method of KnexMigrator

| Param | Type | | --- | --- | | args | | | args.folder | String | | args.env | String | | args.db | String |

KnexMigrator.KnexMigrator

Kind: static class of KnexMigrator

new KnexMigrator()

Creates an instance of KnexMigrator.

test