Search code examples
kiwi-tcms

Migration from v6.4 to v7.2 fails with "Column 'execution_id' cannot be null"


Running migration in a docker kiwitcms/kiwi:latest (v7.2 digest d757b56bc10c) image based docker container. During migration testcases.0010_remove_bug fails with some database constraint problem.

Is this a bug in the migration script or an issue with data not consistent?

Operations to perform:
  Apply all migrations: admin, attachments, auth, bugs, contenttypes, core, django_comments, kiwi_auth, linkreference, management, sessions, sites, testcases, testplans, testruns
Running migrations:
  Applying testcases.0010_remove_bug...Traceback (most recent call last):
  File "/venv/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 71, in execute
    return self.cursor.execute(query, args)
  File "/venv/lib/python3.6/site-packages/MySQLdb/cursors.py", line 209, in execute
    res = self._query(query)
  File "/venv/lib/python3.6/site-packages/MySQLdb/cursors.py", line 315, in _query
    db.query(q)
  File "/venv/lib/python3.6/site-packages/MySQLdb/connections.py", line 239, in query
    _mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1048, "Column 'execution_id' cannot be null")


Solution

  • This is a bug in the migration script. The problem lies in the fact that prior to these changes you could attach bugs directly to test cases, without an actual test execution. This resulted in the case_run_id field being None.

    With the new changes bugs can only be attached to test executions and their execution_id field should always have a value.

    Can you try this patch and let me know if it works for you: https://github.com/kiwitcms/Kiwi/pull/1266