I've designed my MySQL database for a multi tenant application using the "Shared database, shared schema. A tenant identifier (tenant key) associates every row with the right tenant." structure as shown in this post.
I'm using Codeigniter as my PHP framework and Ion_Auth for authentication. When selecting data for a tenant, how do I avoid having an additional "where tenant_id = user_id" clause in every select query I run on the database. Implementing groups on Ion_Auth seems to be a basic way of doing this, but that will create it's own mess.
Is there a way to do this globally?