mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 05:36:00 +00:00
SYNC: sqlite - passed transaction test
This commit is contained in:
committed by
Diflow
parent
7d26dd5348
commit
fffd81267d
@@ -9,19 +9,23 @@ const dbgatePluginPostgres = require('dbgate-plugin-postgres');
|
||||
dbgateApi.registerPlugins(dbgatePluginPostgres);
|
||||
|
||||
async function createDb(connection, dropDbSql, createDbSql, database = 'my_guitar_shop') {
|
||||
try {
|
||||
await dbgateApi.executeQuery({
|
||||
connection,
|
||||
sql: dropDbSql,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Failed to drop database', err);
|
||||
if (dropDbSql) {
|
||||
try {
|
||||
await dbgateApi.executeQuery({
|
||||
connection,
|
||||
sql: dropDbSql,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('Failed to drop database', err);
|
||||
}
|
||||
}
|
||||
|
||||
await dbgateApi.executeQuery({
|
||||
connection,
|
||||
sql: createDbSql,
|
||||
});
|
||||
if (createDbSql) {
|
||||
await dbgateApi.executeQuery({
|
||||
connection,
|
||||
sql: createDbSql,
|
||||
});
|
||||
}
|
||||
|
||||
await dbgateApi.importDbFromFolder({
|
||||
connection: {
|
||||
@@ -89,6 +93,18 @@ async function run() {
|
||||
'C##my_guitar_shop'
|
||||
);
|
||||
}
|
||||
|
||||
if (localconfig.sqlite) {
|
||||
await createDb(
|
||||
{
|
||||
databaseFile: process.env.FILE_sqlite,
|
||||
singleDatabase: true,
|
||||
engine: 'sqlite@dbgate-plugin-sqlite',
|
||||
},
|
||||
null,
|
||||
null
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
dbgateApi.runScript(run);
|
||||
|
||||
Reference in New Issue
Block a user