def app_db_migrated():
 (conn, c) = get_db_connection()
 journalist_tables = c.execute('PRAGMA table_info(journalists)').fetchall()
 table_names = set([table[1] for table in journalist_tables])
 return ('last_token' in table_names)

def app_db_migrated ( ) : ( conn , c ) = get_db_connection ( ) journalist_tables = c . execute ( 'PRAGMA table_info(journalists)' ) . fetchall ( ) table_names = set ( [ table [ 1 ] for table in journalist_tables ] ) return ( 'last_token' in table_names )
to make the upgrade role idempotent .