sadanand patel
sadanand patel

Reputation: 50

How to change input type in orientdb

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 ?

Upvotes: 2

Views: 332

Answers (2)

Matthias Beaupère
Matthias Beaupère

Reputation: 1827

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

Works for me on 2.1.19

Upvotes: 1

Alessandro Rota
Alessandro Rota

Reputation: 3570

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

Upvotes: 4

Related Questions