-
-
Notifications
You must be signed in to change notification settings - Fork 56
Description
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
Int8field and map it to anint8field on the migration. - Run the migration (Field is created as
charon 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