+def check_database_integrity(context):
+ """ Check some generic constraints on the tables.
+ """
+ # place_addressline should not have duplicate (place_id, address_place_id)
+ cur = context.db.cursor()
+ cur.execute("""SELECT count(*) FROM
+ (SELECT place_id, address_place_id, count(*) as c
+ FROM place_addressline GROUP BY place_id, address_place_id) x
+ WHERE c > 1""")
+ eq_(0, cur.fetchone()[0], "Duplicates found in place_addressline")
+
+