xc-migrator

0.3.2 • Public • Published

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
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

Readme

Keywords

none

Package Sidebar

Install

npm i xc-migrator

Homepage

xgene.cloud

Weekly Downloads

1

Version

0.3.2

License

Apache-2.0

Unpacked Size

130 kB

Total Files

40

Last publish

Collaborators

  • mertmit
  • wingkwong
  • o1lab
  • pranavxc