Skip to content

Proper Folder Migration to Avoid Data Loss 正确的迁移文件夹避免数据丢失

zanllp edited this page Jul 1, 2024 · 2 revisions

Proper Folder Migration to Avoid Data Loss

IIB uses absolute file paths as unique identifiers. If folders are directly moved, IIB will clean up corresponding records from the database when it finds the files inaccessible, leading to tag loss. To avoid this issue, you can directly use the drag-and-drop or move functionality in IIB, which can automatically detect changes to files and handle these tasks accordingly, Or use the migration script provided after moving folders.

Direct Migration Using iib.db

This method is suitable for immediate migration after moving the folder. Otherwise, it's recommended to migrate from a backup of the database file.

python migrate.py --old_dir="C:\Users\zanllp\Desktop\sd-save" --new_dir="D:\sd-save" 

Migration from a Backup Database File

IIB automatically backs up database files upon startup. If you find some records have been deleted by IIB, you can opt to recover and migrate from a backup database file. Locate the desired file under the iib_db_backup folder.

python migrate.py --old_dir="C:\Users\zanllp\Desktop\sd-save" --new_dir="D:\sd-save" --db_path="iib_db_backup\iib.db_2024-04-14 06-15-26"

正确的迁移文件夹,避免数据丢失

IIB使用文件的绝对路径作为唯一标识,如果直接移动文件夹那么IIB会在发现文件无法访问时会清理掉数据库中的对应记录,这就会造成tag丢失。 为了避免这个问题。你可以直接在IIB的拖拽或者移动功能IIB能够感知到文件的变化自动处理好这些事情。或者可以在迁移文件夹后使用我们提供的迁移脚本来完成后续的迁移工作。

直接使用iib.db进行迁移

这种情况适用于在移动完文件夹后马上进行迁移,否则推荐从备份的数据库文件进行迁移。

python migrate.py --old_dir="C:\Users\zanllp\Desktop\sd-save" --new_dir="D:\sd-save" 

从备份的数据库文件进行迁移

IIB会在启动时自动备份数据库文件,因此如果你发现部分记录已经被IIB删除掉了那么你可以选择从备份的数据库文件进行恢复和迁移。你可以在iib_db_backup文件夹下面找到想要迁移的文件。

python migrate.py --old_dir="C:\Users\zanllp\Desktop\sd-save" --new_dir="D:\sd-save"  --db_path="iib_db_backup\iib.db_2024-04-14 06-15-26"