Implement Cockroachdb interaction

This commit is contained in:
Sammy-T 2022-10-24 06:47:35 -04:00
parent 38c9da4e55
commit 33422d8a6c
3 changed files with 22 additions and 6 deletions

View file

@ -6,6 +6,10 @@ const del = require('del');
function getDatabaseType(url = process.env.DATABASE_URL) {
const type = process.env.DATABASE_TYPE || (url && url.split(':')[0]);
if (process.env.COCKROACH_DB) {
return 'cockroachdb';
}
if (type === 'postgres') {
return 'postgresql';
}
@ -15,7 +19,7 @@ function getDatabaseType(url = process.env.DATABASE_URL) {
const databaseType = getDatabaseType();
if (!databaseType || !['mysql', 'postgresql'].includes(databaseType)) {
if (!databaseType || !['mysql', 'postgresql', 'cockroachdb'].includes(databaseType)) {
throw new Error('Missing or invalid database');
}