feat: support mongodb connection

This commit is contained in:
Joseph Lee 2023-05-15 15:49:21 +09:00
parent 586529a5ca
commit bb30b43a8e
9 changed files with 370 additions and 30 deletions

View file

@ -9,6 +9,8 @@ function getDatabaseType(url = process.env.DATABASE_URL) {
if (type === 'postgres') {
return 'postgresql';
} else if (type === 'mongodb+srv') {
return 'mongodb';
}
return type;
@ -16,7 +18,7 @@ function getDatabaseType(url = process.env.DATABASE_URL) {
const databaseType = getDatabaseType();
if (!databaseType || !['mysql', 'postgresql'].includes(databaseType)) {
if (!databaseType || !['mysql', 'postgresql', 'mongodb'].includes(databaseType)) {
throw new Error('Missing or invalid database');
}