You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing some code on my local machine using a project that is actually deployed to production and works fine there when I noticed that querying one of my models which had int8 fields (all of which have values that can vary between 0 and 7) the resulting Swift object had wildly incorrect values like 49, 50, 51, etc. As querying using my sql client returned me the correct values, it took me a while to notice that the same migration that had created the fields as int4 in production a few months ago was now creating these fields as char. So my local database had the "correct" char as in '1' but whatever the postgres driver is doing when quering it, it was effectivelly messing up the conversion back to int in Swift ('1' became 49, etc).
Version
2.1.0
Steps to reproduce:
Create a model with an Int8 field and map it to an int8 field on the migration.
Run the migration (Field is created as char on the DB)
Instantiate a new object of that model and set the field to 1
Save it
Fetch the same object with a query. Field will now be set to 49
The text was updated successfully, but these errors were encountered:
I was testing some code on my local machine using a project that is actually deployed to production and works fine there when I noticed that querying one of my models which had
int8
fields (all of which have values that can vary between 0 and 7) the resulting Swift object had wildly incorrect values like 49, 50, 51, etc. As querying using my sql client returned me the correct values, it took me a while to notice that the same migration that had created the fields asint4
in production a few months ago was now creating these fields aschar
. So my local database had the "correct" char as in'1'
but whatever the postgres driver is doing when quering it, it was effectivelly messing up the conversion back to int in Swift ('1'
became49
, etc).Version
2.1.0
Steps to reproduce:
Int8
field and map it to anint8
field on the migration.char
on the DB)1
49
The text was updated successfully, but these errors were encountered: