To be more clear:
Update SQL is generating SQL in this order:
Create tables
Foreign Keys
UniqueConstraints and indexes
I Just moved ForeignKeys block to the end and it works perfect. Why this is not the default behaviour?