Merge pull request #2697 from lowjoel/database-refactor

refactor: Expose types to handle Database management
This commit is contained in:
Fredrik Adelöw
2020-10-09 07:16:26 +02:00
committed by GitHub
16 changed files with 275 additions and 57 deletions
+4 -5
View File
@@ -328,8 +328,8 @@ async function testAppServe(pluginName: string, appDir: string) {
}
}
/** Creates PG databases (drops if exists before) */
async function createDB(database: string) {
/** Drops PG databases */
async function dropDB(database: string) {
const config = {
host: process.env.POSTGRES_HOST,
port: process.env.POSTGRES_PORT,
@@ -342,7 +342,6 @@ async function createDB(database: string) {
} catch (_) {
/* do nothing*/
}
return pgtools.createdb(config, database);
}
/**
@@ -350,7 +349,7 @@ async function createDB(database: string) {
*/
async function testBackendStart(appDir: string, isPostgres: boolean) {
if (isPostgres) {
print('Creating DBs');
print('Dropping old DBs');
await Promise.all(
[
'catalog',
@@ -359,7 +358,7 @@ async function testBackendStart(appDir: string, isPostgres: boolean) {
'identity',
'proxy',
'techdocs',
].map(name => createDB(`backstage_plugin_${name}`)),
].map(name => dropDB(`backstage_plugin_${name}`)),
);
print('Created DBs');
}