create database modal

This commit is contained in:
Jan Prochazka
2020-06-18 16:15:39 +02:00
parent ec8b034541
commit 07287e5f7f
4 changed files with 55 additions and 0 deletions

View File

@@ -65,9 +65,18 @@ function handlePing() {
lastPing = new Date().getTime();
}
async function handleCreateDatabase({ name }) {
const driver = engines(storedConnection);
systemConnection = await driverConnect(driver, storedConnection);
console.log(`RUNNING SCRIPT: CREATE DATABASE ${driver.dialect.quoteIdentifier(name)}`);
await driver.query(systemConnection, `CREATE DATABASE ${driver.dialect.quoteIdentifier(name)}`);
await handleRefresh();
}
const messageHandlers = {
connect: handleConnect,
ping: handlePing,
createDatabase: handleCreateDatabase,
};
async function handleMessage({ msgtype, ...other }) {