feat: 公告按页、身份标签、拼多多订单号、派单与抢单改造
This commit is contained in:
34
config/migrations/0008_gonggao_page_key.py
Normal file
34
config/migrations/0008_gonggao_page_key.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def backfill_gonggao_page_key(apps, schema_editor):
|
||||
Gonggao = apps.get_model('config', 'Gonggao')
|
||||
for row in Gonggao.objects.filter(page_key='').only('id'):
|
||||
row.page_key = 'order_pool'
|
||||
row.save(update_fields=['page_key'])
|
||||
for row in Gonggao.objects.filter(page_key__isnull=True).only('id'):
|
||||
row.page_key = 'order_pool'
|
||||
row.save(update_fields=['page_key'])
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('config', '0007_platform_income_log'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='gonggao',
|
||||
name='page_key',
|
||||
field=models.CharField(
|
||||
db_index=True, default='order_pool', max_length=32,
|
||||
verbose_name='页面标识(order_pool/accept_order/merchant_home)',
|
||||
),
|
||||
),
|
||||
migrations.RunPython(backfill_gonggao_page_key, migrations.RunPython.noop),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='gonggao',
|
||||
unique_together={('club_id', 'page_key')},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user