vapor / fluent

Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
https://docs.vapor.codes/4.0/fluent/overview/
MIT License
1.32k stars 172 forks source link

When updating existing table foreign key not assigned #681

Closed skyweb07 closed 4 years ago

skyweb07 commented 4 years ago

Hello!

I'm trying to add a new foreign key to an optional object after the main table is created but after running the migration the field gets created but the foreign key is not set in the new object

Screenshot 2020-05-03 at 11 11 19 Screenshot 2020-05-03 at 11 14 29

This only happens when updating an existing table to add a new foreign key as when creating works perfectly. I've seen that on Fluent 3 this used to happen, maybe something to take a look at https://github.com/vapor/fluent/issues/491

tanner0101 commented 4 years ago

I believe this is related to https://github.com/vapor/fluent-kit/issues/235 and has been fixed in https://github.com/vapor/fluent-kit/pull/270.

skyweb07 commented 4 years ago

Yes, I've tested with the gm version and it's working now, thanks @tanner0101 and team!!