equal
deleted
inserted
replaced
1 """ |
|
2 |
|
3 :organization: Logilab |
|
4 :copyright: 2001-2009 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
|
5 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
6 :license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
|
7 """ |
|
8 if confirm('remove deprecated database constraints?'): |
|
9 execute = session.system_sql |
|
10 session.set_pool() |
|
11 dbhelper = session.pool.source('system').dbhelper |
|
12 cu = session.pool['system'] |
|
13 for table in dbhelper.list_tables(cu): |
|
14 if table.endswith('_relation'): |
|
15 try: |
|
16 execute('ALTER TABLE %s DROP CONSTRAINT %s_fkey1' % (table, table)) |
|
17 execute('ALTER TABLE %s DROP CONSTRAINT %s_fkey2' % (table, table)) |
|
18 except: |
|
19 continue |
|
20 checkpoint() |
|
21 |
|
22 if 'inline_view' in schema: |
|
23 # inline_view attribute should have been deleted for a while now.... |
|
24 drop_attribute('CWRelation', 'inline_view') |
|
25 |
|