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
|
@staticmethod
|
||||||
def move_dir(src_path, dest_path):
|
def move_dir(src_path, dest_path):
|
||||||
FileHelpers.copy_dir(src_path, dest_path)
|
shutil.move(src_path, dest_path)
|
||||||
FileHelpers.del_dirs(src_path)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def move_dir_exist(src_path, dest_path):
|
def move_dir_exist(src_path, dest_path):
|
||||||
@ -193,8 +192,7 @@ class FileHelpers:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def move_file(src_path, dest_path):
|
def move_file(src_path, dest_path):
|
||||||
FileHelpers.copy_file(src_path, dest_path)
|
shutil.move(src_path, dest_path)
|
||||||
FileHelpers.del_file(src_path)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def make_archive(path_to_destination, path_to_zip, comment=""):
|
def make_archive(path_to_destination, path_to_zip, comment=""):
|
||||||
|
@ -175,12 +175,10 @@ def migrate(migrator: Migrator, database, **kwargs):
|
|||||||
Helpers.ensure_dir_exists(
|
Helpers.ensure_dir_exists(
|
||||||
os.path.join(server.backup_path, new_backup.backup_id)
|
os.path.join(server.backup_path, new_backup.backup_id)
|
||||||
)
|
)
|
||||||
for file in os.listdir(server.backup_path):
|
FileHelpers.move_dir(
|
||||||
if not os.path.isdir(os.path.join(os.path.join(server.backup_path, file))):
|
os.path.join(server.backup_path),
|
||||||
FileHelpers.move_file(
|
os.path.join(server.backup_path, new_backup.backup_id),
|
||||||
os.path.join(server.backup_path, file),
|
)
|
||||||
os.path.join(server.backup_path, new_backup.backup_id, file),
|
|
||||||
)
|
|
||||||
|
|
||||||
Console.debug("Migrations: Dropping old backup table")
|
Console.debug("Migrations: Dropping old backup table")
|
||||||
# Drop the existing backups table
|
# Drop the existing backups table
|
||||||
|
Loading…
Reference in New Issue
Block a user