Schema version doesn't work

ros

#1

When we change the schema. It doesn’t behave like the doc said.


Here’s the result I got.

  1. Add new field to the table.
    Now it can sync the data of new field, I don’t need to change the schema version number.

  2. Delete the field from the existing table.
    Can not sync the data of that column from the table. But still no errors.

  3. Change the data type of that field.
    Finally I got some errors. It can not sync the column after I changed the data type of that column. Failed to transform received changeset: Schema mismatch: Property 'value' in class 'customer' is of type Double on one side and type Float on the other. This is the error message I got.

Here’s our code.

Realm.open({
          sync: {
            user: user,
            url: serverURL
          },
          deleteRealmIfMigrationNeeded: true,
          schema: schemas
        })
const Customer = require('./customer')
const Product = require('./product')

const Schemas = {}

Schemas[Customer.name] = Customer
Schemas[Product.name] = Product
module.exports = Schemas

And about deleteRealmIfMigrationNeeded this parameter seems can not work either. Anyone know how to fix this?


#2

@roytseng You do not need a schema version with Realm Sync. Migrations are automatic. See here:


#3

This is really helpful. Thanks a lot.