SYNC: Added option to dump CREATE/DROP database in mysql dump #1103

This commit is contained in:
Jan Prochazka
2025-05-03 09:59:29 +02:00
committed by Diflow
parent c9f3e8cb9f
commit 28f62623bf

View File

@@ -253,7 +253,14 @@ const mysqlDriverBase = {
const customArgs = options.customArgs.split(/\s+/).filter(arg => arg.trim() != ''); const customArgs = options.customArgs.split(/\s+/).filter(arg => arg.trim() != '');
args.push(...customArgs); args.push(...customArgs);
} }
args.push(database); if (options.createDatabase) {
args.push('--databases', database);
if (options.dropDatabase) {
args.push('--add-drop-database');
}
} else {
args.push(database);
}
return { command, args }; return { command, args };
}, },
restoreDatabaseCommand(connection, settings, externalTools) { restoreDatabaseCommand(connection, settings, externalTools) {
@@ -346,6 +353,19 @@ const mysqlDriverBase = {
default: false, default: false,
disabledFn: values => values.lockTables || values.skipLockTables, disabledFn: values => values.lockTables || values.skipLockTables,
}, },
{
type: 'checkbox',
label: 'Create database',
name: 'createDatabase',
default: false,
},
{
type: 'checkbox',
label: 'Drop database before import',
name: 'dropDatabase',
default: false,
disabledFn: values => !values.createDatabase,
},
{ {
type: 'text', type: 'text',
label: 'Custom arguments', label: 'Custom arguments',