🧱 Update the 'user_qq' field in the database to 'user_id'

This commit is contained in:
yajiwa
2023-04-14 11:45:45 +08:00
parent 08c7aae6b7
commit 04c516f783
9 changed files with 201 additions and 152 deletions
+11 -2
View File
@@ -9,9 +9,9 @@ class UserShopGoldLog(Model):
id = fields.IntField(pk=True, generated=True, auto_increment=True)
"""自增id"""
user_qq = fields.BigIntField()
user_id = fields.CharField(255)
"""用户id"""
group_id = fields.BigIntField()
group_id = fields.CharField(255)
"""群聊id"""
type = fields.IntField()
"""金币使用类型 0: 购买, 1: 使用, 2: 插件"""
@@ -27,3 +27,12 @@ class UserShopGoldLog(Model):
class Meta:
table = "user_shop_gold_log"
table_description = "金币使用日志表"
@classmethod
def _run_script(cls):
return [
"ALTER TABLE user_shop_gold_log RENAME COLUMN user_qq TO user_id;", # 将user_qq改为user_id
"ALTER TABLE user_shop_gold_log ALTER COLUMN user_id TYPE character varying(255);",
# 将user_id字段类型改为character varying(255)
"ALTER TABLE user_shop_gold_log ALTER COLUMN group_id TYPE character varying(255);",
]