Seeding rails databases in a service oriented environment

CreerDypeteed

New Member
Bit of a thought exercise regarding seeding databases of rails apps across several services.SetupFor example, consider a super simplified example consisting of 4 services (rails apps) which communicate via client gems and each expose a basic API.\[code\]AuthService - (user_id, password)PropertyService (user_id, property_id, address)UserService (user_id, user_info)MortgageService - (property_id, mortgage_id, current_cost_of_mortgage)\[/code\]Basically a user has many properties and each has a mortgage. Simple enough.Each service also has a client with sightly restricted access as to which fields it can access. Hence it isn't very feasible as a mechanism for populating it's service (unless you disaggree?).QuestionWhen seeding this as a whole, you obviously want any user you refer to in the property service to also exist in the auth service and similarly for the other service relationships.What would be the best way of seeding these services with sample data such that they all matched up?Potential Methods Considered[*]Create hard fixtures for each service[*]Create a database dump for each service and just directly import it[*]Use Factory Girl and somehow figure out how to sync the idsFactory girl would be nicest as it would let me change the data which is seeded fairly easily and add more/less data without issue. I just can't wrap my head around how to do it...Any questions just shoot, really interested to hear if anyone is doing something like this or has tried it and how they're managing it!
 
Back
Top