diff --git a/src/object-store/results.cpp b/src/object-store/results.cpp index e8d4bfd2..437cfff7 100644 --- a/src/object-store/results.cpp +++ b/src/object-store/results.cpp @@ -324,9 +324,9 @@ Results Results::filter(Query&& q) const } Results::UnsupportedColumnTypeException::UnsupportedColumnTypeException(size_t column, const Table* table) -: column_index(column) +: std::runtime_error((std::string)"Operation not supported on '" + table->get_column_name(column).data() + "' columns") +, column_index(column) , column_name(table->get_column_name(column)) , column_type(table->get_column_type(column)) -, std::runtime_error((std::string)"Operation not supported on '" + table->get_column_name(column).data() + "' columns") { } diff --git a/src/object-store/shared_realm.cpp b/src/object-store/shared_realm.cpp index 7c48bf55..fd85e8f9 100644 --- a/src/object-store/shared_realm.cpp +++ b/src/object-store/shared_realm.cpp @@ -212,6 +212,9 @@ bool Realm::update_schema(std::unique_ptr schema, uint64_t version) old_config.read_only = true; old_config.schema = std::move(old_schema); + m_config.schema = std::move(schema); + m_config.schema_version = version; + auto migration_function = [&](Group*, Schema&) { SharedRealm old_realm(new Realm(old_config)); auto updated_realm = shared_from_this(); @@ -224,9 +227,8 @@ bool Realm::update_schema(std::unique_ptr schema, uint64_t version) // update and migrate begin_transaction(); bool changed = ObjectStore::update_realm_with_schema(read_group(), *old_config.schema, - version, const_cast(*schema), migration_function); - m_config.schema = std::move(schema); - m_config.schema_version = version; + version, *m_config.schema, + migration_function); commit_transaction(); return changed; }