Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
tappleby
· 6y ago · 0 comments
Are there any strategies for migrating from a separate db per tenant to shared db with scoped tenant_id? In this case each tenant would have overlapping primary keys.
Comments
[–]
pegas1
6y ago
you add the tenantId to each table and you add it to the primary key of the table too. then you just merge.
[–]
iovrthoughtthis
6y ago
“Just”. Depends on the number of tenants and how divergent they are.
I would incrementally bring tenants together into a single DB.
[–]
tappleby
OP
6y ago
There are also some limitations if using something like rails / activerecord which doesn't support composite primary keys natively