mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-04 04:23:16 +00:00
chore: update sqlite functions
This commit is contained in:
@ -2,6 +2,7 @@ package sqlite
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
@ -181,3 +182,13 @@ func (d *DB) DeleteCollection(ctx context.Context, delete *store.DeleteCollectio
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func vacuumCollection(ctx context.Context, tx *sql.Tx) error {
|
||||
stmt := `DELETE FROM collection WHERE creator_id NOT IN (SELECT id FROM user)`
|
||||
_, err := tx.ExecContext(ctx, stmt)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user