diff --git a/drift/lib/src/runtime/api/batch.dart b/drift/lib/src/runtime/api/batch.dart index aca5c331..b403c8e3 100644 --- a/drift/lib/src/runtime/api/batch.dart +++ b/drift/lib/src/runtime/api/batch.dart @@ -147,8 +147,11 @@ class Batch { /// /// See also: /// - [DatabaseConnectionUser.delete] - void deleteAll(TableInfo table) => - deleteWhere(table, (tbl) => const Constant(true)); + void deleteAll(TableInfo table) { + _addUpdate(table, UpdateKind.delete); + final stmt = DeleteStatement(_user, table); + _addContext(stmt.constructQuery()); + } /// Executes the custom [sql] statement with variables instantiated to [args]. /// diff --git a/drift/test/database/batch_test.dart b/drift/test/database/batch_test.dart index dadb344b..5d53468a 100644 --- a/drift/test/database/batch_test.dart +++ b/drift/test/database/batch_test.dart @@ -59,7 +59,7 @@ void main() { 'UPDATE "users" SET "name" = ? WHERE "name" = ?;', 'UPDATE "categories" SET "desc" = ?, "priority" = 0 WHERE "id" = ?;', 'DELETE FROM "categories" WHERE "id" = ?;', - 'DELETE FROM "categories" WHERE 1;', + 'DELETE FROM "categories";', 'DELETE FROM "todos" WHERE "id" = ?;', 'some custom statement', ],