View Issue Details

IDProjectCategoryView StatusLast Update
0004355Talerobsolete componentpublic2016-09-26 12:01
ReporterMarcello Stanisci Assigned ToMarcello Stanisci Resolution deadline
ImplementerReviewer 
Release signed byDeployed by 
VerifierCommunicator 
Data protection authority notification requiredNo  
CSIRT notification requiredNo  
Estimated effort (hours)Actual effort (hours)0 
Fast-trackNo
Work packagenone
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.

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Marcello Stanisci

2016-04-02 17: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 12: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 ModifiedUsernameFieldChange
2016-03-31 16:48Marcello StanisciNew Issue
2016-03-31 16:48Marcello StanisciStatusnew => assigned
2016-03-31 16:48Marcello StanisciAssigned To => Marcello Stanisci
2016-04-02 17:07Marcello StanisciNote Added: 0010359
2016-04-05 12:25Marcello StanisciNote Added: 0010375
2016-04-05 12:25Marcello StanisciStatusassigned => informing
2016-04-05 12:25Marcello StanisciResolutionopen => fixed
2016-04-05 22:26Christian GrothoffStatusinforming => closed
2016-09-26 12:00Christian GrothoffFixed in Version => 0.0
2016-09-26 12:01Christian GrothoffTarget Version => 0.0
2022-08-23 18:26Christian GrothoffCategorybank (demonstrator) => py bank (demonstrator, obsolete)
2023-12-03 00:23Christian GrothoffCategorypy bank (demonstrator, obsolete) => obsolete componet
2023-12-11 19:08Florian DoldCategoryobsolete componet => obsolete component