OrientDB Manual 1.7.8

SQL - ALTER PROPERTY

The Alter Property command alters a class's property in the schema.

Syntax

ALTER PROPERTY <class>.<property> <attribute-name> <attribute-value>

Where:

  • class is the class owner of the property to change
  • property is the property name to change
  • attribute-name, is the attribute name to alter
  • attribute-value, is the new attribute value to set

Supported attribute names are:

  • LINKEDCLASS, the linked class name. Accepts a string as value. NULL to remove it
  • LINKEDTYPE, the linked type name between those supported:Types. Accepts a string as value. NULL to remove it
  • MIN, the minimum value as constraint. Accepts strings, numbers or dates as value. NULL to remove it
  • MANDATORY, true if the property is mandatory. Accepts "true" or "false"
  • MAX, the maximum value as constraint. Accepts strings, numbers or dates as value. NULL to remove it
  • NAME, the property name. Accepts a string as value
  • NOTNULL, the property can't be null. Accepts "true" or "false"
  • REGEXP the regular expression as constraint. Accepts a string as value. NULL to remove it
  • TYPE, the type between those supported:Types Accepts a string as value.
  • CUSTOM Set custom properties. Syntax is <name> = <value>. Example: stereotype = icon

Examples

Change the name of the property 'age' in class 'Account' in 'born'

ALTER PROPERTY Account.age NAME born

Set a property as mandatory

ALTER PROPERTY Account.age MANDATORY true

Set a regexp

ALTER PROPERTY Account.gender REGEXP [M|F]

Set a custom field on property

alter property Foo.bar1 custom stereotype = visible

To create a property use the Create Property command, to remove a property use the Drop Property command.

To know more about other SQL commands look at SQL commands.

This is a command of the Orient console. To know all the commands go to Console-Commands.