From d72a70557487caf5162a8019afd007bd49bc2a08 Mon Sep 17 00:00:00 2001 From: Parsa Nazer Date: Mon, 27 Jan 2025 21:37:41 +0330 Subject: [PATCH] update migrations file --- backend/account/migrations/0001_initial.py | 26 +++++++++++------ .../0002_rename_phone_number_user_phone.py | 18 ------------ .../migrations/0003_alter_user_email.py | 18 ------------ .../migrations/0004_alter_user_email.py | 18 ------------ ...ser_groups_remove_user_user_permissions.py | 21 -------------- .../migrations/0006_useraddressmodel.py | 26 ----------------- ...otp_user_otp_hash_alter_user_otp_expiry.py | 27 ------------------ ...ter_user_otp_expiry_alter_user_otp_hash.py | 23 --------------- .../0009_alter_useraddressmodel_user.py | 20 ------------- backend/chat/migrations/0001_initial.py | 2 +- backend/home/migrations/0001_initial.py | 12 ++++---- backend/order/migrations/0001_initial.py | 4 +-- backend/product/migrations/0001_initial.py | 25 ++++++++++------- ...del_image1_productmodel_image2_and_more.py | 28 ------------------- .../migrations/0003_productmodel_video.py | 18 ------------ ...productmodel_show_subcategorymodel_show.py | 23 --------------- backend/ticket/migrations/0001_initial.py | 2 +- docker-compose.yml | 2 +- 18 files changed, 44 insertions(+), 269 deletions(-) delete mode 100644 backend/account/migrations/0002_rename_phone_number_user_phone.py delete mode 100644 backend/account/migrations/0003_alter_user_email.py delete mode 100644 backend/account/migrations/0004_alter_user_email.py delete mode 100644 backend/account/migrations/0005_remove_user_groups_remove_user_user_permissions.py delete mode 100644 backend/account/migrations/0006_useraddressmodel.py delete mode 100644 backend/account/migrations/0007_remove_user_otp_user_otp_hash_alter_user_otp_expiry.py delete mode 100644 backend/account/migrations/0008_alter_user_otp_expiry_alter_user_otp_hash.py delete mode 100644 backend/account/migrations/0009_alter_useraddressmodel_user.py delete mode 100644 backend/product/migrations/0002_rename_image_productmodel_image1_productmodel_image2_and_more.py delete mode 100644 backend/product/migrations/0003_productmodel_video.py delete mode 100644 backend/product/migrations/0004_productmodel_show_subcategorymodel_show.py diff --git a/backend/account/migrations/0001_initial.py b/backend/account/migrations/0001_initial.py index b0233a5..98da48a 100644 --- a/backend/account/migrations/0001_initial.py +++ b/backend/account/migrations/0001_initial.py @@ -1,5 +1,7 @@ -# Generated by Django 5.1.2 on 2024-12-13 17:49 +# Generated by Django 5.1.2 on 2025-01-27 18:07 +import django.db.models.deletion +from django.conf import settings from django.db import migrations, models @@ -8,7 +10,6 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('auth', '0012_alter_user_first_name_max_length'), ] operations = [ @@ -19,21 +20,30 @@ class Migration(migrations.Migration): ('password', models.CharField(max_length=128, verbose_name='password')), ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), - ('email', models.EmailField(max_length=255, unique=True, verbose_name='ایمیل')), - ('phone_number', models.CharField(max_length=12, unique=True, verbose_name='شماره تماس')), + ('email', models.EmailField(blank=True, max_length=255, null=True, verbose_name='ایمیل')), + ('phone', models.CharField(max_length=12, unique=True, verbose_name='شماره تماس')), ('first_name', models.CharField(blank=True, max_length=50, verbose_name='نام')), ('last_name', models.CharField(blank=True, max_length=50, verbose_name='نام خانوادگی')), ('profile_photo', models.ImageField(blank=True, null=True, upload_to='profile_photos/', verbose_name='عکس پروفایل')), ('is_active', models.BooleanField(default=True)), ('is_staff', models.BooleanField(default=False)), ('date_joined', models.DateTimeField(auto_now_add=True, verbose_name='تاریخ ثبتنام')), - ('otp', models.CharField(blank=True, max_length=6, null=True, verbose_name='تاریخ ثبتنام')), - ('otp_expiry', models.DateTimeField(blank=True, null=True, verbose_name='تاریخ تمام شدن otp')), - ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), - ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), + ('otp_hash', models.CharField(blank=True, max_length=64, null=True, verbose_name='کد یک بار مصرف')), + ('otp_expiry', models.DateTimeField(blank=True, null=True, verbose_name='تاریخ تمام شدن کد یک بار مصرف')), ], options={ 'abstract': False, }, ), + migrations.CreateModel( + name='UserAddressModel', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=30)), + ('address', models.TextField()), + ('postal_code', models.CharField(max_length=10)), + ('phone', models.CharField(max_length=11)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='address', to=settings.AUTH_USER_MODEL)), + ], + ), ] diff --git a/backend/account/migrations/0002_rename_phone_number_user_phone.py b/backend/account/migrations/0002_rename_phone_number_user_phone.py deleted file mode 100644 index 255cde3..0000000 --- a/backend/account/migrations/0002_rename_phone_number_user_phone.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-13 17:51 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='user', - old_name='phone_number', - new_name='phone', - ), - ] diff --git a/backend/account/migrations/0003_alter_user_email.py b/backend/account/migrations/0003_alter_user_email.py deleted file mode 100644 index 5d87dc6..0000000 --- a/backend/account/migrations/0003_alter_user_email.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-13 17:56 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0002_rename_phone_number_user_phone'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(max_length=255, verbose_name='ایمیل'), - ), - ] diff --git a/backend/account/migrations/0004_alter_user_email.py b/backend/account/migrations/0004_alter_user_email.py deleted file mode 100644 index 1e9c8f3..0000000 --- a/backend/account/migrations/0004_alter_user_email.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-13 19:08 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0003_alter_user_email'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=255, null=True, verbose_name='ایمیل'), - ), - ] diff --git a/backend/account/migrations/0005_remove_user_groups_remove_user_user_permissions.py b/backend/account/migrations/0005_remove_user_groups_remove_user_user_permissions.py deleted file mode 100644 index 324cd14..0000000 --- a/backend/account/migrations/0005_remove_user_groups_remove_user_user_permissions.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-13 19:13 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0004_alter_user_email'), - ] - - operations = [ - migrations.RemoveField( - model_name='user', - name='groups', - ), - migrations.RemoveField( - model_name='user', - name='user_permissions', - ), - ] diff --git a/backend/account/migrations/0006_useraddressmodel.py b/backend/account/migrations/0006_useraddressmodel.py deleted file mode 100644 index c7bbf1d..0000000 --- a/backend/account/migrations/0006_useraddressmodel.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-14 10:38 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0005_remove_user_groups_remove_user_user_permissions'), - ] - - operations = [ - migrations.CreateModel( - name='UserAddressModel', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=30)), - ('address', models.TextField()), - ('postal_code', models.CharField(max_length=10)), - ('phone', models.CharField(max_length=11)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/backend/account/migrations/0007_remove_user_otp_user_otp_hash_alter_user_otp_expiry.py b/backend/account/migrations/0007_remove_user_otp_user_otp_hash_alter_user_otp_expiry.py deleted file mode 100644 index 5b6182a..0000000 --- a/backend/account/migrations/0007_remove_user_otp_user_otp_hash_alter_user_otp_expiry.py +++ /dev/null @@ -1,27 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-15 17:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0006_useraddressmodel'), - ] - - operations = [ - migrations.RemoveField( - model_name='user', - name='otp', - ), - migrations.AddField( - model_name='user', - name='otp_hash', - field=models.CharField(blank=True, max_length=64, null=True), - ), - migrations.AlterField( - model_name='user', - name='otp_expiry', - field=models.DateTimeField(blank=True, null=True), - ), - ] diff --git a/backend/account/migrations/0008_alter_user_otp_expiry_alter_user_otp_hash.py b/backend/account/migrations/0008_alter_user_otp_expiry_alter_user_otp_hash.py deleted file mode 100644 index a6f8696..0000000 --- a/backend/account/migrations/0008_alter_user_otp_expiry_alter_user_otp_hash.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.1.2 on 2024-12-31 17:41 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0007_remove_user_otp_user_otp_hash_alter_user_otp_expiry'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='otp_expiry', - field=models.DateTimeField(blank=True, null=True, verbose_name='تاریخ تمام شدن کد یک بار مصرف'), - ), - migrations.AlterField( - model_name='user', - name='otp_hash', - field=models.CharField(blank=True, max_length=64, null=True, verbose_name='کد یک بار مصرف'), - ), - ] diff --git a/backend/account/migrations/0009_alter_useraddressmodel_user.py b/backend/account/migrations/0009_alter_useraddressmodel_user.py deleted file mode 100644 index b7ca85a..0000000 --- a/backend/account/migrations/0009_alter_useraddressmodel_user.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 5.1.2 on 2025-01-11 18:05 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('account', '0008_alter_user_otp_expiry_alter_user_otp_hash'), - ] - - operations = [ - migrations.AlterField( - model_name='useraddressmodel', - name='user', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='address', to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/backend/chat/migrations/0001_initial.py b/backend/chat/migrations/0001_initial.py index 55a8691..40f2f7c 100644 --- a/backend/chat/migrations/0001_initial.py +++ b/backend/chat/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-01-19 18:42 +# Generated by Django 5.1.2 on 2025-01-27 18:07 import django.db.models.deletion from django.conf import settings diff --git a/backend/home/migrations/0001_initial.py b/backend/home/migrations/0001_initial.py index 30ff6db..397620a 100644 --- a/backend/home/migrations/0001_initial.py +++ b/backend/home/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-01-27 17:20 +# Generated by Django 5.1.2 on 2025-01-27 18:07 import django.db.models.deletion from django.db import migrations, models @@ -9,7 +9,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('product', '0004_productmodel_show_subcategorymodel_show'), + ('product', '0001_initial'), ] operations = [ @@ -17,10 +17,10 @@ class Migration(migrations.Migration): name='SliderModel', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('title', models.CharField(max_length=50)), - ('image', models.ImageField(blank=True, null=True, upload_to='slider_image/')), - ('video', models.FileField(blank=True, null=True, upload_to='slider_video/')), - ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.productmodel')), + ('title', models.CharField(max_length=50, verbose_name='عنوان')), + ('image', models.ImageField(blank=True, null=True, upload_to='slider_image/', verbose_name='عکس اسلایدر')), + ('video', models.FileField(blank=True, null=True, upload_to='slider_video/', verbose_name='ویدیواسلایدر')), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.productmodel', verbose_name='محصول')), ], options={ 'verbose_name': 'اسلایدر', diff --git a/backend/order/migrations/0001_initial.py b/backend/order/migrations/0001_initial.py index d72b2d2..545e2b3 100644 --- a/backend/order/migrations/0001_initial.py +++ b/backend/order/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-01-25 23:47 +# Generated by Django 5.1.2 on 2025-01-27 18:07 import django.db.models.deletion from django.conf import settings @@ -10,7 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('account', '0009_alter_useraddressmodel_user'), + ('account', '0001_initial'), ('product', '0001_initial'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] diff --git a/backend/product/migrations/0001_initial.py b/backend/product/migrations/0001_initial.py index 7c41705..8821b93 100644 --- a/backend/product/migrations/0001_initial.py +++ b/backend/product/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2025-01-19 18:42 +# Generated by Django 5.1.2 on 2025-01-27 18:07 import django.db.models.deletion from django.conf import settings @@ -18,8 +18,8 @@ class Migration(migrations.Migration): name='DollorModel', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('price', models.FloatField(blank=True, null=True)), - ('defualt_price', models.FloatField(blank=True, default=80000.0, null=True)), + ('price', models.FloatField(blank=True, null=True, verbose_name='قیمت دلار')), + ('defualt_price', models.FloatField(blank=True, default=80000.0, null=True, verbose_name='قیمت دستی')), ('unique_filed', models.CharField(choices=[('unique', 'unique')], default='unique', max_length=20, unique=True)), ], ), @@ -42,12 +42,16 @@ class Migration(migrations.Migration): name='ProductModel', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('description', models.TextField()), - ('price', models.PositiveIntegerField(default=0, help_text='قیمت')), + ('name', models.CharField(max_length=255, verbose_name='نام')), + ('description', models.TextField(verbose_name='توضیحات')), + ('price', models.PositiveIntegerField(default=0, verbose_name='قیمت')), ('currency', models.CharField(choices=[('dollor', 'دلار'), ('toman', 'تومان'), ('derham', 'درهم')], max_length=20, verbose_name='نوع ارز')), - ('image', models.ImageField(upload_to='product_images/')), - ('rating', models.PositiveIntegerField(default=0)), + ('image1', models.ImageField(upload_to='product_images/', verbose_name='عکس اول')), + ('image2', models.ImageField(blank=True, null=True, upload_to='product_images/', verbose_name='عکس دوم')), + ('image3', models.ImageField(blank=True, null=True, upload_to='product_images/', verbose_name='عکس سوم')), + ('video', models.FileField(blank=True, null=True, upload_to='product_videos/', verbose_name='ویدیو')), + ('rating', models.PositiveIntegerField(default=0, verbose_name='امتیاز')), + ('show', models.BooleanField(default=False, verbose_name='نمایش در خانه')), ('view', models.IntegerField(default=0, verbose_name='بازدید')), ('sell', models.IntegerField(default=0, verbose_name='فروش')), ('in_stock', models.IntegerField(default=0, verbose_name='تعداد موجود')), @@ -66,7 +70,7 @@ class Migration(migrations.Migration): ('content', models.TextField(verbose_name='محتوای نظر')), ('timestamp', models.DateTimeField(auto_now_add=True, verbose_name='زمان ثبت کامنت')), ('show', models.BooleanField(default=True, verbose_name='نشان دادن کامنت')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='کاربر')), ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='product.productmodel', verbose_name='محصول')), ], options={ @@ -78,6 +82,7 @@ class Migration(migrations.Migration): name='SubCategoryModel', fields=[ ('maincategorymodel_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='product.maincategorymodel')), + ('show', models.BooleanField(default=False, verbose_name='نمایش در خانه')), ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='subcategorys', to='product.maincategorymodel', verbose_name='دسته\u200cبندی والد')), ], options={ @@ -89,6 +94,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='productmodel', name='category', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='product.subcategorymodel'), + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='product.subcategorymodel', verbose_name='دسته بندی محصول'), ), ] diff --git a/backend/product/migrations/0002_rename_image_productmodel_image1_productmodel_image2_and_more.py b/backend/product/migrations/0002_rename_image_productmodel_image1_productmodel_image2_and_more.py deleted file mode 100644 index bec08bd..0000000 --- a/backend/product/migrations/0002_rename_image_productmodel_image1_productmodel_image2_and_more.py +++ /dev/null @@ -1,28 +0,0 @@ -# Generated by Django 5.1.2 on 2025-01-26 17:12 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('product', '0001_initial'), - ] - - operations = [ - migrations.RenameField( - model_name='productmodel', - old_name='image', - new_name='image1', - ), - migrations.AddField( - model_name='productmodel', - name='image2', - field=models.ImageField(blank=True, null=True, upload_to='product_images/'), - ), - migrations.AddField( - model_name='productmodel', - name='image3', - field=models.ImageField(blank=True, null=True, upload_to='product_images/'), - ), - ] diff --git a/backend/product/migrations/0003_productmodel_video.py b/backend/product/migrations/0003_productmodel_video.py deleted file mode 100644 index 745e929..0000000 --- a/backend/product/migrations/0003_productmodel_video.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.1.2 on 2025-01-27 15:43 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('product', '0002_rename_image_productmodel_image1_productmodel_image2_and_more'), - ] - - operations = [ - migrations.AddField( - model_name='productmodel', - name='video', - field=models.FileField(blank=True, null=True, upload_to='product_videos/'), - ), - ] diff --git a/backend/product/migrations/0004_productmodel_show_subcategorymodel_show.py b/backend/product/migrations/0004_productmodel_show_subcategorymodel_show.py deleted file mode 100644 index b528a80..0000000 --- a/backend/product/migrations/0004_productmodel_show_subcategorymodel_show.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.1.2 on 2025-01-27 17:20 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('product', '0003_productmodel_video'), - ] - - operations = [ - migrations.AddField( - model_name='productmodel', - name='show', - field=models.BooleanField(default=False), - ), - migrations.AddField( - model_name='subcategorymodel', - name='show', - field=models.BooleanField(default=False), - ), - ] diff --git a/backend/ticket/migrations/0001_initial.py b/backend/ticket/migrations/0001_initial.py index b9a3ba9..1610102 100644 --- a/backend/ticket/migrations/0001_initial.py +++ b/backend/ticket/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.1.2 on 2024-12-14 10:51 +# Generated by Django 5.1.2 on 2025-01-27 18:07 import django.db.models.deletion from django.conf import settings diff --git a/docker-compose.yml b/docker-compose.yml index 61ab781..e6d7f15 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: [ "sh", "-c", - "python manage.py makemigrations --merge && python manage.py migrate && python manage.py runserver 0.0.0.0:8000", + "python manage.py migrate && python manage.py runserver 0.0.0.0:8000", ] networks: - default