如何更改orientdb中的输入类型

How to change input type in orientdb

我有一个名为 "employee" 的 class,因为 class 我有一个名为 "salary" 的 属性,输入数据类型为字符串。所以,我的问题是我可以将 "salary" 的输入数据类型从字符串更改为整数吗?如果是,那么如何?

我用这段代码重现了你的问题

create class employee extends v
create property employee.salary string

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

我使用此查询更改了 属性 工资的类型

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

希望对您有所帮助

在较新版本的 OrientDB 中,您可以使用 ALTER PROPERTY Employee.salary TYPE Integer

适用于 2.1.19