add session delete feature to relational only. add test, share conditions, and permissions. Closes #2940

This commit is contained in:
Francis Cao committed 2026-07-24 15:47:01 -07:00
1 parent 3a8f268d21
commit f9850f02b3
11 files changed
+499 -7

No files matched your search

+23
View File
@@ -81,6 +81,29 @@ describe('runQuery', () => {
});
});
describe('isRelationalOnly', () => {
test('returns true for a postgresql database without clickhouse', () => {
vi.stubEnv('CLICKHOUSE_URL', '');
vi.stubEnv('DATABASE_URL', 'postgresql://user:pass@localhost:5432/umami');
expect(db.isRelationalOnly()).toBe(true);
});
test('returns false when clickhouse is enabled', () => {
vi.stubEnv('CLICKHOUSE_URL', 'http://localhost:8123');
vi.stubEnv('DATABASE_URL', 'postgresql://user:pass@localhost:5432/umami');
expect(db.isRelationalOnly()).toBe(false);
});
test('returns false for unsupported non-relational databases', () => {
vi.stubEnv('CLICKHOUSE_URL', '');
vi.stubEnv('DATABASE_URL', 'mysql://user:pass@localhost:3306/umami');
expect(db.isRelationalOnly()).toBe(false);
});
});
describe('BigInt.prototype.toJSON', () => {
test('serializes bigint values as numbers', () => {
expect((BigInt(123) as any).toJSON()).toBe(123);
+4
View File
@@ -19,6 +19,10 @@ export function getDatabaseType(url = process.env.DATABASE_URL) {
return type;
}
export function isRelationalOnly() {
return !process.env.CLICKHOUSE_URL && getDatabaseType() === POSTGRESQL;
}
export async function runQuery(queries: any) {
if (process.env.CLICKHOUSE_URL) {
if (queries[KAFKA]) {