mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-22 13:01:33 +02:00
Skip deep cleans for sqlite DBs (#289)
* Add explicit DROP TABLE directives for temp_inactive_devices and drop the TEMP qualifier for non-postgres DBs, fixes #288 * Revert "Add explicit DROP TABLE directives for temp_inactive_devices and drop the TEMP qualifier for non-postgres DBs, fixes #288" This reverts commit db6d8413a74d1fe624e431243bb0808bee8ab01f. * Skip deep cleans for sqlite DBs
This commit is contained in:
parent
a4ff05c0fa
commit
f8c414b2c9
@ -429,6 +429,10 @@ func (db *DB) GenerateAndStoreActiveUserStats(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) SelfHostedDeepClean(ctx context.Context) error {
|
func (db *DB) SelfHostedDeepClean(ctx context.Context) error {
|
||||||
|
if db.Name() == "sqlite" {
|
||||||
|
// sqlite doesn't support the `(now() - INTERVAL '90 days')` syntax used in the below queries.
|
||||||
|
return nil
|
||||||
|
}
|
||||||
return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {
|
||||||
runDeletes := os.Getenv("HISHTORY_SELF_HOSTED_DEEP_CLEAN") != ""
|
runDeletes := os.Getenv("HISHTORY_SELF_HOSTED_DEEP_CLEAN") != ""
|
||||||
r := tx.Exec(`
|
r := tx.Exec(`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user