Note this is nothing to do with Django's standard auth module, but a
custom implementation, as far as I can see that should have nothing to do
with it.
This is a private project so I can't give many more details than this. I'm
using Postgres and the current 1.7 rc.
{{{
python manage.py makemigrations
Migrations for 'Auth':
0003_auto_20140721_1413.py:
- Alter field name on permission
(env)samuel || python manage.py migrate
Operations to perform:
Synchronize unmigrated apps: bootstrapform, django_jinja, admin_tools,
theming, dashboard
Apply all migrations: Schedule, admin, sessions, auth, contenttypes,
Accounts, Auth, CRM
Synchronizing apps without migrations:
Creating tables...
Installing custom SQL...
Installing indexes...
Running migrations:
Applying Auth.0003_auto_20140721_1413...Traceback (most recent call
last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/core/management/__init__.py", line 385, in
execute_from_command_line
utility.execute()
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/core/management/__init__.py", line 377, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/core/management/base.py", line 288, in run_from_argv
self.execute(*args, **options.__dict__)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/core/management/base.py", line 337, in execute
output = self.handle(*args, **options)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/core/management/commands/migrate.py", line 160, in handle
executor.migrate(targets, plan, fake=options.get("fake", False))
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/migrations/executor.py", line 62, in migrate
self.apply_migration(migration, fake=fake)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/migrations/executor.py", line 96, in apply_migration
migration.apply(project_state, schema_editor)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/migrations/migration.py", line 107, in apply
operation.database_forwards(self.app_label, schema_editor,
project_state, new_state)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/migrations/operations/fields.py", line 131, in
database_forwards
schema_editor.alter_field(from_model, from_field, to_field)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/schema.py", line 506, in alter_field
self._alter_field(model, old_field, new_field, old_type, new_type,
old_db_params, new_db_params, strict)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/schema.py", line 525, in _alter_field
"name": constraint_name,
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/schema.py", line 98, in execute
cursor.execute(sql, params)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/utils.py", line 81, in execute
return super(CursorDebugWrapper, self).execute(sql, params)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/utils.py", line 94, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/path/to/project/env/local/lib/python2.7/site-
packages/django/db/backends/utils.py", line 65, in execute
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: constraint "auth_permission_name_key" of
relation "Auth_permission" does not exist
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23065>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Comment:
Oh, i can probably say the model looked liek this,
{{{
class Permission(models.Model):
sys_name = models.CharField(_('System Name'), unique = True,
max_length = 20)
name = models.CharField(_('Name'), unique = True, max_length = 50)
def __unicode__(self):
return self.name
}}}
I wanted to remove the unique constraint from name.
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:1>
Comment (by timo):
I couldn't reproduce this (adding and removing a unique constraint. Does a
unique constraint exist in the database? Maybe it has a different name?
More details with steps to reproduce would be helpful.
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:2>
* status: new => closed
* resolution: => worksforme
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:3>
* status: closed => new
* resolution: worksforme =>
* stage: Unreviewed => Accepted
Comment:
steps to reproduce postgres should be used as backend (maybe others, but
not sqlite):
* add `Auth` app with model as shown above
* syncdb using django 1.6
* upgrade to django 1.7
* makemigrations Auth
* migrate --fake
* remove any unique constraint
* makemigrations Auth
* migrate
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:4>
* has_patch: 0 => 1
Comment:
pull request is here: https://github.com/django/django/pull/3226
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:5>
* version: 1.7-rc-1 => 1.7
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:6>
* severity: Normal => Release blocker
* needs_tests: 0 => 1
Comment:
Regression tests are also required.
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:7>
* needs_tests: 1 => 0
Comment:
tests and release notes entry added in the pull request
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:8>
* status: new => closed
* resolution: => fixed
Comment:
In [changeset:"83cd18633fb13924d8a50a1cd4ed21cb9552a635"]:
{{{
#!CommitTicketReference repository=""
revision="83cd18633fb13924d8a50a1cd4ed21cb9552a635"
Fixed #23065 -- Quoted constraint names in SQL generated by migrations.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:9>
Comment (by Tim Graham <timograham@…>):
In [changeset:"58d7b84d53832a056128192c335127f10e082f2c"]:
{{{
#!CommitTicketReference repository=""
revision="58d7b84d53832a056128192c335127f10e082f2c"
[1.7.x] Fixed #23065 -- Quoted constraint names in SQL generated by
migrations.
Backport of 83cd18633f from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23065#comment:10>