mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-22 17:47:08 +03:00
Update beat start files with better? SQL statement
This commit is contained in:
parent
dd0e7c0c80
commit
25cd8ea72b
|
@ -22,17 +22,18 @@ try:
|
|||
# If not, wait for docker-compose up to migrate all tables.
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
"select exists(select * from ${POSTGRES_DB}.tables where table_name=%s)",
|
||||
"select exists(select * from information_schema.tables where table_name=%s)",
|
||||
('django_celery_beat_periodictask',)
|
||||
)
|
||||
conn.close()
|
||||
if cur.fetchone()[0] == 1:
|
||||
cur.close()
|
||||
sys.exit(0)
|
||||
else:
|
||||
cur.close()
|
||||
sys.exit(-1)
|
||||
except psycopg2.OperationalError:
|
||||
sys.exit(-1)
|
||||
except psycopg2.errors.UndefinedTable:
|
||||
conn.close()
|
||||
sys.exit(-1)
|
||||
|
||||
sys.exit(0)
|
||||
END
|
||||
}
|
||||
until postgres_ready; do
|
||||
|
|
|
@ -20,15 +20,17 @@ try:
|
|||
# If not, wait for docker-compose up to migrate all tables.
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
"select exists(select * from ${POSTGRES_DB}.tables where table_name=%s)",
|
||||
"select exists(select * from information_schema.tables where table_name=%s)",
|
||||
('django_celery_beat_periodictask',)
|
||||
)
|
||||
conn.close()
|
||||
if cur.fetchone()[0] == 1:
|
||||
cur.close()
|
||||
sys.exit(0)
|
||||
else:
|
||||
cur.close()
|
||||
sys.exit(-1)
|
||||
except psycopg2.OperationalError:
|
||||
sys.exit(-1)
|
||||
except psycopg2.errors.UndefinedTable:
|
||||
conn.close()
|
||||
sys.exit(-1)
|
||||
|
||||
sys.exit(0)
|
||||
END
|
||||
|
|
Loading…
Reference in New Issue
Block a user