Major version update. Major bugfixes. Security vulnerabilites fixed
This commit is contained in:
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* # Record a schema change before it runs
|
||||
* @description Logs the change (unless this is a dry run) and refuses
|
||||
* destructive changes that were not approved.
|
||||
*/
|
||||
export default function recordSchemaChange(params, change) {
|
||||
params.changes?.push(change);
|
||||
if (params.dry_run) {
|
||||
return;
|
||||
}
|
||||
const allowed = params.allow_destructive;
|
||||
if (change.destructive &&
|
||||
allowed !== undefined &&
|
||||
allowed !== true &&
|
||||
!allowed.has(change.description)) {
|
||||
throw new Error(`Refusing unapproved destructive change: ${change.description}. Re-run with --dry-run to review, or --yes to allow it.`);
|
||||
}
|
||||
console.log(change.description);
|
||||
}
|
||||
Reference in New Issue
Block a user