~openupgrade-committers/openupgrade-server/5.0

« back to all changes in this revision

Viewing changes to bin/openupgrade/openupgrade_tools.py

  • Committer: Stefan Rijnhart
  • Date: 2012-05-27 12:24:43 UTC
  • mfrom: (2175.1.3 openupgrade-server)
  • Revision ID: stefan@therp.nl-20120527122443-7lh1cvrm26wt8u6e
[MRG] Add openupgrade development module for easy analysis file generation

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
def table_exists(cr, table):
 
3
    """ Check whether a certain table or view exists """
 
4
    cr.execute(
 
5
        'SELECT count(relname) FROM pg_class WHERE relname = %s',
 
6
        (table,))
 
7
    return cr.fetchone()[0] == 1
 
8