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

Switch Status from Boolean to Enum #18

Merged
merged 3 commits into from
Dec 21, 2023

Conversation

TobiasPlaten
Copy link
Contributor

Boolean can only be true or false. For example, when using an MSSQL database, the boolean column is converted to a bit() type, which can only be 0, 1, or NULL. If 3 is entered, it is stored as 1 in the database. When reading the bit() from the database without casting in the model, the data type assumed is string, which is then "0" or "1". The constants in the model are of type integer, which is why, when using MSSQL, the Filamentmethods icons() and colors() do not return the desired result because type-safe comparison is performed here.

To solve this issue, I have created an Enum for the status and accordingly adjusted the database.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@husam-tariq husam-tariq merged commit 54c31c4 into husam-tariq:v2.0.0 Dec 21, 2023
1 check passed
@TobiasPlaten TobiasPlaten deleted the StatusToEnum branch February 25, 2024 18:35
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 this pull request may close these issues.

None yet

2 participants