Triplex - a complete solution to multi-tenancy with PG schemas

I’m curious to see an example of this approach, one part that’s not clear is how to create the function inside tenant_migrations. In order to create the id generator function, I’d need to be able to do something like:

execute """
CREATE FUNCTION #{prefix}.id_generator ......
....
tenant_id := #{TenantHelper.tenant_handler(prefix).id};
....
"""

But I can’t see how to find the prefix that’s running on a migration, any ideas?