|
36 | 36 | from graia.saya.builtins.broadcast import BroadcastBehaviour
|
37 | 37 | from creart.creator import AbstractCreator, CreateTargetInfo
|
38 | 38 |
|
| 39 | +from shared.orm import orm |
39 | 40 | from shared.utils.string import set_log
|
40 | 41 | from shared.models.config import GlobalConfig
|
41 | 42 | from shared.models.blacklist import GroupBlackList
|
42 | 43 | from shared.models.public_group import PublicGroup
|
43 |
| -from shared.orm import orm, Setting, UserPermission |
44 | 44 | from shared.models.types import ModuleOperationType
|
45 | 45 | from shared.utils.self_upgrade import UpdaterService
|
46 | 46 | from shared.models.group_setting import GroupSetting
|
47 | 47 | from shared.models.permission import GroupPermission
|
| 48 | +from shared.orm.tables import Setting, UserPermission |
48 | 49 |
|
49 | 50 | non_log = {
|
50 | 51 | GroupMessage,
|
@@ -278,18 +279,19 @@ def module_operation(modules: str | list[str], operation_type: ModuleOperationTy
|
278 | 279 | exceptions[c] = e
|
279 | 280 | return exceptions
|
280 | 281 |
|
281 |
| - @staticmethod |
282 |
| - def alembic(): |
| 282 | + def alembic(self): |
283 | 283 | if not (Path.cwd() / "alembic").exists():
|
284 | 284 | logger.info("未检测到alembic目录,进行初始化")
|
285 | 285 | os.system("alembic init alembic")
|
286 | 286 | with open(Path.cwd() / "resources" / "alembic_env_py_content.txt", "r") as r:
|
287 | 287 | alembic_env_py_content = r.read()
|
288 | 288 | with open(Path.cwd() / "alembic" / "env.py", "w") as w:
|
289 | 289 | w.write(alembic_env_py_content)
|
| 290 | + db_link = self.config.db_link |
| 291 | + db_link = db_link.split(":")[0].split("+")[0] + ":".join(db_link.split(":")[1:]) |
290 | 292 | logger.warning(
|
291 |
| - f"请前往更改 {Path.cwd() / 'alembic.ini'} 文件," |
292 |
| - "将其中的 sqlalchemy.url 替换为自己的数据库url(不需注明引擎)后重启机器人" |
| 293 | + f"请前往更改 {Path.cwd() / 'alembic.ini'} 文件" |
| 294 | + f"将其中的 sqlalchemy.url 替换为自己的数据库url(不需注明引擎)后重启机器人,注:可能的链接为:{db_link}" |
293 | 295 | )
|
294 | 296 | exit()
|
295 | 297 | if not (Path.cwd() / "alembic" / "versions").exists():
|
|
0 commit comments