This is a convenience service that creates (and drops) an SQL database using the Knex Query Builder module.
Important Note Before creating this "Drops" any existing database with the target database name. So you should be sure to point the name to a specific "features" database. At this time only PostgresSQL and MySQL flavors of databases are supported.
const { createDatabaseService } = require('cukelib');... or standalone ...
const createDatabaseService = require('cukelib/lib/create_database_service');configis an object that can be passed toknex(...)to create a knex client. This is the same config object that is passed toknexto create a connection.config.namecan be specified as an explicit name for thecukelibservice identifier, otherwise the service name defaults to the database name fromconfig.connection.databaseor a sequentially named identifier.configshould include at least
{
client: <(pg|mysql)>,
connection: {
user: <db username> // needed for mysql -- in most cases 'root' will be the default
database: <database name>
},
debug: true // include this to get SQL dumps if you run into trouble.
}
- Returns a promise for a
cukelibservice object:
{
name: <name from the config>,
stop: <stop Function>,
config: <merged config object>
}
Convenience method that wraps serviceControl.initialize()
Returns the service object created by knexService.launch