📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
add migrations
Blue Mouse7b6d02138129
diff --git a/backend/apps/cloud/src/project/dto/project.dto.ts b/backend/apps/cloud/src/project/dto/project.dto.tsindex 850d3f9cd..43ea9bd70 100644--- a/backend/apps/cloud/src/project/dto/project.dto.ts+++ b/backend/apps/cloud/src/project/dto/project.dto.ts@@ -44,7 +44,7 @@ export class ProjectDTO {ipBlacklist: string[] | null@ApiProperty({- example: 'UA,RU,BY',+ example: 'RU,BY,KP',required: false,description:'Array of blocked country codes (ISO 3166-1 alpha-2). Traffic from these countries will not be tracked.',diff --git a/backend/apps/community/src/common/utils.ts b/backend/apps/community/src/common/utils.tsindex e8cadce9b..3a0b838dc 100644--- a/backend/apps/community/src/common/utils.ts+++ b/backend/apps/community/src/common/utils.ts@@ -115,6 +115,7 @@ const ALLOWED_KEYS = ['name','origins','ipBlacklist',+ 'countryBlacklist','active','public','isPasswordProtected',@@ -442,6 +443,7 @@ const createProjectClickhouse = async (project: Partial<Project>) => {name,origins: '',ipBlacklist: '',+ countryBlacklist: '',active: 1,public: 0,isPasswordProtected: 0,diff --git a/backend/apps/community/src/project/dto/project.dto.ts b/backend/apps/community/src/project/dto/project.dto.tsindex f3991c75d..1e0d4d944 100644--- a/backend/apps/community/src/project/dto/project.dto.ts+++ b/backend/apps/community/src/project/dto/project.dto.ts@@ -43,6 +43,14 @@ export class ProjectDTO {})ipBlacklist: string[] | null+ @ApiProperty({+ example: 'RU,BY,KP',+ required: false,+ description:+ 'Array of blocked country codes (ISO 3166-1 alpha-2). Traffic from these countries will not be tracked.',+ })+ countryBlacklist: string[] | null+@ApiProperty({required: false,description:diff --git a/backend/apps/community/src/project/project.controller.ts b/backend/apps/community/src/project/project.controller.tsindex 67953fef1..4ca95f0e3 100644--- a/backend/apps/community/src/project/project.controller.ts+++ b/backend/apps/community/src/project/project.controller.ts@@ -942,6 +942,15 @@ export class ProjectController {project.ipBlacklist = []}+ if (projectDTO.countryBlacklist) {+ project.countryBlacklist = _map(+ projectDTO.countryBlacklist,+ _trim,+ ) as string[]+ } else {+ project.countryBlacklist = []+ }+if (projectDTO.botsProtectionLevel) {project.botsProtectionLevel = projectDTO.botsProtectionLevel}diff --git a/backend/migrations/clickhouse/initialise_selfhosted.js b/backend/migrations/clickhouse/initialise_selfhosted.jsindex 62aa7c8fa..f53922bb1 100644--- a/backend/migrations/clickhouse/initialise_selfhosted.js+++ b/backend/migrations/clickhouse/initialise_selfhosted.js@@ -24,6 +24,7 @@ const CLICKHOUSE_INIT_QUERIES = [name String,origins Nullable(String),ipBlacklist Nullable(String),+ countryBlacklist Nullable(String),active Int8,public Int8,isPasswordProtected Int8,diff --git a/backend/migrations/clickhouse/selfhosted_2025_11_30.js b/backend/migrations/clickhouse/selfhosted_2025_11_30.jsnew file mode 100644index 000000000..39a9fb72d--- /dev/null+++ b/backend/migrations/clickhouse/selfhosted_2025_11_30.js@@ -0,0 +1,8 @@+// This migration adds the countryBlacklist column to the project table+const { queriesRunner, dbName } = require('./setup')++const queries = [+ `ALTER TABLE ${dbName}.project ADD COLUMN countryBlacklist String DEFAULT '' AFTER ipBlacklist;`,+]++queriesRunner(queries)diff --git a/backend/migrations/mysql/2025_11_30.sql b/backend/migrations/mysql/2025_11_30.sqlindex 81ecb3cc6..5b689596c 100644--- a/backend/migrations/mysql/2025_11_30.sql+++ b/backend/migrations/mysql/2025_11_30.sql@@ -7,4 +7,3 @@ CREATE TABLE `annotation` (PRIMARY KEY (`id`),FOREIGN KEY (`projectId`) REFERENCES `project` (`id`) ON DELETE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;-diff --git a/backend/migrations/mysql/2025_11_30_country_blacklist.sql b/backend/migrations/mysql/2025_11_30_country_blacklist.sqlnew file mode 100644index 000000000..a12f4e499--- /dev/null+++ b/backend/migrations/mysql/2025_11_30_country_blacklist.sql@@ -0,0 +1 @@+ALTER TABLE `project` ADD COLUMN `countryBlacklist` text DEFAULT NULL AFTER `ipBlacklist`;