-
-
Notifications
You must be signed in to change notification settings - Fork 2
savepoint.name()
Oxford Harrison edited this page Nov 15, 2024
·
2 revisions
DOCS • API • Savepoint API
Get the Savepoint's database name.
savepoint.count(
postRestore?: boolean,
): string;
Param | Interfaces | Description |
---|---|---|
postRestore? |
- | Optional directive that get's the database's post-restore name returned, instead of it's pre-restore name. Useful for working with Savepoints with database renames. |
Given the following operation:
// Name change
const savepoint = await client.alterDatabase(
'database_1',
(schema) => schema.name('database_1_new'),
{ returning: 'savepoint' }
);
Get the database's pre- and post-restore names:
// The database's active, pre-restore name
console.log(savepoint.name()); // database_1_new
// The database's post-restore name
console.log(savepoint.name(true)); // database_1
Given the following rollback:
const savepoint = await savepoint.rollback();
Get the database's pre- and post-restore names:
// The database's active, pre-restore name
console.log(savepoint.name()); // database_1
// The database's post-restore name
console.log(savepoint.name(true)); // database_1_new