Activate pgcrypto extension for digest() function in database initialization and migration scripts
This commit is contained in:
34
backend/fix-pgcrypto-extension.js
Normal file
34
backend/fix-pgcrypto-extension.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import { sequelize } from './utils/sequelize.js';
|
||||
|
||||
async function fixPgCryptoExtension() {
|
||||
try {
|
||||
console.log('🔧 Aktiviere pgcrypto Erweiterung...');
|
||||
|
||||
await sequelize.query('CREATE EXTENSION IF NOT EXISTS pgcrypto;');
|
||||
|
||||
console.log('✅ pgcrypto Erweiterung erfolgreich aktiviert');
|
||||
|
||||
// Prüfe ob die Erweiterung aktiviert ist
|
||||
const result = await sequelize.query(`
|
||||
SELECT EXISTS(
|
||||
SELECT 1 FROM pg_extension WHERE extname = 'pgcrypto'
|
||||
) as extension_exists;
|
||||
`, { type: sequelize.QueryTypes.SELECT });
|
||||
|
||||
if (result[0]?.extension_exists) {
|
||||
console.log('✅ Bestätigung: pgcrypto Erweiterung ist aktiviert');
|
||||
} else {
|
||||
console.warn('⚠️ Warnung: pgcrypto Erweiterung konnte nicht aktiviert werden');
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Fehler beim Aktivieren der pgcrypto Erweiterung:', error.message);
|
||||
console.error('Stack:', error.stack);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fixPgCryptoExtension();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user