Skip to content

Commit d7da19d

Browse files
committed
Fix some issue when restoring data on Postgres
1 parent d34eab2 commit d7da19d

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Docker/deploy/pg/docker-compose.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3'
22

33
services:
44
db:
5-
image: libreosteo-pg
5+
image: libreosteo/libreosteo-pg
66
hostname: pg_1
77
volumes:
88
- ${LIBREOSTEO_DB_STORAGE}:/var/lib/postgresql/data
@@ -12,8 +12,10 @@ services:
1212
- POSTGRES_USER=${POSTGRES_USER}
1313
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
1414
- POSTGRES_DB=libreosteo
15+
ports:
16+
- "5432:5432"
1517
libreosteo:
16-
image: libreosteo-http
18+
image: libreosteo/libreosteo-http
1719
hostname: libreosteo_1
1820
ports:
1921
- "8085:8085"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
TAG := dev
1+
TAG := latest
22
HOST_PORT := 8085
33
GUEST_PORT := 8085
44
REPOSITORY := libreosteo

libreosteoweb/api/views.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,14 +780,16 @@ def post(self, request, *args, **kwargs):
780780
with connection.cursor() as cursor:
781781
deferred_delete = ''
782782
for s in buf.getvalue().split('\n'):
783-
if "django_content_type" not in s and "COMMIT" not in s:
783+
if "django_content_type" not in s and "COMMIT" not in s and len(s.strip()) > 0:
784784
logger.info("Execute query : %s" % s)
785785
cursor.execute(s)
786786
else:
787-
deferred_delete = deferred_delete + '\n' + s
787+
if len(s.strip()) > 0:
788+
deferred_delete = deferred_delete + '\n' + s
788789
for s in deferred_delete.split('\n'):
789-
logger.info(s)
790-
cursor.execute(s)
790+
if len(s.strip()) > 0:
791+
logger.info(s)
792+
cursor.execute(s)
791793
# It means that the settings.FIXTURE_DIRS should be set in settings
792794
previous = settings.FIXTURE_DIRS
793795
settings.FIXTURE_DIRS = [tempfile.gettempdir()]

0 commit comments

Comments
 (0)