1
隔離租戶的一種可能方式是將tenant_id
添加到每個表中,並將範圍與該字段的每個請求範圍。是否可以在PostgreSQL中用tenant_id限制所有查詢?
但是你必須非常小心,並把它放在每個SQL查詢中。
我想知道是否有辦法告訴PostgreSQL自動執行該操作?喜歡的東西
scope tenant_id = 'foo'
select * from my_table -- tenant_id = 'foo' should be added automatically