Class and Property in OrientDB are utilized to assemble a composition with the particular credits, for example, class name, super-class, group, number of bunches, Abstract, and so forth On the off chance that you need to adjust or refresh any trait of existing classes in the construction then you need to utilize Alter Class order.
The accompanying assertion is the fundamental language structure of the Alter Class Command.
ALTER CLASS <class> <attribute-name> <attribute-value>
Following are the insights regarding the choices in the above linguistic structure.
- <class> − Defines the class name.
- <attribute-name> − Defines the quality you need to change.
- <attribute-value> − Defines the worth you need to set for the quality.
The accompanying table characterizes the rundown of qualities that help Alter Class order.
Attribute | Type | Description |
---|---|---|
NAME | String | Changes the class name. |
SHORTNAME | String | Defines a short name, (that is, an alias), for the class. Use NULL to remove a short name assignment. |
SUPERCLASS | String | Defines a super-class for the class. To add a new class, you can use the syntax +<class>, to remove it use -<class>. |
OVERSIZE | Decimal number | Defines the oversize factor. |
ADDCLUSTER | String | Adds a cluster to the class. If the cluster doesn't exist, it creates a physical cluster. Adding clusters to a class is also useful in storing records in distributed servers. |
REMOVECLUSTER | String | Removes a cluster from a class. It does not delete the cluster, only removes it from the class. |
STRICTMODE | - | Enables or disables strict mode. When in strict mode, you work in schema-full mode and cannot add new properties to a record if they are part of the class' schema definition. |
CLUSTERSELECTION | - | Defines the selection strategy in choosing which cluster it uses for new records. |
CUSTOM | - | Defines custom properties. Property names and values must follow the syntax <propertyname>=<value> without spaces between the name and value. |
ABSTRACT | Boolean | Converts class to an abstract class or the opposite. |
Example
Allow us to attempt not many models that will refresh or change the ascribes of the current class.
The accompanying inquiry is utilized to characterize a super-class 'Individual' for a current class 'Worker'.
orientdb> ALTER CLASS Employee SUPERCLASS Person
In the event that the above question is executed effectively, you will get the accompanying yield.
Class altered successfully
The accompanying question is utilized to add a super-class 'Individual' for a current class 'Representative'.
orientdb> ALTER CLASS Employee SUPERCLASS +Person
On the off chance that the above question is executed effectively, you will get the accompanying yield.
Class altered successfully