2
votes

I have a class with name "employee" , in that class i have a property named "salary" with input data-type string. So, my question is can i change input data-type of "salary" from string to integer ? and if yes then how ?

2
You could use a javascript function - Alessandro Rota

2 Answers

3
votes

I used this code to reproduce your problem

create class employee extends v
create property employee.salary string

insert into employee(salary) values ("1")

enter image description here

I used this query to changed the type of property salary

create property Employee.salary2 Integer
update employee set salary2=salary
DROP PROPERTY Employee.salary
update Employee remove salary
ALTER property Employee.salary2 name salary
update Employee remove salary2

enter image description here

Hope it helps

1
votes

In newer versions of OrientDB you can use ALTER PROPERTY Employee.salary TYPE Integer

Works for me on 2.1.19