View Issue Details

IDProjectCategoryView StatusLast Update
0004355Talerobsolete componentpublic2016-09-26 14:01
ReporterMarcello Stanisci Assigned ToMarcello Stanisci  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Target Version0.0Fixed in Version0.0 
Summary0004355: incremental public accounts
Descriptionbank account numbers for public accounts should be assigned incrementally
without manually specifying the numbers in config.py
TagsNo tags attached.

Activities

Marcello Stanisci

2016-04-02 19:07

reporter   ~0010359

Set account_no to 'AutoField'. This is not liked (?) by the connection between BankAccount and History models. The manifestation is the following error when trying to 'migrate':

(taler_bank_py3) marcello@daemon:~/bank/django$ python manage.py migrate
Operations to perform:
  Apply all migrations: sessions, auth, bank_app, admin, contenttypes
Running migrations:
  Rendering model states... DONE
  Applying bank_app.0002_auto_20160402_1701...Traceback (most recent call last):
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
psycopg2.InternalError: cannot drop constraint bank_app_bankaccount_pkey on table bank_app_bankaccount because other objects depend on it
DETAIL: constraint bank_app_hi_account_id_5c1bfd26_fk_bank_app_bankaccount_user_id on table bank_app_history depends on index bank_app_bankaccount_pkey
HINT: Use DROP ... CASCADE to drop the dependent objects too.


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/core/management/commands/migrate.py", line 200, in handle
    executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/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 "/home/marcello/tmp/taler_bank_py3/lib/python3.4/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 "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/migrations/executor.py", line 198, in apply_migration
    state = migration.apply(state, schema_editor)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/migrations/migration.py", line 123, in apply
    operation.database_forwards(self.app_label, schema_editor, old_state, project_state)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/migrations/operations/fields.py", line 201, in database_forwards
    schema_editor.alter_field(from_model, from_field, to_field)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 482, in alter_field
    old_db_params, new_db_params, strict)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/postgresql/schema.py", line 110, in _alter_field
    new_db_params, strict,
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 686, in _alter_field
    self.execute(self._delete_constraint_sql(self.sql_delete_pk, model, constraint_name))
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/base/schema.py", line 110, in execute
    cursor.execute(sql, params)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/utils.py", line 79, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/utils.py", line 95, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/utils/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/home/marcello/tmp/taler_bank_py3/lib/python3.4/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
django.db.utils.InternalError: cannot drop constraint bank_app_bankaccount_pkey on table bank_app_bankaccount because other objects depend on it
DETAIL: constraint bank_app_hi_account_id_5c1bfd26_fk_bank_app_bankaccount_user_id on table bank_app_history depends on index bank_app_bankaccount_pkey
HINT: Use DROP ... CASCADE to drop the dependent objects too.

Marcello Stanisci

2016-04-05 14:25

reporter   ~0010375

should be fixed by 9e7e528..7cb4273.

passing a 'default=None' parameter (into the migration itself) to the AutoField field fixed it.

Issue History

Date Modified Username Field Change
2016-03-31 18:48 Marcello Stanisci New Issue
2016-03-31 18:48 Marcello Stanisci Status new => assigned
2016-03-31 18:48 Marcello Stanisci Assigned To => Marcello Stanisci
2016-04-02 19:07 Marcello Stanisci Note Added: 0010359
2016-04-05 14:25 Marcello Stanisci Note Added: 0010375
2016-04-05 14:25 Marcello Stanisci Status assigned => resolved
2016-04-05 14:25 Marcello Stanisci Resolution open => fixed
2016-04-06 00:26 Christian Grothoff Status resolved => closed
2016-09-26 14:00 Christian Grothoff Fixed in Version => 0.0
2016-09-26 14:01 Christian Grothoff Target Version => 0.0
2022-08-23 20:26 Christian Grothoff Category bank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 01:23 Christian Grothoff Category py bank (demonstrator, obsolete) => obsolete componet
2023-12-11 20:08 Florian Dold Category obsolete componet => obsolete component