mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-07 20:47:25 +01: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
@@ -176,6 +176,10 @@ func (app *BaseApp) FindCollectionReferences(collection *Collection, excludeIds
|
||||
// Note that this method will also trigger the records related
|
||||
// cascade and file delete actions.
|
||||
func (app *BaseApp) TruncateCollection(collection *Collection) error {
|
||||
if collection.IsView() {
|
||||
return errors.New("view collections cannot be truncated since they don't store their own records.")
|
||||
}
|
||||
|
||||
return app.RunInTransaction(func(txApp App) error {
|
||||
records := make([]*Record, 0, 500)
|
||||
|
||||
|
||||
Reference in new issue
Block a user