mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 06:12:53 +08:00
🐛 : fix uuid
This commit is contained in:
parent
487f019c89
commit
c75b0950bd
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import uuid
|
||||
|
||||
from nonebot import require
|
||||
from nonebot.drivers import Driver
|
||||
@ -57,6 +58,10 @@ from public.bag_users t1
|
||||
@driver.on_startup
|
||||
async def _():
|
||||
global flag
|
||||
if goods_list := await GoodsInfo.filter(uuid__isnull=True).all():
|
||||
for goods in goods_list:
|
||||
goods.uuid = uuid.uuid1() # type: ignore
|
||||
await GoodsInfo.bulk_update(goods_list, ["uuid"], 10)
|
||||
await shop_register.load_register()
|
||||
if (
|
||||
flag
|
||||
|
||||
@ -153,10 +153,6 @@ class GoodsInfo(Model):
|
||||
|
||||
@classmethod
|
||||
async def _run_script(cls):
|
||||
if goods_list := await cls.filter(uuid__isnull=True).all():
|
||||
for goods in goods_list:
|
||||
goods.uuid = uuid.uuid1()
|
||||
await cls.bulk_update(goods_list, ["uuid"], 10)
|
||||
return [
|
||||
"ALTER TABLE goods_info ADD uuid VARCHAR(255);",
|
||||
"ALTER TABLE goods_info ADD daily_limit Integer DEFAULT 0;",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user