Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Fix mysql Error
Browse files Browse the repository at this point in the history
  • Loading branch information
a76yyyy committed Aug 28, 2022
1 parent 48e2358 commit 893a048
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions db/db_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,18 @@ async def ConvertNewType(self, db=DB(), path=config.sqlite3.path):
except :
await exec_shell("ALTER TABLE `user` ADD `dingding_token` VARCHAR(1024) NOT NULL DEFAULT '' ")

try:
import aiosqlite
from sqlalchemy import update
from db import User
conn = await aiosqlite.connect(f"{config.sqlite3.path}")
conn.text_factory = bytes
cursor = await conn.execute('SELECT id, password, userkey FROM user')
for row in await cursor.fetchall():
result = await self.db._update(update(User).where(User.id == row[0]).values(password=row[1],userkey=row[2]))
except Exception as e:
raise e
if config.db_type == 'sqlite3':
try:
import aiosqlite
from sqlalchemy import update
from db import User
conn = await aiosqlite.connect(f"{config.sqlite3.path}")
conn.text_factory = bytes
cursor = await conn.execute('SELECT id, password, userkey FROM user')
for row in await cursor.fetchall():
result = await self.db._update(update(User).where(User.id == row[0]).values(password=row[1],userkey=row[2]))
except Exception as e:
raise e

try:
await self.db.user.list(limit=1, fields=('password_md5',))
Expand Down

0 comments on commit 893a048

Please sign in to comment.