Reputation: 415
I'm not able to drop a property from a class. The error says that the property can not be found in class. But the property is there for sure.
I've tried to drop the property with command 'DROP PROPERTY VResearchInstitution.turnover' and also from OrientDB studio.
I want to drop the property from that class and add it back with other Data Type, from STRING to EMBEDDEDLIST. I know there should be a way to ALTER property and modify the type, but I'm not able to do that too, that's why I'm trying to delete it and add it back.
Upvotes: 0
Views: 168
Reputation: 21160
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:
DROP PROPERTY EXAMPLE.name
would give an error, so make sure that your query doesn't contain any typo's./* 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.
Upvotes: 0
Reputation: 415
I noticed that only Node/Vertex with SuperClass seted has this behaviour. If someone has a better answer please let me know.
Upvotes: 0