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

Added boolean type to available columnTypes for createColumn #4433

Merged
merged 4 commits into from
Jun 30, 2022

Conversation

samzzi
Copy link
Contributor

@samzzi samzzi commented Jun 26, 2022

This PR …

Adds an extra columnType for creating tables via the SQL and SQLite query builder classes. The reasons for this enhancement is to save up storage in MySQL tables.

  • In the SQL query builder it will use the TINYINT(1) as boolean field instead of the bool alias for maximum compatibility.
  • Also added in the SQLite query builder it will use the INTEGER as boolean field for columnType consistency with the SQL query builder.

Features

  • New bool column type for the Database classes

Breaking changes

No.

For review team

@bastianallgeier bastianallgeier added this to the 3.7.1 milestone Jun 26, 2022
@lukasbestle lukasbestle added the type: feature 🎉 Adds a feature (requests → feedback.getkirby.com) label Jun 27, 2022
Copy link
Member

@lukasbestle lukasbestle left a comment

Choose a reason for hiding this comment

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

I'm thinking if the name should be bool for consistency with PHP types (e.g. we also have an int column, not integer).

@samzzi
Copy link
Contributor Author

samzzi commented Jun 28, 2022

I'm thinking if the name should be bool for consistency with PHP types (e.g. we also have an int column, not integer).

Makes sense since int is used for the integer column type. I've updated the PR.

BTW, fun fact (didn't know this myself), for typecasting in PHP you can use both (bool) and (boolean) (and (int) or (integer)) 😉

src/Database/Sql.php Outdated Show resolved Hide resolved
src/Database/Sql/Sqlite.php Outdated Show resolved Hide resolved
samzzi and others added 2 commits June 28, 2022 21:49
Co-authored-by: Lukas Bestle <account-github@lukasbestle.com>
Co-authored-by: Lukas Bestle <account-github@lukasbestle.com>
@distantnative distantnative merged commit be51155 into getkirby:develop Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature 🎉 Adds a feature (requests → feedback.getkirby.com)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants