'use strict';
import { execSyncCommand, execOutput } from '../tools/exec.js';
import { systemCommands } from '../constants/npm-commands.js';
import { environmentVariables } from '../constants/ci-constants.js';
import { getStringEnvSetting } from '../../../fd-toolbox/infra/env-functions.js';

var __defProp=Object['defineProperty'],__name=(_0x4232a0,_0x2cc1dd)=>__defProp(_0x4232a0,'name',{'value':_0x2cc1dd,'configurable':!![]});async function dropAllDb(){execSyncCommand(systemCommands['aptUpdate']),execSyncCommand(systemCommands['aptInstallPostgresClient']);const _0x331954=getStringEnvSetting(environmentVariables['databaseUrl']),_0x49a0d0='\x0a\x20\x20\x20\x20SELECT\x20\x27DROP\x20DATABASE\x20IF\x20EXISTS\x20\x22\x27\x20||\x20datname\x20||\x20\x27\x22;\x27\x0a\x20\x20\x20\x20FROM\x20pg_database\x0a\x20\x20\x20\x20WHERE\x20datname\x20LIKE\x20\x27saas-kit-test-%\x27;\x0a\x20\x20'['replace'](/\n/g,'\x20')['replace'](/"/g,'\x5c\x22'),_0x3873d7=''+systemCommands['psql']+_0x331954+'\x22\x20-At\x20-c\x20\x22'+_0x49a0d0+'\x22',_0x530ffd=execOutput(_0x3873d7);_0x530ffd['split']('\x0a')['filter'](Boolean)['forEach'](_0x44755a=>{execSyncCommand(''+systemCommands['psql']+_0x331954+'\x22\x20-c\x20\x27'+_0x44755a+'\x27');});}__name(dropAllDb,'dropAllDb');

export { dropAllDb };
