mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2025-07-16 02:52:25 +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.
|
# If not, wait for docker-compose up to migrate all tables.
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute(
|
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',)
|
('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:
|
except psycopg2.OperationalError:
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
except psycopg2.errors.UndefinedTable:
|
|
||||||
conn.close()
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
sys.exit(0)
|
|
||||||
END
|
END
|
||||||
}
|
}
|
||||||
until postgres_ready; do
|
until postgres_ready; do
|
||||||
|
|
|
@ -20,15 +20,17 @@ try:
|
||||||
# If not, wait for docker-compose up to migrate all tables.
|
# If not, wait for docker-compose up to migrate all tables.
|
||||||
cur = conn.cursor()
|
cur = conn.cursor()
|
||||||
cur.execute(
|
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',)
|
('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:
|
except psycopg2.OperationalError:
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
except psycopg2.errors.UndefinedTable:
|
|
||||||
conn.close()
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
END
|
END
|
||||||
|
|
Loading…
Reference in New Issue
Block a user