mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 20:15:41 +01:00
Implement Cockroachdb interaction
This commit is contained in:
parent
38c9da4e55
commit
33422d8a6c
3 changed files with 22 additions and 6 deletions
|
|
@ -1,6 +1,7 @@
|
|||
export const PRISMA = 'prisma';
|
||||
export const POSTGRESQL = 'postgresql';
|
||||
export const MYSQL = 'mysql';
|
||||
export const COCKROACHDB = 'cockroachdb';
|
||||
export const CLICKHOUSE = 'clickhouse';
|
||||
export const KAFKA = 'kafka';
|
||||
export const KAFKA_PRODUCER = 'kafka-producer';
|
||||
|
|
@ -14,6 +15,10 @@ BigInt.prototype.toJSON = function () {
|
|||
export function getDatabaseType(url = process.env.DATABASE_URL) {
|
||||
const type = url && url.split(':')[0];
|
||||
|
||||
if (process.env.COCKROACH_DB) {
|
||||
return COCKROACHDB;
|
||||
}
|
||||
|
||||
if (type === 'postgres') {
|
||||
return POSTGRESQL;
|
||||
}
|
||||
|
|
@ -24,7 +29,7 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
|
|||
export async function runQuery(queries) {
|
||||
const db = getDatabaseType(process.env.CLICKHOUSE_URL || process.env.DATABASE_URL);
|
||||
|
||||
if (db === POSTGRESQL || db === MYSQL) {
|
||||
if (db === POSTGRESQL || db === MYSQL || db === COCKROACHDB) {
|
||||
return queries[PRISMA]();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue