vapor / fluent-postgres-driver

🐘 PostgreSQL driver for Fluent.
MIT License
146 stars 53 forks source link

Unable to save object with specified uuid ID #78

Closed MihaelIsaev closed 6 years ago

MihaelIsaev commented 6 years ago

When I'm trying to save model to the database with specified UUID ID it saves with another random UUID ID. It looks like a bug.

In my case I'm trying to transfer data from another database and I really need to use my old UUIDs as PRIMARY KEY ID.

After some debugging I found where the problem is, we should check if UUID ID is already specified and only in case when it isn't fluent should generate random UUID. Please take a look at this pull request https://github.com/vapor/fluent-postgresql/pull/76 If everything is ok could someone please merge it and add it to the next release? 🙏

MihaelIsaev commented 6 years ago

@tanner0101 could you please give your feedback regarding this issue? 🙏 I really really need it to be fixed somehow.

addisonwebb commented 6 years ago

@tanner0101 this is the same issue as #56. There have been several pull requests to address the issue #60 and #76. What can we do to help figure out a path forward?

patchthecode commented 6 years ago

Same issue. added self here.

patchthecode commented 6 years ago

it seems to work now when i use create(on: req) instead of save(on: req)

MihaelIsaev commented 6 years ago

@patchthecode With UUID it doesn't work with '.create' '.create' works for Int IDs.

patchthecode commented 6 years ago

@MihaelIsaev maybe something changed? Because i am currently using .create with UUID and it is working. you can find the code in DummyData on the test server.

tanner0101 commented 6 years ago

Fix was merged, thanks a ton @MihaelIsaev!