Why django migrate doesn't work even though I used make migration and it have not error

i create a new instance of Model an use makemigrations its work and this is my 0001_initial.py:

class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ProfileModel',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('avatar', models.ImageField(blank=True, default='accounts/avatars/default_avatar.jpg', upload_to='accounts/avatars/')),
                ('phone', phonenumber_field.modelfields.PhoneNumberField(blank=True, max_length=128, region=None)),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]

when i use migrate Django cannot detect and apply changes to the database. Operations to perform: Apply all migrations: my_app Running migrations: No migrations to apply.

i use python .\manage.py migrate accounts_app 0001_initial and its not work django say: No migration to Apply

and when i use python .\manage.py showmigrations accounts_app There is a cross next to my migration file name.

Вернуться на верх