Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Migrations are now creating int8 fields as char in the DB and then the value gets messed up when querying #165

Open
@raphaelcruzeiro

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 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /