Skip to content

Commit

Permalink
SQLiteの場合にデータベースの truncate が正常に動作しない問題を改善
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuring committed Mar 30, 2024
1 parent 95ae3b8 commit d9b76d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/baser-core/src/Service/BcDatabaseService.php
Expand Up @@ -563,7 +563,10 @@ public function truncate(string $table, string $dbConfigKeyName = 'default'): bo
}
$schema = $tableClass->getSchema();
$db = $tableClass->getConnection();
$result = (bool)$db->execute($schema->truncateSql($db)[0]);
$result = true;
foreach($schema->truncateSql($db) as $sql) {
if(!$db->execute($sql)) $result = false;
}
$tableClass->setConnection($currentConnection);
return $result;
}
Expand Down

0 comments on commit d9b76d8

Please sign in to comment.