Skip to content

Install error: fail during make migrate #754

Closed

Description

@rco3

applying part migrations, gets as far as:

Applying part.0033_auto_20200404_0445... OK
Applying part.0034_auto_20200404_1238...Could not generate Part thumbnails
Traceback (most recent call last):
File "/home/pi/inventree/inventree-env/lib/python3.7/site-packages/django/db/backends/utils.py", line 84, in _execute
  return self.cursor.execute(sql)
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block

I've tried DROP USER, DROP DATABASE and re-created them; and have blown away the entire install folder and newly cloned from GitHub, same error same place.

Local permissions error? Missing image files? Cooties in my OS?

Activity

  1. SchrodingersGat commented on Apr 25, 2020

    @SchrodingersGat
    Member

    Might be due to running a postgresql database - I cannot replicate here.. Can you please try the following: Change the contents of https://github.com/inventree/InvenTree/blob/master/InvenTree/part/migrations/0034_auto_20200404_1238.py to:

    # Generated by Django 2.2.10 on 2020-04-04 12:38
    
    from django.db import migrations
    from django.db.utils import OperationalError, ProgrammingError
    
    from part.models import Part
    from stdimage.utils import render_variations
    
    
    def create_thumbnails(apps, schema_editor):
        """
        Create thumbnails for all existing Part images.
        """
        
        # Do not apply this migration
        return
        
        """
        try:
            for part in Part.objects.all():
                # Render thumbnail for each existing Part 
                if part.image:
                    try:
                        part.image.render_variations()
                    except FileNotFoundError:
                        print("Missing image:", part.image())
                        # The image is missing, so clear the field
                        part.image = None
                        part.save()
                        
        except (OperationalError, ProgrammingError):
            # Migrations have not yet been applied - table does not exist
            print("Could not generate Part thumbnails")
        """
    
    class Migration(migrations.Migration):
    
        dependencies = [
            ('part', '0033_auto_20200404_0445'),
        ]
    
        operations = [
            migrations.RunPython(create_thumbnails),
        ]

    and then see if it runs properly?

  2. SchrodingersGat commented on Apr 25, 2020

    @SchrodingersGat
    Member

    I setup a postgresql test instance and got the same issue on my end. I've fixed this now, I believe. Can you please pull down latest master and check?

  3. rco3 commented on Apr 26, 2020

    @rco3
    Author

    I will check it. A sqlite3 install just now worked fine.

  4. rco3 commented on Apr 26, 2020

    @rco3
    Author

    I confirm that postgresql database works now as well.
    Thank you.

    I did try removing the last two migrations, but wasn't successful; now I'm wondering if I remembered to kill and restart the server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions