mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Make a backup DB before doing migrations (#11048)
This commit is contained in:
parent
57800d3843
commit
baf363fcb0
@ -249,6 +249,14 @@ class FrigateApp:
|
|||||||
# Run migrations
|
# Run migrations
|
||||||
del logging.getLogger("peewee_migrate").handlers[:]
|
del logging.getLogger("peewee_migrate").handlers[:]
|
||||||
router = Router(migrate_db)
|
router = Router(migrate_db)
|
||||||
|
|
||||||
|
if len(router.diff) > 0:
|
||||||
|
logger.info("Making backup of DB before migrations...")
|
||||||
|
shutil.copyfile(
|
||||||
|
self.config.database.path,
|
||||||
|
self.config.database.path.replace("frigate.db", "backup.db"),
|
||||||
|
)
|
||||||
|
|
||||||
router.run()
|
router.run()
|
||||||
|
|
||||||
# this is a temporary check to clean up user DB from beta
|
# this is a temporary check to clean up user DB from beta
|
||||||
|
Loading…
Reference in New Issue
Block a user