misc/migration/2.42.1_Any.py
author Aurelien Campeas <aurelien.campeas@logilab.fr>
Tue, 19 May 2009 15:42:32 +0200
branchstable
changeset 1870 015dfeaf1d89
parent 1802 d628defebc17
child 1977 606923dff11b
permissions -rw-r--r--
trailing space cleanup, js lint, a small indent for preference sections

if confirm('remove deprecated database constraints?'):
    execute = session.system_sql
    session.set_pool()
    dbhelper = session.pool.source('system').dbhelper
    cu = session.pool['system']
    for table in dbhelper.list_tables(cu):
        if table.endswith('_relation'):
            try:
                execute('ALTER TABLE %s DROP CONSTRAINT %s_fkey1' % (table, table))
                execute('ALTER TABLE %s DROP CONSTRAINT %s_fkey2' % (table, table))
            except:
                continue
    checkpoint()

if 'inline_view' in schema:
    # inline_view attribute should have been deleted for a while now....
    drop_attribute('CWRelation', 'inline_view')