Skip to content

Fix json type in clickhouse migrations #11710

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2025
Merged

Conversation

FelixMalfait
Copy link
Member

Settings in clickhouse are only set for the duration of the session so we need to keep the same client

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR modifies the ClickHouse migration system to properly handle JSON type settings by maintaining a single client connection throughout the migration process.

  • Extracted JSON type enabling logic into new enableJsonType function in /packages/twenty-server/src/database/clickhouse/migrations/run-migrations.ts
  • Moved client.close() call to after all migrations complete to maintain session settings
  • Added fallback to allow_experimental_json_type if enable_json_type fails
  • Added error logging when JSON type enabling fails
  • Improved error handling by checking JSON type enabled status before proceeding

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@FelixMalfait FelixMalfait merged commit 0b729cb into main Apr 23, 2025
33 checks passed
@FelixMalfait FelixMalfait deleted the fix-clickhouse-migration-json branch April 23, 2025 20:08
FelixMalfait added a commit that referenced this pull request Apr 23, 2025
Settings in clickhouse are only set for the duration of the session so
we need to keep the same client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant