Skip to content

savepoint.reverseSQL

Oxford Harrison edited this page Nov 15, 2024 · 2 revisions

DOCSAPISavepoint API


Get the rollback or recommit SQL for preview.

Syntax

savepoint.reverseSQL(): string;

Usage

Given the following operation:

// Name change
const savepoint = await client.alterDatabase(
    'database_1',
    (schema) => schema.name('database_1_new'),
    { returning: 'savepoint' }
);

Get the rollback SQL preview:

console.log(savepoint.reverseSQL());
Console
ALTER SCHEMA database_1_new RENAME TO database_1

Given the following rollback:

const savepoint = await savepoint.rollback();

Get the recommit SQL preview:

console.log(savepoint.reverseSQL());
Console
ALTER SCHEMA database_1 RENAME TO database_1_new
Clone this wiki locally