diff --git a/CHANGELOG.md b/CHANGELOG.md index f8655ec9..42fd136d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ x.x.x Release notes (yyyy-MM-dd) ### Bugfixes * None +0.13.2 Release notes (2016-5-26) +============================================================= +### Breaking changes +* None + +### Enhancements +* None + +### Bugfixes +* Fix for crash when updating Realms with optional date properties to the new file format + 0.13.1 Release notes (2016-5-24) ============================================================= ### Breaking changes diff --git a/Realm.xcworkspace/contents.xcworkspacedata b/Realm.xcworkspace/contents.xcworkspacedata index 9eb61350..24dd9431 100644 --- a/Realm.xcworkspace/contents.xcworkspacedata +++ b/Realm.xcworkspace/contents.xcworkspacedata @@ -13,7 +13,4 @@ - - diff --git a/package.json b/package.json index 7fc29330..42ea8fb0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "realm", "description": "Realm is a mobile database: an alternative to SQLite and key-value stores", - "version": "0.13.1", + "version": "0.13.2", "license": "Apache-2.0", "homepage": "https://realm.io", "keywords": [ diff --git a/scripts/publish.sh b/scripts/publish.sh index 68f3fed7..1137cf9c 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -82,7 +82,7 @@ rm -rf react-native/android/build # Publish to npm, informing the prepublish script to build Android modules. echo "Publishing $VERSION to npm..." -PRERELEASE=$(grep -Eio '[a-z]+' <<< "$VERSION") +PRERELEASE=$(grep -Eio '[a-z]+' <<< "$VERSION" || true) REALM_BUILD_ANDROID=1 npm publish ${PRERELEASE:+--tag $PRERELEASE} # Only push the tag to GitHub if the publish was successful. diff --git a/src/ios/RealmJS.xcodeproj/project.pbxproj b/src/ios/RealmJS.xcodeproj/project.pbxproj index f6098eab..36318429 100644 --- a/src/ios/RealmJS.xcodeproj/project.pbxproj +++ b/src/ios/RealmJS.xcodeproj/project.pbxproj @@ -801,7 +801,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.13.1; + CURRENT_PROJECT_VERSION = 0.13.2; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -862,7 +862,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.13.1; + CURRENT_PROJECT_VERSION = 0.13.2; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -956,7 +956,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 0.13.1; + CURRENT_PROJECT_VERSION = 0.13.2; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -1023,7 +1023,7 @@ buildSettings = { DEBUG_INFORMATION_FORMAT = dwarf; DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 0.13.1; + DYLIB_CURRENT_VERSION = 0.13.2; EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1053,7 +1053,7 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 0.13.1; + DYLIB_CURRENT_VERSION = 0.13.2; EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( "REALM_PLATFORM_NODE=1", @@ -1082,7 +1082,7 @@ isa = XCBuildConfiguration; buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 0.13.1; + DYLIB_CURRENT_VERSION = 0.13.2; EXECUTABLE_PREFIX = lib; GCC_PREPROCESSOR_DEFINITIONS = ( "REALM_PLATFORM_NODE=1", diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 2767df61..a3241c1e 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -260,6 +260,9 @@ static inline void convert_outdated_datetime_columns(const SharedRealm &realm) { } for (size_t row_index = 0; row_index < table->size(); row_index++) { + if (table->is_null(property.table_column, row_index)) { + continue; + } auto milliseconds = table->get_timestamp(property.table_column, row_index).get_seconds(); table->set_timestamp(property.table_column, row_index, Timestamp(milliseconds / 1000, (milliseconds % 1000) * 1000000)); } diff --git a/tests/data/dates-v3.realm b/tests/data/dates-v3.realm index 23268dd3..3453c180 100644 Binary files a/tests/data/dates-v3.realm and b/tests/data/dates-v3.realm differ diff --git a/tests/data/dates-v5.realm b/tests/data/dates-v5.realm index af99d455..a2ea6a7a 100644 Binary files a/tests/data/dates-v5.realm and b/tests/data/dates-v5.realm differ diff --git a/tests/js/object-tests.js b/tests/js/object-tests.js index ad13da1b..cf1ca398 100644 --- a/tests/js/object-tests.js +++ b/tests/js/object-tests.js @@ -479,14 +479,20 @@ module.exports = BaseTest.extend({ // test file format upgrade var realm_v3 = new Realm({path: 'dates-v3.realm', schema: [schemas.DateObject]}); - TestCase.assertEqual(realm_v3.objects('Date').length, 1); + TestCase.assertEqual(realm_v3.objects('Date').length, 2); TestCase.assertEqual(realm_v3.objects('Date')[0].currentDate.getTime(), 1462500087955); + TestCase.assertEqual(realm_v3.objects('Date')[0].nullDate.getTime(), 1462500087955); + TestCase.assertEqual(realm_v3.objects('Date')[1].currentDate.getTime(), -10000); + TestCase.assertEqual(realm_v3.objects('Date')[1].nullDate, null); // get new file format is not upgraded var realm_v5 = new Realm({path: 'dates-v5.realm', schema: [schemas.DateObject]}); - TestCase.assertEqual(realm_v5.objects('Date').length, 1); - TestCase.assertEqual(realm_v5.objects('Date')[0].currentDate.getTime(), 1462500087955); - + TestCase.assertEqual(realm_v5.objects('Date').length, 2); + TestCase.assertEqual(realm_v3.objects('Date')[0].currentDate.getTime(), 1462500087955); + TestCase.assertEqual(realm_v3.objects('Date')[0].nullDate.getTime(), 1462500087955); + TestCase.assertEqual(realm_v3.objects('Date')[1].currentDate.getTime(), -10000); + TestCase.assertEqual(realm_v3.objects('Date')[1].nullDate, null); + // test different dates var realm = new Realm({schema: [schemas.DateObject]}); realm.write(function() { diff --git a/tests/js/realm-tests.js b/tests/js/realm-tests.js index 4ef5201d..cc0e2bfc 100644 --- a/tests/js/realm-tests.js +++ b/tests/js/realm-tests.js @@ -739,7 +739,7 @@ module.exports = BaseTest.extend({ Realm.copyBundledRealmFiles(); var realm = new Realm({path: 'dates-v5.realm', schema: [schemas.DateObject]}); - TestCase.assertEqual(realm.objects('Date').length, 1); + TestCase.assertEqual(realm.objects('Date').length, 2); TestCase.assertEqual(realm.objects('Date')[0].currentDate.getTime(), 1462500087955); var newDate = new Date(1); diff --git a/tests/js/schemas.js b/tests/js/schemas.js index 6eed754d..888ef44a 100644 --- a/tests/js/schemas.js +++ b/tests/js/schemas.js @@ -174,6 +174,7 @@ exports.NullQueryObject = { exports.DateObject = { name: 'Date', properties: { - currentDate: 'date' + currentDate: 'date', + nullDate: { type: 'date', optional: true } } };