Create a database (schema) & a minimal set of DB object for a UnityBase ORM
Will first create a temporary config with authentication disabled and
Example
//from a command line
>ub cmd/initDB -u admin -p admin -dba postgres -dbaPwd postgreDBAPassword
//from a code
var initDB = require('cmd/initDB');
var options = {
"host": "http://localhost:888",
"user": "admin",
"pwd": "admin",
"clientIdentifier": 3,
"dropDatabase": true,
"createDatabase": true,
"dba": "postgres",
"dbaPwd": "postgreDBAPassword"
};
initDB(options);
(require("cmd/initDB"))(options)
If DBA already create a database for you set both
dropDatabase
& createDatabase
to false
Arguments:
-
options
(Object)
Properties
-
[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 -
[dropDatabase=false]
(Boolean)
 Drop a database/schema first -
[createDatabase=false]
(Boolean)
 Create a new database/schema. -
[dba]
(String)
 A DBA name. Used in casecreateDatabase=true
-
[dbaPwd]
(String)
 A DBA password. Used in casecreateDatabase=true
-
Methods
createFakeConfig()
inner
Create a fake config with authentication disabled & empty domain.
Return a default database driver name
createSuperUser(conn, dbDriverName)
inner
Create a Everyone & admin roles and a SuperUser named admin with password admin
Arguments:
-
conn
(UBConnection)
-
dbDriverName
(String)
admin
conn
(UBConnection)
dbDriverName
(String)