mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
feat(database): add psql_bouncer support and simplify postgresql config
- Add new psql_bouncer database provider option - Update database scripts to handle psql_bouncer provider - Comment out pgbouncer service in docker-compose - Simplify postgresql schema by removing directUrl - Add new psql_bouncer-schema.prisma file - Update .env.example with psql_bouncer configuration - Modify runWithProvider.js to handle psql_bouncer migrations
This commit is contained in:
@@ -11,11 +11,28 @@ if (!DATABASE_PROVIDER) {
|
||||
console.warn(`DATABASE_PROVIDER is not set in the .env file, using default: ${databaseProviderDefault}`);
|
||||
}
|
||||
|
||||
// Função para determinar qual pasta de migrations usar
|
||||
// Função para determinar qual pasta de migrations usar
|
||||
function getMigrationsFolder(provider) {
|
||||
switch (provider) {
|
||||
case 'psql_bouncer':
|
||||
return 'postgresql-migrations'; // psql_bouncer usa as migrations do postgresql
|
||||
default:
|
||||
return `${provider}-migrations`;
|
||||
}
|
||||
}
|
||||
|
||||
const migrationsFolder = getMigrationsFolder(databaseProviderDefault);
|
||||
|
||||
let command = process.argv
|
||||
.slice(2)
|
||||
.join(' ')
|
||||
.replace(/DATABASE_PROVIDER/g, databaseProviderDefault);
|
||||
|
||||
// Substituir referências à pasta de migrations pela pasta correta
|
||||
const migrationsPattern = new RegExp(`${databaseProviderDefault}-migrations`, 'g');
|
||||
command = command.replace(migrationsPattern, migrationsFolder);
|
||||
|
||||
if (command.includes('rmdir') && existsSync('prisma\\migrations')) {
|
||||
try {
|
||||
execSync('rmdir /S /Q prisma\\migrations', { stdio: 'inherit' });
|
||||
@@ -32,4 +49,4 @@ try {
|
||||
} catch (error) {
|
||||
console.error(`Error executing command: ${command}`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user