ci: Fix test database cleanup (no-changelog) (#6188)
This commit is contained in:
committed by
GitHub
parent
82fe6383ef
commit
85a6ace56b
@@ -1,7 +1,7 @@
|
||||
import 'tsconfig-paths/register';
|
||||
import { DataSource as Connection } from 'typeorm';
|
||||
import config from '@/config';
|
||||
import { getBootstrapDBOptions } from './integration/shared/testDb';
|
||||
import { getBootstrapDBOptions, testDbPrefix } from './integration/shared/testDb';
|
||||
|
||||
export default async () => {
|
||||
const dbType = config.getEnv('database.type').replace(/db$/, '');
|
||||
@@ -14,9 +14,7 @@ export default async () => {
|
||||
dbType === 'postgres' ? 'SELECT datname as "Database" FROM pg_database' : 'SHOW DATABASES';
|
||||
const results: Array<{ Database: string }> = await connection.query(query);
|
||||
const databases = results
|
||||
.filter(
|
||||
({ Database: dbName }) => dbName.startsWith(`${dbType}_`) && dbName.endsWith('_n8n_test'),
|
||||
)
|
||||
.filter(({ Database: dbName }) => dbName.startsWith(testDbPrefix))
|
||||
.map(({ Database: dbName }) => dbName);
|
||||
|
||||
const promises = databases.map(async (dbName) => connection.query(`DROP DATABASE ${dbName};`));
|
||||
|
||||
Reference in New Issue
Block a user