Hey, I have two servers, one in the US and one in ...
# support-questions-legacy
t
Hey, I have two servers, one in the US and one in Germany, both running Postgresql 15, the primary being in Germany. I want to store EU customers on my server in Germany, and from North America in the US. Is there a guide for this? Otherwise I'd try to replicate my users table and apply row filter rules. Would this be the correct way, or does anyone have suggestions?
r
Hey @tuyho
There isn’t a guide for that yet. But the easiest way would be to have two different cores, one per region
And then two different backends that talk to each of the cores
If that’s not possible, then you can use the method you mentioned about row level filters.
You could also wait for when we have multi tenancy in which you could make the US users one tenant and EU users another tenant. This would allow you to store their data separately, whilst running one core and one backend for both the tenants
The multi tenancy feature should be out very soon
1-2 months time
t
Thanks for the reply 👍 The multi tenancy feature would be exactly what I need right now 😄 How will you achieve this though? I am asking because I don't want to restructure my entire backend and database later on if I want to make use of the multi tenancy feature
r
Well, first you will have to create two tenants in supertokens mapped to different databases.
Then, you will need to tell supertokens about the tenant id of a user when they sign up. This can be determined based on which location they are in I guess
And then supertokens will store that user’s info in the db mapped to that tenant
t
That makes sense! Btw about the user location, can I modify the default "emailpassword" users table to include a column with the location? Or should I use meta data for this? I think I remember that there was a guide to customize the default tables, but I can't find it anymore.
r
You shouldn’t modify our table structure
t
Guess that would lead to problems with migrations
r
Why ?
t
If I change the table structure, and an update on supertokens core would try to modify the tables that could lead to migration issues, no? Or is there a different reason why I shouldn't modify the table structure?
r
Oh yea. That mainly.
t
Should I use the user metadata feature to store user locations then? Or store it in a separate table?
r
You could store it in user metadata
But why would you want to store the location info anyway?
t
Well my plan was to use it to apply a WHERE filter to assign them to the correct database. I guess I could just write them to the database directly. Is this what you meant?
r
Yea but you need to know the location before the user is created and based on that, store their data in one db vs another
So I’m not sure storing the location against the user I’d (which is after the user is created) will actually help
Either way, multi tenancy isn’t out yet now anyway. So will talk again after it’s released 🙂
t
Alright, thanks for your help! I really appreciate it