mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-11-23 22:07:07 +03:00
remove event retain and retain_indefinitely
Retaining an event only protected its footage during low-disk cleanup, and cleanup undid that a cycle later: it marked every event in the deleted time window as having no clip, including retained events it had kept, so the next pass deleted their footage. The UI hasn't set the flag in many versions and exports are the supported way to keep footage, so this removes the /events/{event_id}/retain endpoints, the favorites filter and the retain_indefinitely column. Storage cleanup is now a single oldest-first pass. Migration 007 now adds the column with raw SQL because add_fields put the field back on the Event model in the process that ran migrations, which broke inserts after 041 dropped it on fresh installs.
This commit is contained in:
@@ -23,17 +23,15 @@ Some examples (model - class or model name)::
|
||||
|
||||
import peewee as pw
|
||||
|
||||
from frigate.models import Event
|
||||
|
||||
SQL = pw.SQL
|
||||
|
||||
|
||||
def migrate(migrator, database, fake=False, **kwargs):
|
||||
migrator.add_fields(
|
||||
Event,
|
||||
retain_indefinitely=pw.BooleanField(default=False),
|
||||
# raw SQL keeps the dropped field off the Event model (removed in 041)
|
||||
migrator.sql(
|
||||
'ALTER TABLE "event" ADD COLUMN "retain_indefinitely" INTEGER NOT NULL DEFAULT 0'
|
||||
)
|
||||
|
||||
|
||||
def rollback(migrator, database, fake=False, **kwargs):
|
||||
migrator.remove_fields(Event, ["retain_indefinitely"])
|
||||
migrator.sql('ALTER TABLE "event" DROP COLUMN "retain_indefinitely"')
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
"""Peewee migrations -- 041_remove_retain_indefinitely.py."""
|
||||
|
||||
import peewee as pw
|
||||
|
||||
SQL = pw.SQL
|
||||
|
||||
|
||||
def migrate(migrator, database, fake=False, **kwargs):
|
||||
migrator.sql('ALTER TABLE "event" DROP COLUMN "retain_indefinitely"')
|
||||
|
||||
|
||||
def rollback(migrator, database, fake=False, **kwargs):
|
||||
migrator.sql(
|
||||
'ALTER TABLE "event" ADD COLUMN "retain_indefinitely" INTEGER NOT NULL DEFAULT 0'
|
||||
)
|
||||
Reference in New Issue
Block a user