diff --git a/moor/CHANGELOG.md b/moor/CHANGELOG.md index 312ca1fb..26b352b5 100644 --- a/moor/CHANGELOG.md +++ b/moor/CHANGELOG.md @@ -34,6 +34,7 @@ TODO: Properly describe these additions when they're finalized: Previously, the query `_allUsers` would generate a `watchAllUsers` method, that has been adopted to `_watchAllUsers`. The `generate_private_watch_methods` builder option, which backported this fix to older versions, has thus been removed. +- Removed `InsertStatement.insertOrReplace`. Use `insert(data, orReplace: true)` instead. ## 1.7.2 - Fixed a race condition that caused the database to be opened multiple times on slower devices. diff --git a/moor/lib/src/runtime/statements/insert.dart b/moor/lib/src/runtime/statements/insert.dart index c7d837cc..edfcb933 100644 --- a/moor/lib/src/runtime/statements/insert.dart +++ b/moor/lib/src/runtime/statements/insert.dart @@ -4,8 +4,6 @@ import 'package:meta/meta.dart'; import 'package:moor/moor.dart'; import 'package:moor/src/runtime/components/component.dart'; -import 'update.dart'; - class InsertStatement { @protected final QueryEngine database; @@ -72,19 +70,6 @@ class InsertStatement { database.markTablesUpdated({table}); } - /// Updates the row with the same primary key in the database or creates one - /// if it doesn't exist. - /// - /// Behaves similar to [UpdateStatement.replace], meaning that all fields from - /// [entity] will be written to override rows with the same primary key, which - /// includes setting columns with null values back to null. - /// - /// However, if no such row exists, a new row will be written instead. - @Deprecated('Use insert with orReplace: true instead') - Future insertOrReplace(Insertable entity) async { - return await insert(entity, orReplace: true); - } - GenerationContext _createContext(Insertable entry, bool replace) { final map = table.entityToSql(entry.createCompanion(true)) ..removeWhere((_, value) => value == null);