0.3.2 • Published 4 years ago

xc-migrator v0.3.2

Weekly downloads
957
License
Apache-2.0
Repository
github
Last release
4 years ago

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

ParamTypeDescription
argsobject
args.typeStringtype of database (mysqlpgoraclemssqlsqlite)
args.titleStringName of Project
args.folderStringProject 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

ParamType
argsObject
args.envObject
args.dbAliasObject
args.jsonObject

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

ParamTypeDescription
argsobject
args.dbAliasStringDatabase 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

ParamType
argsobject
args.envString
args.dbAliasString

knexMigrator.migrationsUp(args)

migrationsUp

Kind: instance method of KnexMigrator

ParamTypeDescription
argsobject
args.envString
args.dbAliasString
args.folderString
args.stepsNumbernumber of steps to migrate
args.fileStringtill which file to migration
args.sqlContentMigrateNumberdefaults to 1 , on zero sqlContent is ignored and only filenames are migrated to _evolution table

knexMigrator.migrationsDown(args)

migrationsDown

Kind: instance method of KnexMigrator

ParamTypeDescription
argsobject
args.envString
args.dbAliasString
args.folderString
args.stepsNumbernumber of steps to migrate
args.fileStringtill which file to migration
args.sqlContentMigrateNumberdefaults 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

ParamTypeDescription
args*
args.envString
args.dbAliasString
args.folderString
args.upStatementArray.<Object>array of sql statements in obj
args.upStatement[].sqlStringsql statements without ';'
args.downStatementArray.<Object>
args.downStatement[].sqlStringsql statements without ';'
args.upStringup filename - up filename (only name not entire path)
args.downStringdown 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

ParamTypeDescription
argsobject
args.envString
args.dbAliasString
args.stepsNumbernumber of steps to migrate
args.fileStringtill 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

ParamType
args*
args.envString
args.dbAliasString
args.folderString

knexMigrator.migrationsSquash(args)

Migrations Squash

Kind: instance method of KnexMigrator

ParamType
args*
args.envString
args.dbAliasString
args.folderString
args.fileString
args.stepsString
args.upString
args.downString

knexMigrator.migrationsCreateManually(args)

Migrations Create Manual

Kind: instance method of KnexMigrator

ParamType
args*
args.envString
args.dbAliasString
args.folderString
args.fileString
args.stepsString
args.upString
args.downString

knexMigrator.migrationsRenameProjectKey(args) ⇒ Result

Kind: instance method of KnexMigrator

ParamTypeDescription
args
args.folderStringdefaults to process.cwd()
args.keyString
args.valueString

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

update json update sqlite project reopen

Kind: instance method of KnexMigrator

ParamType
args
args.folderString
args.envString
args.envValueString

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

update json update sqlite project reopen

Kind: instance method of KnexMigrator

ParamType
args
args.folderString
args.envString

knexMigrator.migrationsCreateEnvDb(args) ⇒ Result

Kind: instance method of KnexMigrator

ParamType
args
args.folderString
args.envString
args.dbString

KnexMigrator.KnexMigrator

Kind: static class of KnexMigrator

new KnexMigrator()

Creates an instance of KnexMigrator.

test

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.26

4 years ago

0.0.24

4 years ago

0.0.25

4 years ago

0.0.23

4 years ago

0.0.22

4 years ago

0.0.20

4 years ago

0.0.21

4 years ago

0.0.15

4 years ago

0.0.17

4 years ago

0.0.18

4 years ago

0.0.14

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.5

4 years ago

0.0.6

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

1.0.0

4 years ago