Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
33degrees
· 8y ago · 0 comments
You can use postgres' row level security to do this:
https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html
Comments
[–]
keybits
8y ago
Here's an up-to-date example using Rails and Postgres row level security:
https://github.com/kuroda/multi_tenancy
[–]
config_yml
8y ago
I've used RLS and it works great for this. Make sure you have your tenant_id on all tables, which makes it easy to partition later. I think you can even do per-tenant backups/archives like this with pgdump, by using a specific user.