Skip to content

📈 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!

fix missing migrations

Blue Mouse2165c531231e
diff --git a/backend/migrations/clickhouse/initialise_selfhosted.js b/backend/migrations/clickhouse/initialise_selfhosted.js
index faa094c54..487b03b5f 100644
--- a/backend/migrations/clickhouse/initialise_selfhosted.js
+++ b/backend/migrations/clickhouse/initialise_selfhosted.js
@@ -38,6 +38,62 @@ const CLICKHOUSE_INIT_QUERIES = [
PARTITION BY toYYYYMM(created)
ORDER BY (created);`,
+ `CREATE TABLE IF NOT EXISTS ${dbName}.pinned_project
+ (
+ id String,
+ visitorId String,
+ projectId FixedString(12),
+ created DateTime('UTC')
+ )
+ ENGINE = ReplacingMergeTree(created)
+ ORDER BY (visitorId, projectId)
+ PARTITION BY toYYYYMM(created);`,
+
+ `CREATE TABLE IF NOT EXISTS ${dbName}.goal
+ (
+ id FixedString(36),
+ name String,
+ type Enum8('pageview' = 1, 'custom_event' = 2),
+ matchType Enum8('exact' = 1, 'contains' = 2, 'regex' = 3) DEFAULT 'exact',
+ value Nullable(String),
+ metadataFilters Nullable(String),
+ active Int8 DEFAULT 1,
+ projectId FixedString(12),
+ created DateTime
+ )
+ ENGINE = MergeTree()
+ PRIMARY KEY id;`,
+
+ `CREATE TABLE IF NOT EXISTS ${dbName}.feature_flag
+ (
+ id String,
+ key String,
+ description Nullable(String),
+ flagType Enum8('boolean' = 1, 'rollout' = 2) DEFAULT 'boolean',
+ rolloutPercentage UInt8 DEFAULT 100,
+ targetingRules Nullable(String),
+ enabled Int8 DEFAULT 1,
+ projectId FixedString(12),
+ created DateTime('UTC')
+ )
+ ENGINE = ReplacingMergeTree(created)
+ ORDER BY (projectId, id)
+ PARTITION BY toYYYYMM(created);`,
+
+ `CREATE TABLE IF NOT EXISTS ${dbName}.feature_flag_evaluations
+ (
+ pid FixedString(12),
+ flagId String,
+ flagKey String,
+ result UInt8,
+ profileId String,
+ created DateTime('UTC')
+ )
+ ENGINE = MergeTree()
+ PARTITION BY toYYYYMM(created)
+ ORDER BY (pid, flagId, created)
+ TTL created + INTERVAL 1 YEAR;`,
+
`CREATE TABLE IF NOT EXISTS ${dbName}.refresh_token
(
userId String CODEC(ZSTD(3)),
diff --git a/backend/migrations/clickhouse/selfhosted_2025_12_24_website_url.js b/backend/migrations/clickhouse/selfhosted_2025_12_24_website_url.js
index af6913643..7144ad850 100644
--- a/backend/migrations/clickhouse/selfhosted_2025_12_24_website_url.js
+++ b/backend/migrations/clickhouse/selfhosted_2025_12_24_website_url.js
@@ -3,7 +3,7 @@
const { queriesRunner, dbName } = require('./setup')
const queries = [
- `ALTER TABLE ${dbName}.project ADD COLUMN websiteUrl Nullable(String) DEFAULT NULL AFTER adminId;`,
+ `ALTER TABLE ${dbName}.project ADD COLUMN websiteUrl Nullable(String) CODEC(ZSTD(3)) AFTER adminId;`,
]
queriesRunner(queries)