# Generated by Django 5.2.12 on 2026-09-10 14:38 import django.db.models.deletion from django.conf import settings from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('catalog', '0002_product_is_batch_managed_product_min_sale_price_and_more'), ('core', '0001_initial'), ('partner', '0002_customerproductprice'), ('sales', '0002_salesbill_round_off_salesbillline_source_quantity_and_more'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='StorefrontAccount', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('is_deleted', models.BooleanField(default=False)), ('deleted_at', models.DateTimeField(blank=True, null=True)), ('ext_data', models.JSONField(blank=True, default=dict)), ('source_channel', models.CharField(blank=True, default='manual', max_length=32)), ('phone', models.CharField(help_text='登录手机号', max_length=32)), ('password_hash', models.CharField(max_length=128)), ('display_name', models.CharField(blank=True, default='', max_length=64)), ('is_active', models.BooleanField(default=True)), ('last_login_at', models.DateTimeField(blank=True, null=True)), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='storefront_accounts', to='partner.customer')), ('org', models.ForeignKey(blank=True, help_text='所属组织(多机构预留)', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.org')), ('tenant', models.ForeignKey(help_text='所属租户', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.tenant')), ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': '商城客户账号', 'db_table': 'storefront_account', 'ordering': ['-created_at'], 'unique_together': {('tenant', 'phone')}, }, ), migrations.CreateModel( name='StorefrontOrder', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('is_deleted', models.BooleanField(default=False)), ('deleted_at', models.DateTimeField(blank=True, null=True)), ('ext_data', models.JSONField(blank=True, default=dict)), ('source_channel', models.CharField(blank=True, default='manual', max_length=32)), ('order_no', models.CharField(max_length=64)), ('status', models.CharField(choices=[('submitted', '已提交待确认'), ('confirmed', '已确认转单'), ('rejected', '已驳回')], default='submitted', max_length=16)), ('total_amount', models.DecimalField(decimal_places=4, default=0, max_digits=18)), ('remark', models.TextField(blank=True, default='')), ('account', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='orders', to='storefront.storefrontaccount')), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='storefront_orders', to='partner.customer')), ('org', models.ForeignKey(blank=True, help_text='所属组织(多机构预留)', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.org')), ('sales_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='storefront_orders', to='sales.salesorder')), ('tenant', models.ForeignKey(help_text='所属租户', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.tenant')), ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': '商城订单', 'db_table': 'storefront_order', 'ordering': ['-created_at'], 'unique_together': {('tenant', 'order_no')}, }, ), migrations.CreateModel( name='StorefrontOrderLine', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('is_deleted', models.BooleanField(default=False)), ('deleted_at', models.DateTimeField(blank=True, null=True)), ('ext_data', models.JSONField(blank=True, default=dict)), ('source_channel', models.CharField(blank=True, default='manual', max_length=32)), ('quantity', models.DecimalField(decimal_places=4, max_digits=18)), ('unit_price', models.DecimalField(decimal_places=4, max_digits=18)), ('amount', models.DecimalField(decimal_places=4, default=0, max_digits=18)), ('source_quantity', models.DecimalField(blank=True, decimal_places=4, max_digits=18, null=True)), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='lines', to='storefront.storefrontorder')), ('org', models.ForeignKey(blank=True, help_text='所属组织(多机构预留)', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.org')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='storefront_lines', to='catalog.product')), ('source_unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='storefront_lines', to='catalog.unit')), ('tenant', models.ForeignKey(help_text='所属租户', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.tenant')), ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ], options={ 'db_table': 'storefront_order_line', 'ordering': ['id'], }, ), migrations.CreateModel( name='CustomerProductAuth', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created_at', models.DateTimeField(auto_now_add=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('is_deleted', models.BooleanField(default=False)), ('deleted_at', models.DateTimeField(blank=True, null=True)), ('ext_data', models.JSONField(blank=True, default=dict)), ('source_channel', models.CharField(blank=True, default='manual', max_length=32)), ('is_active', models.BooleanField(default=True)), ('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='product_auths', to='partner.customer')), ('org', models.ForeignKey(blank=True, help_text='所属组织(多机构预留)', null=True, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.org')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='customer_auths', to='catalog.product')), ('tenant', models.ForeignKey(help_text='所属租户', on_delete=django.db.models.deletion.PROTECT, related_name='+', to='core.tenant')), ('updated_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), ], options={ 'verbose_name_plural': '客户可见商品授权', 'db_table': 'storefront_product_auth', 'ordering': ['customer', 'product'], 'unique_together': {('tenant', 'customer', 'product')}, }, ), ]