Database Tenancies

From Lianjapedia
Revision as of 07:10, 12 August 2020 by Yvonne.milne (Talk | contribs)

Jump to: navigation, search

Database tenancies provide you with the ability to deploy an App once for multiple customers/tenants but have separate databases specific to each.

They are based on the authenticated user.

The database used by an App for a user in a specified tenancy is postfixed with an "_" followed by the tenancy (domain) for the user as specified in the Users workspace.

For example, if the database for an App is 'southwind' and the user's domain is 'xyzco' then the database for that user will be

southwind_xyzco

When the user authenticates in Desktop, Web or Mobile apps the specified database will be used rather than the default database for the App.

Remember to deploy the system!sysroles table and the database for the tenancy.

Note that if the specified domain contains '.' or '@' characters these are replaced with '_' characters.

e.g. with a domain of '@lianja.com' and an App that uses the southwind database, the tenancy database would be

southwind__lianja_com

A user with the default 'public' domain will use the database as specified in the App, e.g. 'southwind'.

You can copy a complete database to another using the COPY DATABASE command in the console or from the additional commands or context menu in the Data workspace.

The usertenancy() or userdomain() functions can be used in Lianja/VFP Server Pages (.rsp) and Lianja/VFP server-side procedures to determine the current user's domain.

See Also

Lianja.switchDatabase(), Runtime Database, Users and Roles, Users Workspace, USERDOMAIN(), USERTENANCY()