Null - Second command - Cleaning remaining empty values#16241
Merged
charlesBochet merged 3 commits intomainfrom Dec 2, 2025
Merged
Null - Second command - Cleaning remaining empty values#16241charlesBochet merged 3 commits intomainfrom
charlesBochet merged 3 commits intomainfrom
Conversation
Contributor
Greptile OverviewGreptile SummaryAdds migration command to clean up empty string defaults in TEXT fields introduced by PR #16217. The command handles two scenarios: standard objects with empty string defaults at DB level (with null in metadata), and custom objects' Key changes:
Issues found:
Confidence Score: 3/5
Important Files ChangedFile Analysis
Sequence DiagramsequenceDiagram
participant CMD as CleanEmptyStringCommand
participant ORM as ObjectMetadataRepository
participant DS as DataSource
participant DB as PostgreSQL Database
participant FM as FieldMetadataRepository
CMD->>ORM: find({ workspaceId, relations: ['fields'] })
ORM-->>CMD: objectMetadataItems[]
loop For each object
CMD->>CMD: computeObjectTargetTable(objectMetadata)
alt !isCustom (Standard Object)
CMD->>CMD: cleanUpEmptyStringDefaultsInTextFieldsInStandardObjects()
loop For each TEXT field with isNullable=true, defaultValue=null
CMD->>DB: SELECT column_default FROM information_schema
DB-->>CMD: columnDefault
alt columnDefault is empty string
CMD->>DS: ALTER TABLE DROP DEFAULT
DS->>DB: Execute DDL
CMD->>DS: UPDATE SET field = NULL WHERE field = ''
DS->>DB: Execute DML
end
end
end
CMD->>CMD: cleanUpEmptyStringDefaultsAndSetNullableInNameFieldInCustomObjects()
alt Has name field with defaultValue=''
CMD->>DS: ALTER TABLE DROP DEFAULT, DROP NOT NULL
DS->>DB: Execute DDL
CMD->>DS: UPDATE SET name = NULL WHERE name = ''
DS->>DB: Execute DML
CMD->>FM: update(nameField.id, {defaultValue: null, isNullable: true})
FM->>DB: Update metadata
end
end
|
...commands/upgrade-version-command/1-13/1-13-clean-empty-string-null-in-text-fields.command.ts
Show resolved
Hide resolved
...commands/upgrade-version-command/1-13/1-13-clean-empty-string-null-in-text-fields.command.ts
Show resolved
Hide resolved
...commands/upgrade-version-command/1-13/1-13-clean-empty-string-null-in-text-fields.command.ts
Show resolved
Hide resolved
Contributor
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:41638 This environment will automatically shut down when the PR is closed or after 5 hours. |
...commands/upgrade-version-command/1-13/1-13-clean-empty-string-null-in-text-fields.command.ts
Show resolved
Hide resolved
charlesBochet
approved these changes
Dec 2, 2025
|
Hey @etiennejouan! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because of this code I forget to clean,
Command cleans data and updates table structure