Skip to content

Instantly share code, notes, and snippets.

@loic
Last active December 31, 2015 09:59
Show Gist options
  • Save loic/7970692 to your computer and use it in GitHub Desktop.
Save loic/7970692 to your computer and use it in GitHub Desktop.
# encoding: utf8
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [('workflows', '0003_auto_20131212_2349')]
operations = [
migrations.AddField(
field = models.PositiveIntegerField(default=0, verbose_name=u'Errors'),
name = 'errors',
model_name = 'workflow',
),
]
$ ./manage.py migrate
Operations to perform:
Synchronize unmigrated apps: sessions, admin, messages, resolv, auth, staticfiles, contenttypes
Apply all migrations: cleaner, workflows
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Installed 0 object(s) from 0 fixture(s)
Running migrations:
Applying workflows.0004_workflow_errors...Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/Users/loic/Dev/django/django/core/management/__init__.py", line 415, in execute_from_command_line
utility.execute()
File "/Users/loic/Dev/django/django/core/management/__init__.py", line 407, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/loic/Dev/django/django/core/management/base.py", line 244, in run_from_argv
self.execute(*args, **options.__dict__)
File "/Users/loic/Dev/django/django/core/management/base.py", line 291, in execute
output = self.handle(*args, **options)
File "/Users/loic/Dev/django/django/core/management/commands/migrate.py", line 146, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/Users/loic/Dev/django/django/db/migrations/executor.py", line 60, in migrate
self.apply_migration(migration, fake=fake)
File "/Users/loic/Dev/django/django/db/migrations/executor.py", line 94, in apply_migration
migration.apply(project_state, schema_editor)
File "/Users/loic/Dev/django/django/db/migrations/migration.py", line 97, in apply
operation.database_forwards(self.app_label, schema_editor, project_state, new_state)
File "/Users/loic/Dev/django/django/db/migrations/operations/fields.py", line 30, in database_forwards
schema_editor.add_field(from_model, to_model._meta.get_field_by_name(self.name)[0])
File "/Users/loic/Dev/django/django/db/backends/sqlite3/schema.py", line 90, in add_field
self._remake_table(model, create_fields=[field])
File "/Users/loic/Dev/django/django/db/backends/sqlite3/schema.py", line 62, in _remake_table
self.quote_name(model._meta.db_table),
File "/Users/loic/Dev/django/django/db/backends/schema.py", line 95, in execute
cursor.execute(sql, params)
File "/Users/loic/Dev/django/django/db/backends/utils.py", line 77, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/Users/loic/Dev/django/django/db/backends/utils.py", line 61, in execute
return self.cursor.execute(sql, params)
File "/Users/loic/Dev/django/django/db/utils.py", line 93, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/Users/loic/Dev/django/django/db/backends/utils.py", line 61, in execute
return self.cursor.execute(sql, params)
File "/Users/loic/Dev/django/django/db/backends/sqlite3/base.py", line 489, in execute
return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: workflows_workflow__new.errors may not be NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment