default the schema version to 0 when a schema is provided

This commit is contained in:
Ari Lazier 2016-10-19 09:59:20 -07:00
parent 18c419fb96
commit 5e1ecdf19e
1 changed files with 3 additions and 0 deletions

View File

@ -351,6 +351,9 @@ void RealmClass<T>::constructor(ContextType ctx, ObjectType this_object, size_t
if (!Value::is_undefined(ctx, version_value)) {
config.schema_version = Value::validated_to_number(ctx, version_value, "schemaVersion");
}
else if (schema_updated) {
config.schema_version = 0;
}
static const String migration_string = "migration";
ValueType migration_value = Object::get_property(ctx, object, migration_string);