Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ranting8323
Sd Webui Infinite Image Browsing
提交
c9b6e8bb
S
Sd Webui Infinite Image Browsing
项目概览
Ranting8323
/
Sd Webui Infinite Image Browsing
9 个月 前同步成功
通知
242
Star
8
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Sd Webui Infinite Image Browsing
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c9b6e8bb
编写于
4月 14, 2024
作者:
Z
zanllp
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix
上级
2171f9e5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
5 addition
and
5 deletion
+5
-5
migrate.py
migrate.py
+5
-5
未找到文件。
migrate.py
浏览文件 @
c9b6e8bb
...
...
@@ -27,7 +27,7 @@ def replace_path(old_base, new_base):
return
replace_func
def
update_paths
(
conn
,
table_name
):
def
update_paths
(
conn
,
table_name
,
old_base
):
"""
Update paths in a specified SQLite table using a custom SQL function.
...
...
@@ -54,7 +54,7 @@ def setup_parser() -> argparse.ArgumentParser:
description
=
"Script to migrate paths in an IIB SQLite database from an old directory structure to a new one."
)
parser
.
add_argument
(
"--db_path"
,
type
=
str
,
help
=
"Path to the input IIB QLite database file to be migrated. Default value is 'iib.db'."
,
required
=
True
,
default
=
"iib.db"
"--db_path"
,
type
=
str
,
help
=
"Path to the input IIB QLite database file to be migrated. Default value is 'iib.db'."
,
default
=
"iib.db"
)
parser
.
add_argument
(
"--old_dir"
,
type
=
str
,
help
=
"Old base directory to be replaced in the paths."
,
required
=
True
...
...
@@ -76,9 +76,9 @@ if __name__ == "__main__":
DataBase
.
path
=
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
getcwd
(),
db_temp_path
))
conn
=
DataBase
.
get_conn
()
conn
.
create_function
(
"replace_path"
,
1
,
replace_path
(
old_base
,
new_base
))
update_paths
(
conn
,
"image"
)
update_paths
(
conn
,
"extra_path"
)
update_paths
(
conn
,
"folders"
)
update_paths
(
conn
,
"image"
,
old_base
)
update_paths
(
conn
,
"extra_path"
,
old_base
)
update_paths
(
conn
,
"folders"
,
old_base
)
shutil
.
copy
(
db_temp_path
,
"iib.db"
)
# os.remove(db_temp_path)
print
(
"Database migration completed successfully."
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录