new
This commit is contained in:
23
backend/shop/migrations/0029_fix_legacy_fields.py
Normal file
23
backend/shop/migrations/0029_fix_legacy_fields.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# Generated by Django 6.0.1 on 2026-02-12 14:33
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('shop', '0028_fix_goodsid_schema'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# 1. 将 product_name 字段改为可为空
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE shop_order ALTER COLUMN product_name DROP NOT NULL;",
|
||||
reverse_sql="ALTER TABLE shop_order ALTER COLUMN product_name SET NOT NULL;"
|
||||
),
|
||||
# 2. 将 unit_price 字段改为可为空
|
||||
migrations.RunSQL(
|
||||
sql="ALTER TABLE shop_order ALTER COLUMN unit_price DROP NOT NULL;",
|
||||
reverse_sql="ALTER TABLE shop_order ALTER COLUMN unit_price SET NOT NULL;"
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user