Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLiteAdapter::getPhinxType does not recognize types with whitespace in definition, e.g. DECIMAL(10, 5) #2319

Closed
InvisibleSmiley opened this issue Nov 15, 2024 · 1 comment · Fixed by #2329

Comments

@InvisibleSmiley
Copy link
Contributor

InvisibleSmiley commented Nov 15, 2024

Recognized: DECIMAL(10,5)
Rejected: DECIMAL(10, 5)

This is unfortunate since e.g. PhpStorm autoformatting inserts the space in a file where the SQL Dialect is set to SQLite. If a database is initialized with such a file, Phinx then struggles to apply migrations on top of that.

The fix should be simple: Allow optional spaces/whitespace in the regex contained in getPhinxType.

@InvisibleSmiley
Copy link
Contributor Author

That said, it's not clean to just assume that getPhinxType returns a string for key "name" and then pass that to parseDefaultValue in getColumns. This leads to a type error when "name" is a Literal. Instead, a meaningful exception should be thrown in that case that mentions the table name, column name, and given type (string). But that's another issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant