Does SwitchServer require databases to be identical?

Hi I’m using databaseManager.switchServer to switch databases, but am getting an " error in relation" , which I suspect is because the tables and fields are not identical even thought the fields actually used in the application are.
Relation error is because a field does not exist in one database and does in the other
Is there a command to refresh the relations after a switch database
Thanks
Mark

Hi Mark,

you shouldn’t refresh the relations, but take care of your tables being in sync between the 2 databases.
when you look at the ‘slave’ database, there’s an option to set ‘clone database from’
You should do that on your production server as well.
While importing both schema’s are being updated.

Currently in 6.0.7. this ‘clone’ function doesn’t work in developer.
Casenr SVY-3223

Thanks for the comments.
It is vital that the databases are able to be different as different users may require customised differences, and I definitely do not want to have make all the databases have everybody’s custom fields.
I also do not want to have multiple database per customer as this complicates admin unnecessarily.
For example all customers may use the common solution, but customer A will have an additional solution for special needs, such as member/customer login.
Thanks
Mark

Maybe you can do something with the solution model. For example when you switch to an database which doesn’t have some relation dynamically remove it with solution model function removeRelation. Just an idee I haven’t tried it.

Mark,

database-switchserver is designed for identical data models.
The data model is loaded from the original db but the queries are applied on the switch-to db.
So if you have a column that is in the the original db but not in the switch-to db, the queries on it will fail.

You probably can get away with tables that exist in the original db but not in the switch-to db as long as they are never queried.

Rob

Hi Rob
Thanks for the confirmation. Disappointing. Maybe others have found this to be a problem.
Any idea how hard it would be to to develop code to reload the data model?
Thanks
Mark

Maybe a solution would be to use a main “template” db with all the columns of all the customers and then switch to each customer db at runtime. When a customer needs a customization, let’s say a new column you just need to add it to the main template db AND to the customer db. Probably you will also have to create some metadata structure to keep track of which customizations are available per customer.
If you follow this path make sure NOT to mark the customer db’s as clone of the main db otherwise servoy would create the new columns in all dbs.