feat(ota): support forced firmware dispatch

This commit is contained in:
stu2not
2026-09-22 14:58:53 +08:00
parent 2467656806
commit e5ba92ba13
10 changed files with 401 additions and 27 deletions
+6
View File
@@ -152,6 +152,7 @@ async def _ensure_device_ota_tables(conn) -> None:
release_status VARCHAR(32) NOT NULL DEFAULT 'draft',
release_channel VARCHAR(32) NOT NULL DEFAULT 'stable',
is_latest TINYINT(1) NOT NULL DEFAULT 0,
force_update TINYINT(1) NOT NULL DEFAULT 0,
notes TEXT NULL,
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
published_at DATETIME NULL,
@@ -163,6 +164,11 @@ async def _ensure_device_ota_tables(conn) -> None:
"""
)
)
await _ensure_columns(
conn,
table_name="device_ota_firmwares",
columns=[("force_update", "force_update TINYINT(1) NOT NULL DEFAULT 0 AFTER is_latest")],
)
await conn.execute(
text(
"""
+1
View File
@@ -169,6 +169,7 @@ class DeviceOtaFirmware(Base):
release_status = Column(String(32), nullable=False, default="draft", index=True)
release_channel = Column(String(32), nullable=False, default="stable")
is_latest = Column(Boolean, nullable=False, default=False, index=True)
force_update = Column(Boolean, nullable=False, default=False, server_default=text("0"))
notes = Column(Text, nullable=True)
created_at = Column(DateTime, nullable=False, server_default=func.now())
published_at = Column(DateTime, nullable=True)