Closed DtiLegBG closed 7 years ago
Tabela materia_tipomaterialegislativa
@DtiLegBG , preciso que vc rode um pequeno teste na sua base e me diga o que aparece.
Para fazer isso basta rodar ./manage.py shell
na raiz do projeto e colar o código a seguir:
from django.db import connections
from sapl.materia.models import TipoProposicao
conn = connections['default']
conn.schema_editor()._constraint_names(
TipoProposicao, ['content_type_id', 'object_id'], unique=True)
Identificamos que havia uma constraint a mais no banco, que apagamos manualmente.
a principio depois deste merge - 4776d4a Remove unique_together de TipoProposicao ao rodar o migrate é mostrado o seguinte erro:
./manage.py migrate Operations to perform: Apply all migrations: contenttypes, sessao, reversion, lexml, materia, admin, compilacao, base, auth, easy_thumbnails, parlamentares, sessions, painel, protocoloadm, norma, comissoes Running migrations: Rendering model states... DONE Applying materia.0015_auto_20170908_1024...Traceback (most recent call last): File "./manage.py", line 10, in
execute_from_command_line(sys.argv)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/init.py", line 353, in execute_from_command_line
utility.execute()
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/init.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, *cmd_options)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(args, **options)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/core/management/commands/migrate.py", line 200, in handle
executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py", line 92, in migrate
self._migrate_all_forwards(plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py", line 121, in _migrate_all_forwards
state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/executor.py", line 198, in apply_migration
state = migration.apply(state, schema_editor)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/migration.py", line 123, in apply
operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
File "/var/interlegis/sapl/sapl/materia/migrations/0015_auto_20170908_1024.py", line 22, in database_forwards
app_label, schema_editor, from_state, to_state
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/migrations/operations/models.py", line 359, in database_forwards
getattr(new_model._meta, self.option_name, set()),
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 318, in alter_unique_together
self._delete_composed_index(model, fields, {'unique': True}, self.sql_delete_unique)
File "/var/interlegis/.virtualenvs/sapl/lib/python3.5/site-packages/django/db/backends/base/schema.py", line 347, in _delete_composed_index
", ".join(columns),
ValueError: Found wrong number (2) of constraints for materia_tipoproposicao(content_type_id, object_id)