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

cancel
Showing results for 
Search instead for 
Did you mean: 
calin_chiper
Active Member

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

Jump to solution

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 Solution

Accepted Solutions
afaust
Master

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

Jump to solution

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 solution in original post

3 Replies
afaust
Master

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

Jump to solution

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.

calin_chiper
Active Member

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

Jump to solution

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

afaust
Master

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

Jump to solution

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.