new
This commit is contained in:
@@ -6,7 +6,7 @@ from .utils import get_current_wechat_user
|
||||
class ActivitySerializer(serializers.ModelSerializer):
|
||||
display_banner_url = serializers.ReadOnlyField()
|
||||
signup_form_config = serializers.SerializerMethodField()
|
||||
current_signups = serializers.ReadOnlyField()
|
||||
current_signups = serializers.IntegerField(read_only=True)
|
||||
has_signed_up = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
|
||||
23
backend/shop/migrations/0028_fix_goodsid_schema.py
Normal file
23
backend/shop/migrations/0028_fix_goodsid_schema.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 6.0.1 on 2026-02-12 14:26
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('shop', '0027_wechatuser_is_star_wechatuser_title'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# 1. 迁移旧数据:将 goodsid_id 的值复制到 config_id
|
||||
migrations.RunSQL(
|
||||
sql="UPDATE shop_order SET config_id = goodsid_id WHERE config_id IS NULL AND goodsid_id IS NOT NULL;",
|
||||
reverse_sql="UPDATE shop_order SET goodsid_id = config_id WHERE goodsid_id IS NULL AND config_id IS NOT NULL;"
|
||||
),
|
||||
# 2. 解除 goodsid_id 的非空限制,允许其为空(因为新代码不再写入此字段)
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE shop_order ALTER COLUMN goodsid_id DROP NOT NULL;",
|
||||
reverse_sql="ALTER TABLE shop_order ALTER COLUMN goodsid_id SET NOT NULL;"
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user