Skip to content

Commit

Permalink
Merge branch 'master' into community
Browse files Browse the repository at this point in the history
  • Loading branch information
jedelbo committed Nov 29, 2024
2 parents a320330 + 3b7f64d commit 62c9699
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* None.

### Fixed
* <How do the end-user experience this issue? what was the impact?> ([#????](https://github.com/realm/realm-core/issues/????), since v?.?.?)
* None.
* Migrating primary key to a new type without migration function would cause an assertion to fail. ([#8045](https://github.com/realm/realm-core/issues/8045), since v10.0.0)
* The events library would attempt to upload backup files created as part of file format upgrades, causing backup copies of those backups to be made, looping until the maximum file name size was reached ([#8040](https://github.com/realm/realm-core/issues/8040), since v11.17.0).

### Breaking changes
* None.
Expand Down
7 changes: 3 additions & 4 deletions dependencies.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
PACKAGE_NAME: realm-core
VERSION: 20.1.0
OPENSSL_VERSION: 3.3.1
# https://github.com/10gen/baas/commits
# 04e3f27ad0e is 2024 Sep 8th
BAAS_VERSION: 04e3f27ad0eb9154bc4e3b631d179d702ac05215
BAAS_VERSION_TYPE: githash
# Set to track a release branch on 10/9/24.
BAAS_VERSION: 670fb61d897b7d0007167843
BAAS_VERSION_TYPE: patchid
14 changes: 7 additions & 7 deletions evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,7 @@ buildvariants:
cmake_build_tool_options: "-sdk iphonesimulator -arch arm64"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
build_command_line_tools: Off
disable_tests_against_baas: On
disable_sync: On
Expand All @@ -1164,7 +1164,7 @@ buildvariants:
cmake_build_tool_options: "-sdk macosx"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
run_with_encryption: 1
tasks:
Expand Down Expand Up @@ -1193,7 +1193,7 @@ buildvariants:
cmake_build_tool_options: "-sdk macosx"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
tasks:
- name: compile_test
Expand All @@ -1210,7 +1210,7 @@ buildvariants:
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
cmake_build_type: Release
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
tasks:
- name: compile_test_and_package
Expand All @@ -1226,7 +1226,7 @@ buildvariants:
cmake_build_tool_options: "-sdk macosx"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
cmake_build_type: RelWithDebInfo
enable_asan: On
Expand All @@ -1242,7 +1242,7 @@ buildvariants:
cmake_build_tool_options: "-sdk macosx"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
cmake_build_type: RelWithDebInfo
enable_tsan: On
Expand All @@ -1258,7 +1258,7 @@ buildvariants:
cmake_build_tool_options: "-sdk macosx"
cmake_generator: Xcode
max_jobs: $(sysctl -n hw.logicalcpu)
xcode_developer_dir: /Applications/Xcode15.2.app/Contents/Developer
xcode_developer_dir: /Applications/Xcode15.3.app/Contents/Developer
extra_flags: -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_OSX_ARCHITECTURES=arm64
enable_llvm_coverage: On
coveralls_flag_name: "macos-arm64"
Expand Down
5 changes: 5 additions & 0 deletions src/realm/backup_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ BackupHandler::BackupHandler(const std::string& path, const VersionList& accepte
m_delete_versions = to_be_deleted;
}

std::string BackupHandler::get_prefix() const
{
return m_prefix;
}

bool BackupHandler::must_restore_from_backup(int current_file_format_version) const
{
if (current_file_format_version == 0)
Expand Down
2 changes: 1 addition & 1 deletion src/realm/backup_restore.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class BackupHandler {
void restore_from_backup();
void cleanup_backups();
void backup_realm_if_needed(int current_file_format_version, int target_file_format_version);
std::string get_prefix();
std::string get_prefix() const;

static std::string get_prefix_from_path(const std::string& path);
// default lists of accepted versions and backups to delete when they get old enough
Expand Down
9 changes: 6 additions & 3 deletions src/realm/object-store/object_store.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ ColKey add_column(Group& group, Table& table, Property const& property)
REALM_ASSERT(property.type != PropertyType::LinkingObjects);

if (property.is_primary) {
// Primary key columns should have been created when the table was created
// Primary key columns should have been created when the table was created.
// Unless this is a migration
if (auto col = table.get_column_key(property.name)) {
return col;
}
Expand All @@ -135,9 +136,11 @@ ColKey add_column(Group& group, Table& table, Property const& property)
else {
auto key =
table.add_column(to_core_type(property.type), property.name, is_nullable(property.type), collection_type);
if (property.requires_index())
if (property.is_primary)
table.set_primary_key_column(key); // You can end here if this is a migration
else if (property.requires_index())
table.add_search_index(key);
if (property.requires_fulltext_index())
else if (property.requires_fulltext_index())
table.add_fulltext_index(key);
return key;
}
Expand Down
25 changes: 25 additions & 0 deletions test/object-store/migrations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,6 +1137,31 @@ TEST_CASE("migration: Automatic", "[migration]") {
});
}

SECTION("change primary key from string to UUID without migration function") {
using namespace std::string_literals;
Schema schema{{"Foo",
{
{"_id", PropertyType::String, Property::IsPrimary{true}},
}}};
Schema schema2{{"Foo",
{
{"_id", PropertyType::UUID, Property::IsPrimary{true}},
}}};
InMemoryTestFile config;
config.schema_mode = SchemaMode::Automatic;
config.schema = schema;
auto realm = Realm::get_shared_realm(config);
realm->update_schema(schema2, 2);

CppContext ctx(realm);
std::any values = AnyDict{
{"_id", UUID("3b241101-0000-0000-0000-4136c566a964"s)},
};
realm->begin_transaction();
Object::create(ctx, realm, *realm->schema().find("Foo"), values);
realm->commit_transaction();
}

SECTION("object accessors inside migrations") {
using namespace std::string_literals;

Expand Down

0 comments on commit 62c9699

Please sign in to comment.