<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13563</bug_id>
          
          <creation_ts>2019-09-30 13:43:29 +0000</creation_ts>
          <short_desc>Can&apos;t migrate from django 1.x to 2.x</short_desc>
          <delta_ts>2020-06-24 22:32:55 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Security Response Tool</product>
          <component>General</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>3.2 M1</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ross Burton">ross.burton</reporter>
          <assigned_to name="David Reyna">david.reyna</assigned_to>
          
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>85130</commentid>
    <comment_count>0</comment_count>
    <who name="Ross Burton">ross.burton</who>
    <bug_when>2019-09-30 13:43:29 +0000</bug_when>
    <thetext>If I copy srtool from a django 1.1.23 machine to a django 2.2.3 machine (literally rsync srtool entirely) then on startup the new Django complains about the schema:

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, orm, sessions, users
Running migrations:
  Applying auth.0010_alter_group_name_max_length...Traceback (most recent call last):
  File &quot;/home/rburton/Yocto/srtool/lib/manage.py&quot;, line 10, in &lt;module&gt;
    execute_from_command_line(sys.argv)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/__init__.py&quot;, line 381, in execute_from_command_line
    utility.execute()
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/__init__.py&quot;, line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/base.py&quot;, line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/base.py&quot;, line 364, in execute
    output = self.handle(*args, **options)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/base.py&quot;, line 83, in wrapped
    res = handle_func(*args, **kwargs)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/core/management/commands/migrate.py&quot;, line 234, in handle
    fake_initial=fake_initial,
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/db/migrations/executor.py&quot;, line 117, in migrate
    state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/db/migrations/executor.py&quot;, line 147, in _migrate_all_forwards
    state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial)
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/db/migrations/executor.py&quot;, line 247, in apply_migration
    migration_recorded = True
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/schema.py&quot;, line 34, in __exit__
    self.connection.check_constraints()
  File &quot;/home/rburton/.local/lib/python3.5/site-packages/django/db/backends/sqlite3/base.py&quot;, line 350, in check_constraints
    bad_row[1], referenced_table_name, referenced_column_name,
django.db.utils.IntegrityError: The row in table &apos;orm_cvesource&apos; with primary key &apos;127681&apos; has an invalid foreign key: orm_cvesource.cve_id contains a value &apos;-1&apos; that does not have a corresponding value in orm_cve.id.
Failed migrations, aborting system start
Failed start.

django IRC says:

[14:31:29]  &lt;kezabelle&gt;	somewhere you&apos;ve got -1 as either a value or a default, which isn&apos;t a valid value for the FK
[14:38:44]  &lt;kezabelle&gt;	regardless, if the new one is finding problems the old version wasn&apos;t, the new version is probably correct </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85186</commentid>
    <comment_count>1</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-10-03 14:35:24 +0000</bug_when>
    <thetext>Yes. 

I have a set of patches that I am preparing for SRTool and for Toaster. These are about 5 fundamental changes that have to be done to accommodate Django-2.x.

- David</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>85735</commentid>
    <comment_count>2</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2019-12-05 16:26:40 +0000</bug_when>
    <thetext>Here is the pending related Toaster patch:

 Toaster: transitioning to Django-2.2 soon [YOCTO #13207]

 http://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/commit/?h=dreyna/toaster/django_2_2_13207&amp;id=117fc2dd7dc220c516309477f2cbe2134f1bd5db</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>87577</commentid>
    <comment_count>3</comment_count>
    <who name="David Reyna">david.reyna</who>
    <bug_when>2020-06-24 22:32:55 +0000</bug_when>
    <thetext>commit 4dabdbe11ddc47a885c7f8cc6b3f26439d40d77c
commit 5890b72bd68673738b38e67019dadcbcaf643ed8 (Dunfell)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>