Giter Club home page Giter Club logo

Comments (7)

sync-by-unito avatar sync-by-unito commented on June 24, 2024

➤ PM Bot commented:

Jira ticket: RDART-995

from realm-dart.

nielsenko avatar nielsenko commented on June 24, 2024

Did you make Entity.id a primary key, when updating the schema?

from realm-dart.

nielsenko avatar nielsenko commented on June 24, 2024

Realm is complaining that there are multiple objects with the same id after the migration, which is now illegal since it has become a primary key.

You need to remove all duplicates. The simplest thing is probably to just delete the realm entirely, if you can afford to loose the content.

from realm-dart.

nielsenko avatar nielsenko commented on June 24, 2024

Yes, it would affect any user who updates. You should only delete the realm, if you can afford to loose the data in it.

If you have customer data you need to preserve, then you need to either drop making id unique, or remove duplicates explicitly in your migration callback to avoid the issue.

Is it by any chance so that all id values are null? If you added the id column as part of the schema change, then it needs to be populated for all existing entries as part of the migration.

from realm-dart.

nielsenko avatar nielsenko commented on June 24, 2024

Read up on: https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/model-data/update-realm-object-schema/#other-migration-tasks.

If you sort Entity from oldRealm on _id you can find the duplicates.

from realm-dart.

nielsenko avatar nielsenko commented on June 24, 2024

Migration is currently only for local realms. See https://www.mongodb.com/docs/realm/sdk/flutter/realm-database/model-data/update-realm-object-schema/#updating-the-schema-of-a-synced-realm

Embedded objects are used for aggregate types. One advantage is that you don't have to setup dedicated subscriptions for embedded objects. They always follow their parent.

from realm-dart.

nirinchev avatar nirinchev commented on June 24, 2024

Can you post the error message with the full stack trace?

from realm-dart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.