models: Remove "cleared" and "processed" fields from Jobs.
[ganeti_webmgr.git] / ganeti_web / migrations / __init__.py
blob07b15b75005e881dd8b4b06cd4c9d2d53d766e8c
2 def db_table_exists(table, cursor=None):
3 """
4 Determine if a table exists in the database
6 cribbed from:
7 https://gist.github.com/527113/307c2dec09ceeb647b8fa1d6d49591f3352cb034
8 """
10 try:
11 if not cursor:
12 from django.db import connection
13 cursor = connection.cursor()
14 if not cursor:
15 raise Exception
16 table_names = connection.introspection.get_table_list(cursor)
17 except:
18 raise Exception("unable to determine if the table '%s' exists" % table)
19 else:
20 return table in table_names