mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 19:17:13 -05:00 
			
		
		
		
	Catch ProgrammingError in Document checks.
When running PostgreSQL or MariaDB/MySQL backends, a query to a non-existent table will raise a "ProgrammingError". This patch properly catches this error. Without this patch all management calls to manage.py will lead to an error when running PostgreSQL or MariaDB as a backend.
This commit is contained in:
		
							parent
							
								
									ee20af71e8
								
							
						
					
					
						commit
						2308d5a613
					
				@ -2,7 +2,7 @@ import textwrap
 | 
			
		||||
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.core.checks import Error, register
 | 
			
		||||
from django.db.utils import OperationalError
 | 
			
		||||
from django.db.utils import OperationalError, ProgrammingError
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@register()
 | 
			
		||||
@ -14,7 +14,7 @@ def changed_password_check(app_configs, **kwargs):
 | 
			
		||||
    try:
 | 
			
		||||
        encrypted_doc = Document.objects.filter(
 | 
			
		||||
            storage_type=Document.STORAGE_TYPE_GPG).first()
 | 
			
		||||
    except OperationalError:
 | 
			
		||||
    except (OperationalError, ProgrammingError):
 | 
			
		||||
        return []  # No documents table yet
 | 
			
		||||
 | 
			
		||||
    if encrypted_doc:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user