mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-04 18:25:22 +03:00
Adjust schema to be less descriptive
This commit is contained in:
parent
cd19b611f0
commit
6b277c7689
@ -33,16 +33,11 @@ class Event(Model): # type: ignore[misc]
|
|||||||
|
|
||||||
|
|
||||||
class Timeline(Model): # type: ignore[misc]
|
class Timeline(Model): # type: ignore[misc]
|
||||||
id = CharField(null=False, primary_key=True, max_length=30)
|
|
||||||
camera = CharField(index=True, max_length=20)
|
|
||||||
input_type = CharField(index=True, max_length=20) # ex: object, audio, external
|
|
||||||
detection_type = CharField(max_length=50) # ex: entered_front_yard, heard_dog_barking
|
|
||||||
timestamp = DateTimeField()
|
timestamp = DateTimeField()
|
||||||
|
camera = CharField(index=True, max_length=20)
|
||||||
# event-only fields
|
source = CharField(index=True, max_length=20) # ex: tracked object, audio, external
|
||||||
event_id = CharField()
|
class_type = CharField(max_length=50) # ex: entered_front_yard, heard_dog_barking
|
||||||
region = JSONField()
|
data = JSONField() # ex: tracked object id, region, box, etc.
|
||||||
box = JSONField()
|
|
||||||
|
|
||||||
|
|
||||||
class Recordings(Model): # type: ignore[misc]
|
class Recordings(Model): # type: ignore[misc]
|
||||||
|
|||||||
@ -37,10 +37,10 @@ SQL = pw.SQL
|
|||||||
|
|
||||||
def migrate(migrator, database, fake=False, **kwargs):
|
def migrate(migrator, database, fake=False, **kwargs):
|
||||||
migrator.sql(
|
migrator.sql(
|
||||||
'CREATE TABLE IF NOT EXISTS "timeline" ("id" VARCHAR(30) NOT NULL PRIMARY KEY, "camera" VARCHAR(20) NOT NULL, "input_type" VARCHAR(20) NOT NULL, "detection_type" VARCHAR(50) NOT NULL, "timestamp" DATETIME NOT NULL, "event_id" VARCHAR(30), "region" JSON, "box" JSON)'
|
'CREATE TABLE IF NOT EXISTS "timeline" ("timestamp" DATETIME NOT NULL, "camera" VARCHAR(20) NOT NULL, "source" VARCHAR(20) NOT NULL, "class_type" VARCHAR(50) NOT NULL, "data" JSON)'
|
||||||
)
|
)
|
||||||
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")')
|
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")')
|
||||||
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_input_type" ON "timeline" ("input_type")')
|
migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_input_type" ON "timeline" ("source")')
|
||||||
|
|
||||||
|
|
||||||
def rollback(migrator, database, fake=False, **kwargs):
|
def rollback(migrator, database, fake=False, **kwargs):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user