|
| 1 | +# Generated by Django 5.2 on 2025-04-13 13:39 |
| 2 | + |
| 3 | +import django.db.models.deletion |
| 4 | +import taggit.managers |
| 5 | +from django.conf import settings |
| 6 | +from django.db import migrations, models |
| 7 | + |
| 8 | + |
| 9 | +class Migration(migrations.Migration): |
| 10 | + |
| 11 | + dependencies = [ |
| 12 | + ('api', '0004_trigram_ext'), |
| 13 | + ('taggit', '0006_rename_taggeditem_content_type_object_id_taggit_tagg_content_8fc721_idx'), |
| 14 | + ] |
| 15 | + |
| 16 | + operations = [ |
| 17 | + migrations.CreateModel( |
| 18 | + name='Order', |
| 19 | + fields=[ |
| 20 | + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 21 | + ('quantity', models.IntegerField()), |
| 22 | + ('order_date', models.DateTimeField(auto_now_add=True)), |
| 23 | + ], |
| 24 | + options={ |
| 25 | + 'verbose_name': 'Order', |
| 26 | + 'verbose_name_plural': 'Orders', |
| 27 | + 'ordering': ['-order_date'], |
| 28 | + }, |
| 29 | + ), |
| 30 | + migrations.CreateModel( |
| 31 | + name='OrderItem', |
| 32 | + fields=[ |
| 33 | + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), |
| 34 | + ('quantity', models.PositiveSmallIntegerField()), |
| 35 | + ], |
| 36 | + options={ |
| 37 | + 'verbose_name': 'Order Item', |
| 38 | + 'verbose_name_plural': 'Order Items', |
| 39 | + 'ordering': ['order'], |
| 40 | + }, |
| 41 | + ), |
| 42 | + migrations.AlterModelOptions( |
| 43 | + name='category', |
| 44 | + options={'ordering': ['name'], 'verbose_name': 'Category', 'verbose_name_plural': 'Categories'}, |
| 45 | + ), |
| 46 | + migrations.AlterModelOptions( |
| 47 | + name='product', |
| 48 | + options={'ordering': ['name'], 'verbose_name': 'Product', 'verbose_name_plural': 'Products'}, |
| 49 | + ), |
| 50 | + migrations.AlterModelOptions( |
| 51 | + name='profile', |
| 52 | + options={'ordering': ['user'], 'verbose_name': 'Profile', 'verbose_name_plural': 'Profiles'}, |
| 53 | + ), |
| 54 | + migrations.AddField( |
| 55 | + model_name='product', |
| 56 | + name='tags', |
| 57 | + field=taggit.managers.TaggableManager(help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'), |
| 58 | + ), |
| 59 | + migrations.AddIndex( |
| 60 | + model_name='category', |
| 61 | + index=models.Index(fields=['name'], name='api_categor_name_53a3ad_idx'), |
| 62 | + ), |
| 63 | + migrations.AddIndex( |
| 64 | + model_name='product', |
| 65 | + index=models.Index(fields=['slug'], name='api_product_slug_e70af7_idx'), |
| 66 | + ), |
| 67 | + migrations.AddIndex( |
| 68 | + model_name='product', |
| 69 | + index=models.Index(fields=['name'], name='api_product_name_73c704_idx'), |
| 70 | + ), |
| 71 | + migrations.AddIndex( |
| 72 | + model_name='product', |
| 73 | + index=models.Index(fields=['category'], name='api_product_categor_5c53c5_idx'), |
| 74 | + ), |
| 75 | + migrations.AddIndex( |
| 76 | + model_name='profile', |
| 77 | + index=models.Index(fields=['user'], name='api_profile_user_id_bc09a5_idx'), |
| 78 | + ), |
| 79 | + migrations.AddField( |
| 80 | + model_name='order', |
| 81 | + name='user', |
| 82 | + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), |
| 83 | + ), |
| 84 | + migrations.AddField( |
| 85 | + model_name='orderitem', |
| 86 | + name='order', |
| 87 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='api.order'), |
| 88 | + ), |
| 89 | + migrations.AddField( |
| 90 | + model_name='orderitem', |
| 91 | + name='product', |
| 92 | + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.product'), |
| 93 | + ), |
| 94 | + migrations.AddIndex( |
| 95 | + model_name='order', |
| 96 | + index=models.Index(fields=['user'], name='api_order_user_id_764746_idx'), |
| 97 | + ), |
| 98 | + migrations.AddIndex( |
| 99 | + model_name='order', |
| 100 | + index=models.Index(fields=['order_date'], name='api_order_order_d_f254aa_idx'), |
| 101 | + ), |
| 102 | + migrations.AddIndex( |
| 103 | + model_name='orderitem', |
| 104 | + index=models.Index(fields=['order'], name='api_orderit_order_i_3f9c70_idx'), |
| 105 | + ), |
| 106 | + migrations.AddIndex( |
| 107 | + model_name='orderitem', |
| 108 | + index=models.Index(fields=['product'], name='api_orderit_product_1a13b6_idx'), |
| 109 | + ), |
| 110 | + ] |
0 commit comments