-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate data when seed an excluded model #188
Comments
I already solve using |
Seeds are basically your responsibility to maintain data integrity, there's no better way than what you're doing. We essentially do the same thing to make sure seeds are idempotent |
Let me show an example for sure that you understood There are two tentants + public. When I create a seed with these lines: Foo.create(name: 'bar')
Foo.create(name: 'bar2')
Foo.create(name: 'bar3') and |
That's exactly what I would expect. Since Foo is excluded, it's all working on the same (public) schema. If you run a seed, it will run it for every tenant plus public (in your case 3 times). Therefore, with your setup, I'd expect 9 entries in the Foo table. So you conditional makes sense. |
Nice :) |
**Implemented enhancements:** - Increase errors visibility by showing more information on the underlying error rather than a generic error 'Apartment::TenantNotFound' (influitive#176) - Resolved influitive#177 - Added rails 7 support (influitive#178) **Fixed bugs:** - Fixing tenant_presence_check config in the README (influitive#180) - Resolved influitive#161 and influitive#81 - Fixed sequence name (influitive#187) **Closed issues:** - Resolved influitive#151 - removed reloader and console overwrite of reload method (influitive#174)
Hi guys
When I try run a seed to create data to an excluded model, it is created N times in public schema, where N is equals to tenants count.
Anyone has suggestions?
I tried run with
bin/rake apartment:seed
, but it created N-1 times in public schema. Withbin/rake db:seed
it created N times in public schema.The text was updated successfully, but these errors were encountered: