Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Weiko
Copy link
Member

@Weiko Weiko commented Jun 25, 2025

Fixes #12726

Context

Regression introduced in #12639
We now run raw queries for some migrations (column creations for example) and we created a typeormBuildCreateColumnSql util for that.
The issue is that previously we were using typeorm methods which was using isArray from the input to create $type[] (text[], number[]) properly which was not done in the new typeormBuildCreateColumnSql util (so the type was text, number, etc...)
Edit: actually this was correctly implemented for Enum types (multi select fields) but not Array type, I've updated the code accordingly

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

Fixed a regression where array column types weren't properly formatted in SQL migrations. The typeormBuildCreateColumnSql utility now correctly appends [] suffix for array types.

  • Modified packages/twenty-server/src/engine/workspace-manager/workspace-migration-runner/utils/internal/typeorm-build-create-column-sql.util.ts to properly handle array types in SQL column creation
  • Fixed regression where types like text[] were incorrectly created as just text
  • Added special handling for enum arrays using 'array' keyword instead of [] suffix

1 file reviewed, no comments
Edit PR Review Bot Settings | Greptile

@github-actions
Copy link
Contributor

github-actions bot commented Jun 25, 2025

🚀 Preview Environment Ready!

Your preview environment is available at: http://bore.pub:64377

This environment will automatically shut down when the PR is closed or after 5 hours.

@charlesBochet charlesBochet merged commit 74f53cc into main Jun 25, 2025
42 checks passed
@charlesBochet charlesBochet deleted the c--fix-array-field-migration branch June 25, 2025 14:42
Weiko added a commit that referenced this pull request Jun 25, 2025
Fixes #12726

## Context
Regression introduced in #12639
We now run raw queries for some migrations (column creations for
example) and we created a `typeormBuildCreateColumnSql` util for that.
The issue is that previously we were using typeorm methods which was
using isArray from the input to create $type[] (text[], number[])
properly which was not done in the new `typeormBuildCreateColumnSql`
util (so the type was text, number, etc...)
Edit: actually this was correctly implemented for Enum types (multi
select fields) but not Array type, I've updated the code accordingly
Weiko added a commit that referenced this pull request Jun 25, 2025
Fixes #12726

## Context
Regression introduced in #12639
We now run raw queries for some migrations (column creations for
example) and we created a `typeormBuildCreateColumnSql` util for that.
The issue is that previously we were using typeorm methods which was
using isArray from the input to create $type[] (text[], number[])
properly which was not done in the new `typeormBuildCreateColumnSql`
util (so the type was text, number, etc...)
Edit: actually this was correctly implemented for Enum types (multi
select fields) but not Array type, I've updated the code accordingly
abdulrahmancodes pushed a commit to abdulrahmancodes/twenty that referenced this pull request Jun 26, 2025
Fixes twentyhq#12726

## Context
Regression introduced in twentyhq#12639
We now run raw queries for some migrations (column creations for
example) and we created a `typeormBuildCreateColumnSql` util for that.
The issue is that previously we were using typeorm methods which was
using isArray from the input to create $type[] (text[], number[])
properly which was not done in the new `typeormBuildCreateColumnSql`
util (so the type was text, number, etc...)
Edit: actually this was correctly implemented for Enum types (multi
select fields) but not Array type, I've updated the code accordingly
Weiko added a commit that referenced this pull request Jun 26, 2025
Following this fix #12874 we now
need to add a command to retroactively fix existing columns

---------

Co-authored-by: Paul Rastoin <[email protected]>
Co-authored-by: prastoin <[email protected]>
prastoin added a commit that referenced this pull request Jun 26, 2025
Following this fix #12874 we now
need to add a command to retroactively fix existing columns

---------

Co-authored-by: Paul Rastoin <[email protected]>
Co-authored-by: prastoin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array field incorrectly escapes quotes

3 participants