mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Fix directory moves on backup migration
This commit is contained in:
parent
627adcdc95
commit
ff9abe4359
@ -183,8 +183,7 @@ class FileHelpers:
|
||||
|
||||
@staticmethod
|
||||
def move_dir(src_path, dest_path):
|
||||
FileHelpers.copy_dir(src_path, dest_path)
|
||||
FileHelpers.del_dirs(src_path)
|
||||
shutil.move(src_path, dest_path)
|
||||
|
||||
@staticmethod
|
||||
def move_dir_exist(src_path, dest_path):
|
||||
@ -193,8 +192,7 @@ class FileHelpers:
|
||||
|
||||
@staticmethod
|
||||
def move_file(src_path, dest_path):
|
||||
FileHelpers.copy_file(src_path, dest_path)
|
||||
FileHelpers.del_file(src_path)
|
||||
shutil.move(src_path, dest_path)
|
||||
|
||||
@staticmethod
|
||||
def make_archive(path_to_destination, path_to_zip, comment=""):
|
||||
|
@ -175,12 +175,10 @@ def migrate(migrator: Migrator, database, **kwargs):
|
||||
Helpers.ensure_dir_exists(
|
||||
os.path.join(server.backup_path, new_backup.backup_id)
|
||||
)
|
||||
for file in os.listdir(server.backup_path):
|
||||
if not os.path.isdir(os.path.join(os.path.join(server.backup_path, file))):
|
||||
FileHelpers.move_file(
|
||||
os.path.join(server.backup_path, file),
|
||||
os.path.join(server.backup_path, new_backup.backup_id, file),
|
||||
)
|
||||
FileHelpers.move_dir(
|
||||
os.path.join(server.backup_path),
|
||||
os.path.join(server.backup_path, new_backup.backup_id),
|
||||
)
|
||||
|
||||
Console.debug("Migrations: Dropping old backup table")
|
||||
# Drop the existing backups table
|
||||
|
Loading…
Reference in New Issue
Block a user