Class: DbOperations
Contains methods to perform various operations on the current database.
Constructors
new DbOperations()
new DbOperations(
metadata
:Metadata
):DbOperations
Creates a new instance.
Parameters
Parameter | Type | Description |
---|---|---|
metadata | Metadata | The Verse metadata object. |
Returns
Defined in
packages/verse-core/src/verse.ts:547
Methods
exists()
exists():
Promise
<boolean
>
Determine whether the target database exists.
Returns
Promise
<boolean
>
A promise that resolves to true
if the database exists, otherwise false
.
Defined in
packages/verse-core/src/verse.ts:555
recreate()
recreate(
seed
:boolean
):Promise
<void
>
Re-create the database schema, and, optionally, seed the database with any seed data defined in the model.
NB: This will drop the target database if it exists.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
seed | boolean | true | Whether to seed the database with any seed data defined in the model. |
Returns
Promise
<void
>
A promise that resolves when the schema has been created.
Defined in
packages/verse-core/src/verse.ts:575
schema()
schema():
List
<SqlNode
>
Get a list of SQL operations that could be executed to create the database schema.
Returns
List
<SqlNode
>
A list of SQL operations.