Kind: global class
Extends: SqlMigrator
-
KnexMigrator ⇐
SqlMigrator
- new KnexMigrator()
-
instance
- .init(args)
- .sync()
- .clean(args)
-
.migrationsCreate(args) ⇒
object
|String
|String
-
.migrationsDelete(args) ⇒
String
|String
- .migrationsUp(args)
- .migrationsDown(args)
- .migrationsWrite(args)
-
.migrationsList(args) ⇒
Object
|Object
|Object
|String
|String
-
.migrationsToSql(args) ⇒
Object
|Object
|Object
|String
|String
- .migrationsSquash(args)
- .migrationsCreateManually(args)
-
.migrationsRenameProjectKey(args) ⇒
Result
-
.migrationsCreateEnv(args) ⇒
Promise.<void>
-
.migrationsDeleteEnv(args) ⇒
Promise.<void>
-
.migrationsCreateEnvDb(args) ⇒
Result
- static
Class to create an instance of KnexMigrator
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 |
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
Kind: instance method of KnexMigrator
Param | Type |
---|---|
args | Object |
args.env | Object |
args.dbAlias | Object |
args.json | Object |
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 |
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 |
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 |
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 |
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) |
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 |
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 |
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 |
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 |
Kind: instance method of KnexMigrator
Param | Type | Description |
---|---|---|
args | ||
args.folder | String |
defaults to process.cwd() |
args.key | String |
|
args.value | String |
update json update sqlite project reopen
Kind: instance method of KnexMigrator
Param | Type |
---|---|
args | |
args.folder | String |
args.env | String |
args.envValue | String |
update json update sqlite project reopen
Kind: instance method of KnexMigrator
Param | Type |
---|---|
args | |
args.folder | String |
args.env | String |
Kind: instance method of KnexMigrator
Param | Type |
---|---|
args | |
args.folder | String |
args.env | String |
args.db | String |
Kind: static class of KnexMigrator
Creates an instance of KnexMigrator.
test