智能客服
你问我答,随时在线为你解决问题

























您当前正在浏览HarmonyOS开发者3.0版本配套的开发者文档,对应API能力级别为API 8 Release。此版本文档已归档不再维护,推荐您使用HarmonyOS NEXT版本。
| |---ohos.data.orm.OrmMigration 收起 自动换行 深色代码主题 复制 |
If you need to modify the database structure, for example, add a table or field, you need to create a database class, specify the new database version, and then prepare an SQL statement for upgrading or downgrading between the start and end versions specified by OrmMigration(int, int). The ORM annotation processor will identify the start and end version, and execute the specified SQL statement to complete the upgrade or downgrade.
Since:
1Constructor | Description |
|---|---|
OrmMigration(int beginVersion, int endVersion) | Constructor of this class for upgrading or downgrading from the start version to the end version. |
Modifier and Type | Method | Description |
|---|---|---|
int | Obtains the value of variable beginVersion. | |
int | Obtains the value of variable endVersion. | |
abstract void | Upgrades or downgrades the database. |
public OrmMigration(int beginVersion, int endVersion)
Constructor of this class for upgrading or downgrading from the start version to the end version.Parameters:
Parameter Name | Parameter Description |
|---|---|
beginVersion | Indicates the start version. |
endVersion | Indicates the end version. |
Since:
1
public int getBeginVersion()
Obtains the value of variable beginVersion.Returns:
Returns the value of variable beginVersion.
public int getEndVersion()
Obtains the value of variable endVersion.Returns:
Returns the value of variable endVersion.
public abstract void onMigrate(RdbStore store)
Upgrades or downgrades the database.You need to specify the SQL statement for upgrading or downgrading from the start version to the end version.
Parameters:
Parameter Name | Parameter Description |
|---|---|
store | Indicates the handle of the relational database. |
Since:
1
See Also:
智能客服
你问我答,随时在线为你解决问题
合作咨询
我们的专家服务团队将竭诚为您提供专业的合作咨询服务
解决方案
精准高效的一站式服务支持,助力开发者商业成功