feat(database)!: allow setting char size#2087
Open
regnerisch wants to merge 3 commits intotempestphp:3.xfrom
Open
feat(database)!: allow setting char size#2087regnerisch wants to merge 3 commits intotempestphp:3.xfrom
regnerisch wants to merge 3 commits intotempestphp:3.xfrom
Conversation
innocenzi
requested changes
Mar 29, 2026
Member
innocenzi
left a comment
There was a problem hiding this comment.
While this is definitely a breaking change, I think that's something we want here, be more explicit 👍
If you use CHAR, it's generally because you expect a specific length, so it doesn't make sense to have an implicit 1 as a default
Benchmark ResultsComparison of Open to see the benchmark resultsNo benchmark changes above ±5%. Generated by phpbench against commit 03ae720 |
brendt
requested changes
Mar 31, 2026
| * Adds a `CHAR` column to the table. | ||
| */ | ||
| public function char(string $name, bool $nullable = false, ?string $default = null): self | ||
| public function char(string $name, int $size, bool $nullable = false, ?string $default = null): self |
Member
There was a problem hiding this comment.
Let's set the default to 1, that way it's not a breaking change and I think it makes sense for 1 to be default.
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.
Until now it was not possible to set a specific CHAR size inside the migration:
With this PR, users are now forced to set a CHAR size:
As Postgres and MySQL consider the previous
foo CHARasfoo CHAR(1), this seems to be a breaking change. So maybe changingprivate int $size = 1would be better?Postgres:
MySQL: