-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Small(?) fixes to make PostgreSQL usable #7600
Comments
I would suggest to provide an extra pgsql tagged image, so it doesn't affect other people using the default docker images. |
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. |
I would still be interested in the proposed changes, but I understand that it's low on the priority list. |
Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know! |
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. |
This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it. |
i can confirm this issue is still relevant event in 5.1.8 this one is a fresh install, using pgsql and try to activate full multiple companies support. |
@re-rizaldywirawan I'm happy to look at a PR for this, but as mentioned, PgSQL is not officially supported in Snipe-IT. |
MySQL doesn't have a native boolean type. Just numbers. I think it's certainly possible that it's as simple as - If it's declared in the Migration as a Boolean, we need to validate as a boolean. If it's declared in the Migration as a number, we need to validate it as a number. Laravel's boolean validation is pretty loose - https://laravel.com/docs/8.x/validation#rule-boolean - so hopefully it should "just work" across both databases. So I guess I'd try to find all the places in the code where we are (I suppose incorrectly) validating a boolean database column against a 'numeric' validation. That doesn't require any terrible database migrations or anything, which would be a relief. The change would be as simple as going from There could absolutely be some really weird or wonky problems with the two slightly different interpretations of true/false - and those could be scary. But it's at least a start. |
@uberbrady Totally get it, we just have higher priorities right now. :( |
@uberbrady I also noticed a strange, inconsistent behavior. As described in my first post, when converting all boolean columns in Postgres to int2, everything actually works. I don't understand why it works for one checkbox, but not the other, as the form elements seem to be exactly identical. |
It's something we'll consider, but it's a pretty low priority - and anything you'd do would need to be tested on MySQL and MariaDB, since those are the supported database types. |
suggested in snipe#7600 (comment) improves interoperability with postgresql where the database fields are of type boolean see snipe#7600 & snipe#13615
suggested in snipe#7600 (comment) improves interoperability with postgresql where the database fields are of type boolean see snipe#7600 & snipe#13615
Please confirm you have done the following before posting your bug report:
Server (please complete the following information):
Describe the bug
Using the (inofficial) Postgres support, I have the feeling the functionality is 95% there.
The migrations are successful, which is awesome.
However, there are errors every time a boolean column needs to be read-out or updated, e.g. when I try to change the site name in
admin/branding
I get anError: Please check the form below for errors
.The debug->session->errors shows
the reason being the rules in app/Models/Setting.php
The boolean values "true" and "false" in Postgres are not numeric, so the validation fails.
Now, I don't know PHP at all and simply changing the rules above to
numeric|nullable|boolean
also didn't work.There seems to be some type incompatibility between boolean columns in MySQL and Postgres.
I have no idea how to fix this most easily and cleanly.
However, I noticed that some "boolean" flags, like
settings.auto_increment_assets
, are already represented as integer columns.The following Postgres query converts all
boolean
columns in all tables toint2
columns, preserving values (includingNULL
) and defaults (and, for consistency reasons, converts the 5 existing "boolean"integer
columns I discovered toint2
):It seems that after this, the most common functions are useable without problems.
I feel like this might be one last step missing before Postgres is usable, so although it's not officially supported, maybe it could be fixed.
I would also like to ask if it might be possible to include the package
php7.1-pgsql
in the official Dockerfile. Even though it will not be used or supported (yet), it would relieve people playing around with Postgres from building their own Docker images. I don't know what's the overhead in terms of image size for the additional driver, but I would assume it's bearable(?)The text was updated successfully, but these errors were encountered: