4 ms·
You can use postgres' row level security to do this: https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html https://www.postgresql.org/docs/9.5/ddl-rowsecurit
by 33degrees 8y ago
You can use postgres' row level security to do this: https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html https://www.postgresql.org/docs/9.5/ddl-rowsecurity.html
- config_yml 8y agoI'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.
- keybits 8y agoHere's an up-to-date example using Rails and Postgres row level security: https://github.com/kuroda/multi_tenancy https://github.com/kuroda/multi_tenancy