cancel
Showing results for 
Search instead for 
Did you mean: 

It's possible to create a separate schema/database for each tenant?

calin_chiper
Champ on-the-rise
Champ on-the-rise

I want to create a separate db/schema using the TenantAdminService. In the Alfresco SDK I've created a tenant using a four argument method createMethod executed as a init method:

this.tenantAdminService.createTenant(
        "aaa.com", // username
        "aaa.com".toCharArray(), // password
        "D:\\alfresco-solution\\alfresco-dev\\tenants\\aaa.com", // content store
        "jdbc:postgresql://localhost:5432/alfresco_aaa" ); // Tenant DB URL (initial empty db)

It creates a new tenant with new content store but the database remains empty. It doesn't replicate/create a schema. 

Another issue is that if I execute this in a WebScript it tells me that: Tenant is disabled: aaa.com

1 ACCEPTED ANSWER

afaust
Legendary Innovator
Legendary Innovator

At the moment, yes. And I don't know of any plans to change that, given how multi-tenancy will likely be removed from the core of the product in an upcoming version.

View answer in original post

3 REPLIES 3

afaust
Legendary Innovator
Legendary Innovator

The interface TenantAdminService contains the comment

    // experimental (unsupported)
    public void createTenant(String tenantDomain, char[] adminRawPassword, String contentRoot, String dbUrl);

It is unfortunate that this experimental API has been exposed in a public release. Within the implementation it is stated that the operation expects the schema to be already bootstrapped in the referenced dabase - it will not bootstrap the tables itself. Also, even if the DB were bootstrapped, it would not be used at runtime since the active JDBC data source is not using the DB URL stored for the tenant when creating the actual DB connections.

So  actually it doesn't do anything special. It just reference a db and that's all?

afaust
Legendary Innovator
Legendary Innovator

At the moment, yes. And I don't know of any plans to change that, given how multi-tenancy will likely be removed from the core of the product in an upcoming version.