initDB

Create a database (schema) and a minimal set of DB object for a UnityBase ORM

Usage from a command line:

 ubcli initDB -?
 ubcli initDB -u admin -p admin -dba postgres -dbaPwd postgreDBAPassword

Usage from a code:

 const initDB = require('@unitybase/ubcli/initDB')
 let options = {
    host: 'http://localhost:888',
    user: 'admin',
    pwd: 'admin',
    clientIdentifier: 3,
    dropDatabase: true,
    createDatabase: true,
    dba: 'postgres',
    dbaPwd: 'postgreDBAPassword'
}
initDB(options)

If DBA already create a database set both dropDatabase & createDatabase to false

Methods

initDB(cfg) inner

Arguments:
  1. cfg (Object)
    Properties
    1. [clientIdentifier=3] (Number)  Identifier of the client. Must be between 2 and 8999. Number 1 is for UnityBase developer, 3 for test. Numbers > 100 is for real installations
    2. [dropDatabase=false] (Boolean)  Drop a database/schema first
    3. [createDatabase=false] (Boolean)  Create a new database/schema.
    4. [dba] (String)  A DBA name. Used in case createDatabase=true
    5. [dbaPwd] (String)  A DBA password. Used in case createDatabase=true