The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(server): ship ClickHouse migrations in the server build (#25357)
Etiennead7f0f64e99e
diff --git a/packages/twenty-server/nest-cli.json b/packages/twenty-server/nest-cli.jsonindex 4687d9d575b..2647d8bea40 100644--- a/packages/twenty-server/nest-cli.json+++ b/packages/twenty-server/nest-cli.json@@ -49,7 +49,7 @@"outDir": "dist/assets"},{- "include": "database/clickHouse/migrations/*.sql",+ "include": "database/clickhouse/migrations/*.sql","outDir": "dist"},{diff --git a/packages/twenty-server/src/database/clickhouse/migrations/run-migrations.ts b/packages/twenty-server/src/database/clickhouse/migrations/run-migrations.tsindex 244f07911fd..96c673c54c8 100644--- a/packages/twenty-server/src/database/clickhouse/migrations/run-migrations.ts+++ b/packages/twenty-server/src/database/clickhouse/migrations/run-migrations.ts@@ -80,6 +80,12 @@ async function runMigrations() {const dir = path.join(__dirname);const files = fs.readdirSync(dir).filter((f) => f.endsWith('.sql'));+ if (files.length === 0) {+ throw new Error(+ `No .sql migration file in ${dir}: the build did not copy the ClickHouse migrations`,+ );+ }+await ensureDatabaseExists();const client = createClient({