Setting the default foreign key type in Ash!

The default foreign key type is :uuid, and you can change it with attribute_type on a relationship, eg.
belongs_to :class, MyApp.Characters.Class, attribute_type: :integer
belongs_to :class, MyApp.Characters.Class, attribute_type: :integer
But if you're working with an existing database schema that has all-integer foreign keys, for example, you can change the default in your config file:
config :ash, default_belongs_to_type: :integer
config :ash, default_belongs_to_type: :integer
Now you don't have to specify it on every single relationship! ✨
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?