diff options
author | Sylvain Thenault <sylvain.thenault@logilab.fr> | 2008-09-08 20:00:34 +0200 |
---|---|---|
committer | Sylvain Thenault <sylvain.thenault@logilab.fr> | 2008-09-08 20:00:34 +0200 |
commit | a46eaf83ce840171507100261fa63e95f71d5469 (patch) | |
tree | 5f24827643b9f920f4341e8e0fc8469fa0126b30 /adbh.py | |
parent | 84a87e513fc6c01601a292e3c600325c15bea1e0 (diff) | |
download | logilab-common-a46eaf83ce840171507100261fa63e95f71d5469.tar.gz |
should alter table to properly delete UNIQUE constraints
Diffstat (limited to 'adbh.py')
-rw-r--r-- | adbh.py | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -257,7 +257,10 @@ INSERT INTO %s VALUES (0);''' % (seq_name, seq_name) def drop_index(self, cursor, table, column, unique=False): if self.index_exists(cursor, table, column, unique): idx = self._index_name(table, column, unique) - cursor.execute('DROP INDEX %s' % idx) + if unique: + cursor.execute('ALTER TABLE %s DROP CONSTRAINT %s' % (table, idx)) + else: + cursor.execute('DROP INDEX %s' % idx) def index_exists(self, cursor, table, column, unique=False): idx = self._index_name(table, column, unique) |