简体   繁体   English

如何在OrientDB中更改输入类型

[英]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. 我有一个名为“ employee”的类,在该类中,我有一个名为“ salary”的属性,具有输入数据类型的字符串。 So, my question is can i change input data-type of "salary" from string to integer ? 所以,我的问题是我可以将“薪水”的输入数据类型从字符串更改为整数吗? and if yes then how ? 如果是,那又如何?

I used this code to reproduce your problem 我用此代码重现了您的问题

create class employee extends v
create property employee.salary string

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

在此处输入图片说明

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

在此处输入图片说明

Hope it helps 希望能帮助到你

In newer versions of OrientDB you can use ALTER PROPERTY Employee.salary TYPE Integer 在较新版本的OrientDB中,您可以使用ALTER PROPERTY Employee.salary TYPE Integer

Works for me on 2.1.19 适用于我2.1.19

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM