Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Merge branch 'master' into umami-import

Edward Cui0b4dc556de85
diff --cc client/package-lock.json
index 7d5485af7,b06e35cc1..45e367517
--- a/client/package-lock.json
+++ b/client/package-lock.json
@@@ -62,8 -61,8 +62,9 @@@
"mapbox-gl": "^3.15.0",
"next": "15.3.2",
"next-themes": "0.4.6",
+ "nuqs": "^2.7.3",
"ol": "^10.6.1",
+ "papaparse": "^5.5.3",
"react": "19.1.0",
"react-day-picker": "^8.10.1",
"react-dom": "19.1.0",
diff --cc client/package.json
index 0f3e99a34,2df25b59d..debf76c91
--- a/client/package.json
+++ b/client/package.json
@@@ -66,8 -65,8 +66,9 @@@
"mapbox-gl": "^3.15.0",
"next": "15.3.2",
"next-themes": "0.4.6",
+ "nuqs": "^2.7.3",
"ol": "^10.6.1",
+ "papaparse": "^5.5.3",
"react": "19.1.0",
"react-day-picker": "^8.10.1",
"react-dom": "19.1.0",
diff --cc server/src/api/sites/deleteSite.ts
index bba7e7824,874595d44..110fcbd30
--- a/server/src/api/sites/deleteSite.ts
+++ b/server/src/api/sites/deleteSite.ts
@@@ -11,14 -14,15 +14,15 @@@ export async function deleteSite(reques
return reply.status(403).send({ error: "Forbidden" });
}
- await clickhouse.command({
- query: `DELETE FROM events WHERE site_id = {siteId:UInt16}`,
- query_params: {
- siteId: Number(id),
- },
- });
+ // await clickhouse.command({
+ // query: "DELETE FROM events WHERE site_id = {id:UInt32}",
+ // query_params: { id: Number(id) },
+ // });
+
+ // Delete the site from the sites table (related records will cascade delete automatically)
+ await db.delete(sites).where(eq(sites.siteId, Number(id)));
- siteConfig.removeSite(Number(id));
+ await siteConfig.removeSite(Number(id));
return reply.status(200).send({ success: true });
}
diff --cc server/src/db/postgres/schema.ts
index c2c09a412,262ed48e4..5d0ad4431
--- a/server/src/db/postgres/schema.ts
+++ b/server/src/db/postgres/schema.ts
@@@ -55,51 -53,32 +55,34 @@@ export const verification = pgTable("ve
});
// Sites table
- export const sites = pgTable(
- "sites",
- {
- id: text("id").$defaultFn(() => sql`encode(gen_random_bytes(6), 'hex')`),
- // deprecated - keeping as primary key for backwards compatibility
- siteId: serial("site_id").primaryKey().notNull(),
- name: text("name").notNull(),
- domain: text("domain").notNull(),
- createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
- updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow(),
- createdBy: text("created_by")
- .notNull()
- .references(() => user.id),
- organizationId: text("organization_id")
+ export const sites = pgTable("sites", {
+ id: text("id").$defaultFn(() => sql`encode(gen_random_bytes(6), 'hex')`),
+ // deprecated - keeping as primary key for backwards compatibility
+ siteId: serial("site_id").primaryKey().notNull(),
+ name: text("name").notNull(),
+ domain: text("domain").notNull(),
+ createdAt: timestamp("created_at", { mode: "string" }).defaultNow(),
+ updatedAt: timestamp("updated_at", { mode: "string" }).defaultNow(),
+ createdBy: text("created_by").references(() => user.id, { onDelete: "set null" }),
- organizationId: text("organization_id").references(() => organization.id),
++ organizationId: text("organization_id")
+ .notNull()
+ .references(() => organization.id),
- public: boolean().default(false),
- saltUserIds: boolean().default(false),
- blockBots: boolean().default(true).notNull(),
- excludedIPs: jsonb("excluded_ips").default([]), // Array of IP addresses/ranges to exclude
- excludedCountries: jsonb("excluded_countries").default([]), // Array of ISO country codes to exclude (e.g., ["US", "GB"])
- sessionReplay: boolean().default(false),
- webVitals: boolean().default(false),
- trackErrors: boolean().default(false),
- trackOutbound: boolean().default(true),
- trackUrlParams: boolean().default(true),
- trackInitialPageView: boolean().default(true),
- trackSpaNavigation: boolean().default(true),
- trackIp: boolean().default(false),
- apiKey: text("api_key"), // Format: rb_{32_hex_chars} = 35 chars total
- privateLinkKey: text("private_link_key"),
- },
- table => [
- foreignKey({
- columns: [table.createdBy],
- foreignColumns: [user.id],
- name: "sites_created_by_user_id_fk",
- }),
- foreignKey({
- columns: [table.organizationId],
- foreignColumns: [organization.id],
- name: "sites_organization_id_organization_id_fk",
- }),
- ]
- );
+ public: boolean().default(false),
+ saltUserIds: boolean().default(false),
+ blockBots: boolean().default(true).notNull(),
+ excludedIPs: jsonb("excluded_ips").default([]), // Array of IP addresses/ranges to exclude
+ excludedCountries: jsonb("excluded_countries").default([]), // Array of ISO country codes to exclude (e.g., ["US", "GB"])
+ sessionReplay: boolean().default(false),
+ webVitals: boolean().default(false),
+ trackErrors: boolean().default(false),
+ trackOutbound: boolean().default(true),
+ trackUrlParams: boolean().default(true),
+ trackInitialPageView: boolean().default(true),
+ trackSpaNavigation: boolean().default(true),
+ trackIp: boolean().default(false),
+ apiKey: text("api_key"), // Format: rb_{32_hex_chars} = 35 chars total
+ privateLinkKey: text("private_link_key"),
+ });
// Active sessions table
export const activeSessions = pgTable("active_sessions", {