migration_defaults being "rewritten" by another resource
In my system, I have 2 contexts/apis that uses the same table and have a field in common.
The first is the
As you can see, I have a
I also have another resource called
This resource also has the
The problem is that since
I'm not sure if this is by design, but it feels very odd to me since I was expecting that Ash would simply "merge" both resource configurations into the
The only workaround I found was to duplicate the
The first is the
User resource inside the Accounts api:As you can see, I have a
migration_defaults function call where I specify that an uuid need to be automatically generated for the referral_code field.I also have another resource called
Referrer which is inside my Referrals api:This resource also has the
referral_code field, but it is only a "read-only" field. the thing is that in this resource I'm not specifying the migration_defaults function call since it would be redundant as I already did that in the other resource and I would just be duplicating code and making maintenance more bothersome.The problem is that since
Referrer don't have the migration_defaults function call, when I generate the migration for both resources, Ash will simply ignore the User migration_defaults and not add any default for the users table referral_code field.I'm not sure if this is by design, but it feels very odd to me since I was expecting that Ash would simply "merge" both resource configurations into the
users table.The only workaround I found was to duplicate the
migration_defaults function call in both resources, but that kinda of eliminates the benefits of breaking a table into subsets (contexts) since in the end I need to duplicate a lot of code that shouldn't be needed in the first place.