0.1.18 • Published 4 years ago

xc-migrator-ts v0.1.18

Weekly downloads
79
License
AGPL-3.0-or-later
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.1.18

4 years ago

0.1.17

4 years ago

0.1.16

4 years ago

0.1.14

4 years ago

0.1.15

4 years ago

0.1.13

4 years ago

0.1.12

4 years ago

0.1.11

4 years ago

0.1.10

4 years ago

0.1.9

4 years ago

0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

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