Uploaded image for project: 'openATTIC'
  1. openATTIC
  2. OP-1649

Database migrations don't work with Django 1.6

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0.16
    • Fix Version/s: None
    • Component/s: Backend

      Description

      On Django 1.6, We're using the syncdb command in oaconfig install. Here is the corresponding documentation:

      syncdb will only create tables for models which have not yet been installed. It will never issue ALTER TABLE statements to match changes to a model class after installation. Changes to model classes and database schemas often involve some form of ambiguity and, in those cases, Django would have to guess at the correct changes to make. There is a risk that critical data would be lost in the process. If you have made changes to a model an wish to alter the database tables to match, use the sql command to display the new SQL structure and compare that to your existing table schema and work out the changes.

      Traceback when running oaconfig install

      Traceback (most recent call last):              
        File "manage.py", line 26, in <module>        
          execute_from_command_line(sys.argv)         
        File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line             
          utility.execute()
        File "/usr/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute    
          self.fetch_command(subcommand).run_from_argv(self.argv)                
        File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv  
          self.execute(*args, **options.__dict__)     
        File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute        
          output = self.handle(*args, **options)      
        File "/srv/openattic/backend/ifconfig/management/commands/add-host.py", line 27, in handle          
          host = Host.objects.get_current()           
        File "/srv/openattic/backend/ifconfig/models.py", line 69, in get_current
          return self.get(name=socket.getfqdn())      
        File "/usr/lib/python2.7/dist-packages/django/db/models/manager.py", line 151, in get               
          return self.get_queryset().get(*args, **kwargs)                        
        File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 301, in get                 
          num = len(clone) 
        File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 77, in __len__              
          self._fetch_all()
        File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 854, in _fetch_all          
          self._result_cache = list(self.iterator())  
        File "/usr/lib/python2.7/dist-packages/django/db/models/query.py", line 220, in iterator            
          for row in compiler.results_iter():         
        File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 713, in results_iter 
          for rows in self.execute_sql(MULTI):        
        File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 786, in execute_sql  
          cursor.execute(sql, params)                 
        File "/usr/lib/python2.7/dist-packages/django/db/backends/util.py", line 69, in execute             
          return super(CursorDebugWrapper, self).execute(sql, params)            
        File "/usr/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute             
          return self.cursor.execute(sql, params)     
        File "/usr/lib/python2.7/dist-packages/django/db/utils.py", line 99, in __exit__                    
          six.reraise(dj_exc_type, dj_exc_value, traceback)                      
        File "/usr/lib/python2.7/dist-packages/django/db/backends/util.py", line 53, in execute             
          return self.cursor.execute(sql, params)     
      django.db.utils.ProgrammingError: column ifconfig_host.is_oa_host does not exist                      
      LINE 1: ...ECT "ifconfig_host"."id", "ifconfig_host"."name", "ifconfig_...    
      

      Our idea is to remove support for Django 1.6 which mainly affects Ubuntu 14.04

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              swagner Sebastian Wagner
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: