Skip to content

Implement typeTinyint for SQLite grammar#226

Merged
LukeTowers merged 4 commits into
wintercms:wip/1.3from
Mrkbingham:tiny_int_sql_lite_grammar
May 27, 2026
Merged

Implement typeTinyint for SQLite grammar#226
LukeTowers merged 4 commits into
wintercms:wip/1.3from
Mrkbingham:tiny_int_sql_lite_grammar

Conversation

@Mrkbingham
Copy link
Copy Markdown

@Mrkbingham Mrkbingham commented Mar 19, 2026

The compileChange override in vendor/winter/storm/src/Database/Schema/Grammars/SQLiteGrammar.php reads SQLite column type names as tinyint (from SQLite metadata for boolean columns), then calls getType() which looks for ->typeTinyint(... — but only typeTinyInteger exists in the base grammar file Illuminate\Database\Schema\Grammars\SQLiteGrammar.

This should resolve migration issues others might hit when upgrading to 1.3

Summary by CodeRabbit

  • Bug Fixes

    • SQLite schema operations now correctly handle tinyint column types, eliminating errors during column introspection and reconstruction.
  • Tests

    • Added validation tests for tinyint column type mapping in SQLite, ensuring proper SQL generation for schema operations.

Add typeTinyint method to handle tinyint type in SQLite.
@coderabbitai

This comment was marked as resolved.

@mjauvin mjauvin self-requested a review March 19, 2026 17:52
@mjauvin mjauvin added maintenance PRs that fix bugs, are translation changes or make only minor changes needs test case Issues/PRs that need a test case to be implemented labels Mar 19, 2026
@mjauvin mjauvin added this to the 1.3.0 milestone Mar 19, 2026
@mjauvin
Copy link
Copy Markdown
Member

mjauvin commented Mar 19, 2026

Would it be possible to submit a test case for this?

@Mrkbingham
Copy link
Copy Markdown
Author

@mjauvin added a test!

@mjauvin mjauvin removed the needs test case Issues/PRs that need a test case to be implemented label Mar 19, 2026
@mjauvin
Copy link
Copy Markdown
Member

mjauvin commented Mar 19, 2026

Thanks for adding the unit-test, however if I remove the typeTinyHint() method the test still passes.

@LukeTowers
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Mrkbingham
Copy link
Copy Markdown
Author

@mjauvin I went back and double-checked, I'm still getting this error when running PHPUnit tests in my WinterCMS app as well as the test case I wrote here. I'm running SQLite v3.51.0, not sure if it's a version issue.

I suppose as an alternative to lend more support downwards into Laravel rather than patching it here could be to just add a match statement on line 47:

'type' => match($column['type_name']) {                                                                                                                                    
      'tinyint'  => 'tinyInteger',
      default    => $column['type_name'],                                                                                                                                    
  }, 

Happy to provide more details if there's anything you're curious about here. Also thanks for getting Coderabbit to review this @LukeTowers !

@mjauvin
Copy link
Copy Markdown
Member

mjauvin commented Mar 23, 2026

@mjauvin I went back and double-checked, I'm still getting this error when running PHPUnit tests in my WinterCMS app as well as the test case I wrote here. I'm running SQLite v3.51.0, not sure if it's a version issue.

I suppose as an alternative to lend more support downwards into Laravel rather than patching it here could be to just add a match statement on line 47:

'type' => match($column['type_name']) {                                                                                                                                    
      'tinyint'  => 'tinyInteger',
      default    => $column['type_name'],                                                                                                                                    
  }, 

Happy to provide more details if there's anything you're curious about here. Also thanks for getting Coderabbit to review this @LukeTowers !

You may be right, the environment where I tested it uses an older SQLite version (v3.31.1).

@mjauvin
Copy link
Copy Markdown
Member

mjauvin commented Mar 23, 2026

@LukeTowers any idea what all those unit-test errors are?

@mjauvin mjauvin removed their request for review March 23, 2026 13:15
@github-actions github-actions Bot closed this May 26, 2026
@LukeTowers LukeTowers reopened this May 27, 2026
@wintercms wintercms deleted a comment from github-actions Bot May 27, 2026
Comment thread tests/Database/Schema/Grammars/SQLiteSchemaGrammarTest.php Outdated
@LukeTowers
Copy link
Copy Markdown
Member

@mjauvin these test failures look unrelated, I'll merge it into 1.3 now and will work on getting 1.3 up to date along with Laravel 13 support next week.

@LukeTowers LukeTowers merged commit 1994d5e into wintercms:wip/1.3 May 27, 2026
2 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance PRs that fix bugs, are translation changes or make only minor changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants