Skip to content

Migration required Error #1859

@weixuefeng

Description

@weixuefeng

What happened?

i have db model A, in new schema, add property for A. update schema from 2 -> 3.
i got error Migration required.

Migration required: Migration is required due to the following errors
Property 'ABTokenDBInfo.isSupportUtp' has been added
Property 'ABTokenDBInfo.isSupportStatistics' has been added.. Error code: realm_errno.RLM_ERR_SCHEMA_MISMATCH.. See https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/model-data/update-realm-object-schema/#manually-migrate-schema for more details

when i open helpLink, i use auto-migrate-schema, i have not migratecallback.

and i found changeLog.md

* Added a new exception - MigrationRequiredExceptionthat will be thrown when a local Realm is opened with a schema that differs from the schema on disk and no migration callback is supplied. Additionally, ahelpLinkproperty has been added toRealmException and its subclasses to provide a link to the documentation for the error. (Issue [#1448](https://github.com/realm/realm-dart/issues/1448))

so.
auto-migrate-schema is support?

how can i migrate my dbModel?

eg:

  LocalTokenRepository() {
    realmConfig = Configuration.local([
      ABTokenDBInfo.schema,
    ], schemaVersion: dbVersion);
  }
  • dbVersion from 2 -> 3.
  • ABTokenInfo add 'is_support_field'.
  • i had execute dart run realm generate

Repro steps

no

Version

20.1.1

What Atlas Services are you using?

Local Database only

What type of application is this?

Flutter Application

Client OS and version

iOS

Code snippets

No response

Stacktrace of the exception/crash you're getting

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions