Skip to content

Add ColumnDefinitionParser - #405

Open
vjik wants to merge 7 commits into
masterfrom
improve-parse
Open

Add ColumnDefinitionParser#405
vjik wants to merge 7 commits into
masterfrom
improve-parse

Conversation

@vjik

@vjikvjik commented Nov 25, 2025

Copy link
Copy Markdown
Member
QA
Is bugfix?
New feature?
Breaks BC?✔️

Related to yiisoft/db#1108

@codecov

codecovBot commented Nov 25, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.48%. Comparing base (ce14515) to head (2ca850c).
⚠️ Report is 25 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #405 +/- ##
============================================
+ Coverage 98.45% 98.48% +0.03% - Complexity 326 328 +2 
============================================
Files 22 23 +1 Lines 1035 1058 +23 ============================================
+ Hits 1019 1042 +23 
Misses 16 16 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a ColumnDefinitionParser implementation for the SQLite database driver, which is part of refactoring to support parsing column definition strings into structured information. The parser extends AbstractColumnDefinitionParser from the yiisoft/db package and implements SQLite-specific type parameter parsing logic.

Key changes:

  • Introduces ColumnDefinitionParser class that handles parsing of column type parameters for SQLite-specific types
  • Integrates the parser into ColumnFactory via the columnDefinitionParser() method
  • Adds corresponding test coverage via ColumnDefinitionParserTest

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

FileDescription
src/Column/ColumnDefinitionParser.phpNew parser class implementing SQLite-specific column definition parsing logic with support for size/precision parameters on various data types
src/Column/ColumnFactory.phpAdds columnDefinitionParser() method that returns the new ColumnDefinitionParser instance
tests/ColumnDefinitionParserTest.phpTest class extending common test suite to verify parser functionality
CHANGELOG.mdDocuments the addition of the new ColumnDefinitionParser class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadtests/ColumnDefinitionParserTest.php
vjikand others added 2 commits November 26, 2025 00:31
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@vjik
vjik requested review from a team and samdarkNovember 25, 2025 21:36
@vjikvjik added the status:code review The pull request needs review. label Nov 25, 2025
Comment on lines +13 to +32
return match ($type) {
'bit',
'char',
'datetime',
'datetimetz',
'decimal',
'double',
'float',
'int',
'numeric',
'real',
'smallint',
'string',
'time',
'timestamp',
'timetz',
'tinyint',
'varchar' => $this->parseSizeInfo($params),
default => [],
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't think it's right to limit the number of possible types for parsing. What about integer, bigint, varbit, character, etc. Sqlite supports various type names.

@vjikvjik added status:under development Someone is working on a pull request. and removed status:code review The pull request needs review. labels Nov 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:under developmentSomeone is working on a pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vjik@samdark@Tigrov