You are probably making a small mistake somewhere else, something like a typo.
Consider the following code, which works without errors (you can try yourself):
/* Let's create a class TEST that has V as superclass */
CREATE CLASS TEST EXTENDS V
/* Let's create a class EXAMPLE that has TEST as superclass */
CREATE CLASS EXAMPLE EXTENDS TEST
/* Let's create a property */
CREATE PROPERTY EXAMPLE.Name STRING
/* Now let's delete the property */
DROP PROPERTY EXAMPLE.Name
/* EXAMPLE.name has been deleted successfully */
/* Now let's try altering the property */
CREATE PROPERTY EXAMPLE.Name STRING
ALTER PROPERTY EXAMPLE.Name MANDATORY TRUE
/* EXAMPLE.name has been altered successfully */
This works as expected. Beware of the following things when dropping properties:
- OrientDB is case-sensitive! In the above example,
DROP PROPERTY EXAMPLE.name would give an error, so make sure that your query doesn't contain any typo's.
- Dropping properties does not delete data. Consider the following:
/* Let's add a vertex */
CREATE VERTEX EXAMPLE SET Name = 'a'
/* Now let's try deleting the property */
DROP PROPERTY EXAMPLE.Name
/* Now let's query the vertex */
SELECT FROM EXAMPLE WHERE Name = 'a'
The result will still contain the property Name = 'a' because dropping the property of a class only changes the schema of the class, but since OrientDB's classes are schema-less, your data is retained.
Hope that helps you find the bug.