mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-12 01:07:27 +02:00
added explicit errors when trying to truncate view collections or deleting view records
This commit is contained in:
1 parent
2c2246ecb9
commit
c09cd8364a
7 files changed
+61
-4
No files matched your search
@@ -169,6 +169,10 @@ func collectionTruncate(e *core.RequestEvent) error {
|
||||
return e.NotFoundError("", err)
|
||||
}
|
||||
|
||||
if collection.IsView() {
|
||||
return e.BadRequestError("View collections cannot be truncated since they don't store their own records.", nil)
|
||||
}
|
||||
|
||||
err = e.App.TruncateCollection(collection)
|
||||
if err != nil {
|
||||
return e.BadRequestError("Failed to truncate collection (most likely due to required cascade delete record references).", err)
|
||||
|
||||
Reference in new issue
Block a user