CMDBuild Forum

How to change a Class to a Superclass?

Hi,

i created an datamodel with superclasses and subclasses, now since its a live system. i want to create a new subclass for a normal class thats no superclass at the moment. how can i change this class to a superclass retrospectively?

 

thanks in advance

I’m sorry, at the moment this is not an available feature.
CMDBuild Team

Previously Tecnoteca wrote:

I'm sorry, at the moment this is not an available feature.
CMDBuild Team

Okay, no feature, but maybe theres a workaround?

 

i found the comment on the class db-table named "account" and changed it from

 

DESCR: Account|MODE: write|STATUS: active|SUPERCLASS: false

|TYPE: class|USERSTOPPABLE: false

to

DESCR: Account|MODE: write|STATUS: active|SUPERCLASS: true

|TYPE: class|USERSTOPPABLE: false

 

now it seems to work?! can you confirm this?

No, it is not enough.
First, a superclass can not contain data, so if you had inserted cards in that class you have to move it.
Second, CMDBuild creates a number of triggers and constraints that are different from normal classes and superclasses, so they should all be arranged by hand.
Generally we do not recommend these operations because they can create anomalous situations in the database that may affect the proper functioning of CMDBuild.
CMDBuild Team

You have to do a long way for this to work correctly.

 
1. Export the data in that class as CSV. Utility->Export CSV file.
2. Create a new Class with exact same attributes and this time mark it as Superclass
3. Create another class Subclass of the new Class, don't have to create any more attribute.
4. Import CSV file into the new Subclass.
5. Go into PSQL do a drop cascade to the original class.
 
That is all. If you have domain created to that class, and reference attribute created against that domain. you have to do the entire process including linking the relation. Not as automatic as you would like. But it worked for me.
1 Like