#22708: migrations doesn't migrate
-----------------------------------+--------------------------------------
     Reporter:  strelnikovdmitrij  |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Migrations         |                  Version:  1.7-beta-2
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Unreviewed
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+--------------------------------------
Changes (by timo):

 * needs_docs:   => 0
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Old description:

> what does it exactly means and how to handle it?
> all the time after adding new model this raise error
> if not raising, (on very basic models add) and new model should be
> created - its actually don't create any
>
> Django version 1.7b4
> Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
> [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
>
> Migrations for 'account':
>   0004_auto_20140527_1518.py:
>     - Create model LoginFailed
>     - Alter field ip on loginactivity
> dmitrij$ python manage.py migrate
> Operations to perform:
>   Synchronize unmigrated apps: ***
>   Apply all migrations: account, ***
> Synchronizing apps without migrations:
>   Creating tables...
>   Installing custom SQL...
>   Installing indexes...
> Running migrations:
>   Applying account.0004_auto_20140527_1518...Traceback (most recent call
> last):
>   File "manage.py", line 10, in <module>
>     execute_from_command_line(sys.argv)
>   File "/Users/dmitrij/dev/django/django/core/management/__init__.py",
> line 427, in execute_from_command_line
>     utility.execute()
>   File "/Users/dmitrij/dev/django/django/core/management/__init__.py",
> line 419, in execute
>     self.fetch_command(subcommand).run_from_argv(self.argv)
>   File "/Users/dmitrij/dev/django/django/core/management/base.py", line
> 288, in run_from_argv
>     self.execute(*args, **options.__dict__)
>   File "/Users/dmitrij/dev/django/django/core/management/base.py", line
> 337, in execute
>     output = self.handle(*args, **options)
>   File
> "/Users/dmitrij/dev/django/django/core/management/commands/migrate.py",
> line 146, in handle
>     executor.migrate(targets, plan, fake=options.get("fake", False))
>   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
> 62, in migrate
>     self.apply_migration(migration, fake=fake)
>   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
> 90, in apply_migration
>     if self.detect_soft_applied(migration):
>   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
> 134, in detect_soft_applied
>     apps = project_state.render()
>   File "/Users/dmitrij/dev/django/django/db/migrations/state.py", line
> 68, in render
>     raise InvalidBasesError("Cannot resolve bases for %r" %
> new_unrendered_models)
> django.db.migrations.state.InvalidBasesError: Cannot resolve bases for
> [<django.db.migrations.state.ModelState object at 0x102f19ad0>,
> <django.db.migrations.state.ModelState object at 0x102f19b90>,
> <django.db.migrations.state.ModelState object at 0x102f19c50>]
>
> ---0004_auto_20140527_1518.py---
>
> # -*- coding: utf-8 -*-
> from __future__ import unicode_literals
>
> from django.db import models, migrations
> import django.utils.timezone
> from django.conf import settings
>

> class Migration(migrations.Migration):
>
>     dependencies = [
>         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
>         ('account', '0003_loginactivity'),
>     ]
>
>     operations = [
>         migrations.CreateModel(
>             name='LoginFailed',
>             fields=[
>                 ('id', models.AutoField(verbose_name='ID',
> serialize=False, auto_created=True, primary_key=True)),
>                 ('user', models.ForeignKey(to_field='id', blank=True,
> to=settings.AUTH_USER_MODEL, null=True)),
>                 ('username', models.CharField(max_length=120)),
>                 ('password', models.CharField(max_length=120, null=True,
> blank=True)),
>                 ('created',
> models.DateField(default=django.utils.timezone.now)),
>                 ('ip', models.GenericIPAddressField(null=True,
> blank=True)),
>             ],
>             options={
>             },
>             bases=(models.Model,),
>         ),
>         migrations.AlterField(
>             model_name='loginactivity',
>             name='ip',
>             field=models.GenericIPAddressField(),
>         ),
>     ]

New description:

 what does it exactly means and how to handle it?
 all the time after adding new model this raise error
 if not raising, (on very basic models add) and new model should be created
 - its actually don't create any
 {{{
 Django version 1.7b4
 Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin

 Migrations for 'account':
   0004_auto_20140527_1518.py:
     - Create model LoginFailed
     - Alter field ip on loginactivity
 dmitrij$ python manage.py migrate
 Operations to perform:
   Synchronize unmigrated apps: ***
   Apply all migrations: account, ***
 Synchronizing apps without migrations:
   Creating tables...
   Installing custom SQL...
   Installing indexes...
 Running migrations:
   Applying account.0004_auto_20140527_1518...Traceback (most recent call
 last):
   File "manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/Users/dmitrij/dev/django/django/core/management/__init__.py",
 line 427, in execute_from_command_line
     utility.execute()
   File "/Users/dmitrij/dev/django/django/core/management/__init__.py",
 line 419, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/Users/dmitrij/dev/django/django/core/management/base.py", line
 288, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/Users/dmitrij/dev/django/django/core/management/base.py", line
 337, in execute
     output = self.handle(*args, **options)
   File
 "/Users/dmitrij/dev/django/django/core/management/commands/migrate.py",
 line 146, in handle
     executor.migrate(targets, plan, fake=options.get("fake", False))
   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
 62, in migrate
     self.apply_migration(migration, fake=fake)
   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
 90, in apply_migration
     if self.detect_soft_applied(migration):
   File "/Users/dmitrij/dev/django/django/db/migrations/executor.py", line
 134, in detect_soft_applied
     apps = project_state.render()
   File "/Users/dmitrij/dev/django/django/db/migrations/state.py", line 68,
 in render
     raise InvalidBasesError("Cannot resolve bases for %r" %
 new_unrendered_models)
 django.db.migrations.state.InvalidBasesError: Cannot resolve bases for
 [<django.db.migrations.state.ModelState object at 0x102f19ad0>,
 <django.db.migrations.state.ModelState object at 0x102f19b90>,
 <django.db.migrations.state.ModelState object at 0x102f19c50>]

 ---0004_auto_20140527_1518.py---

 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals

 from django.db import models, migrations
 import django.utils.timezone
 from django.conf import settings


 class Migration(migrations.Migration):

     dependencies = [
         migrations.swappable_dependency(settings.AUTH_USER_MODEL),
         ('account', '0003_loginactivity'),
     ]

     operations = [
         migrations.CreateModel(
             name='LoginFailed',
             fields=[
                 ('id', models.AutoField(verbose_name='ID',
 serialize=False, auto_created=True, primary_key=True)),
                 ('user', models.ForeignKey(to_field='id', blank=True,
 to=settings.AUTH_USER_MODEL, null=True)),
                 ('username', models.CharField(max_length=120)),
                 ('password', models.CharField(max_length=120, null=True,
 blank=True)),
                 ('created',
 models.DateField(default=django.utils.timezone.now)),
                 ('ip', models.GenericIPAddressField(null=True,
 blank=True)),
             ],
             options={
             },
             bases=(models.Model,),
         ),
         migrations.AlterField(
             model_name='loginactivity',
             name='ip',
             field=models.GenericIPAddressField(),
         ),
     ]
 }}}

--

Comment:

 Could you include the models as well? Particularly, if there are any that
 do more than just inherit from `models.Model`. I suspect the problem lies
 somewhere in there.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22708#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/075.f0b394f57c070b117c68a1d0b053c19f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to