mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-06 08:18:39 +00:00
Make orgId nullable (#113)
This commit is contained in:
parent
45d7565605
commit
ff5a94001c
5 changed files with 10 additions and 3 deletions
2
.github/workflows/CI.yml
vendored
2
.github/workflows/CI.yml
vendored
|
|
@ -106,6 +106,6 @@ jobs:
|
|||
run: pnpm install
|
||||
- name: Migrate production database
|
||||
run: npx drizzle-kit migrate
|
||||
working-directory: apps/db
|
||||
working-directory: packages/db
|
||||
env:
|
||||
DATABASE_URL: ${{ secrets.PRODUCTION_DATABASE_URL }}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ type Table = 'events' | 'messages';
|
|||
|
||||
type AnalyticsEvent = {
|
||||
id: string;
|
||||
orgId: string;
|
||||
orgId: string | null;
|
||||
userId: string;
|
||||
timestamp: number;
|
||||
event: RooCodeTelemetryEvent;
|
||||
|
|
@ -36,6 +36,7 @@ export const captureEvent = async ({ event, ...rest }: AnalyticsEvent) => {
|
|||
table = 'messages';
|
||||
const { taskId, mode, message } = event.properties;
|
||||
const { ts, type, ask, say, text, reasoning, partial } = message;
|
||||
|
||||
value = {
|
||||
...rest,
|
||||
taskId,
|
||||
|
|
@ -48,6 +49,7 @@ export const captureEvent = async ({ event, ...rest }: AnalyticsEvent) => {
|
|||
reasoning,
|
||||
partial,
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
|
|
@ -95,10 +97,12 @@ export const getUsage = async ({
|
|||
}
|
||||
|
||||
const userFilter = effectiveUserId ? 'AND userId = {userId: String}' : '';
|
||||
|
||||
const queryParams: Record<string, string | number> = {
|
||||
orgId: orgId!,
|
||||
timePeriod,
|
||||
};
|
||||
|
||||
if (effectiveUserId) {
|
||||
queryParams.userId = effectiveUserId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import { analytics } from '@/lib/server';
|
|||
|
||||
const messageSchema = z.object({
|
||||
id: z.string(),
|
||||
orgId: z.string(),
|
||||
orgId: z.string().nullable(),
|
||||
userId: z.string(),
|
||||
taskId: z.string(),
|
||||
mode: z.string().nullable(),
|
||||
|
|
|
|||
|
|
@ -32,3 +32,5 @@ CREATE TABLE default.events
|
|||
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{uuid}/{shard}', '{replica}')
|
||||
ORDER BY (id, type, timestamp)
|
||||
SETTINGS index_granularity = 8192;
|
||||
|
||||
ALTER TABLE default.events MODIFY COLUMN `orgId` Nullable(String);
|
||||
|
|
|
|||
|
|
@ -18,3 +18,4 @@ ORDER BY (id, timestamp)
|
|||
SETTINGS index_granularity = 8192;
|
||||
|
||||
ALTER TABLE default.messages ADD COLUMN mode Nullable(String);
|
||||
ALTER TABLE default.messages MODIFY COLUMN `orgId` Nullable(String);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue