summaryrefslogtreecommitdiff
path: root/main/migrations/0055_unique_package_in_repo.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-01-15 21:29:30 -0600
committerDan McGee <dan@archlinux.org>2013-01-15 21:29:30 -0600
commitf106379b5382b2b82aa56466c8d3acaae58327a9 (patch)
tree275a9e2edfbbca46009a511ffbc032685dea6dad /main/migrations/0055_unique_package_in_repo.py
parent3a6398f42d04ea6a677bf7b6d5115175e9011432 (diff)
Clean up and make several migrations modernrelease_2013-01-15
This moves most migrations to the v2 format that have been presenting some issues. One missing depends_on relationship has been added, and we allow an index to not be dropped if it does not exist due to the shittyness in sqlite3 actually keeping indexes across DDL on that table. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'main/migrations/0055_unique_package_in_repo.py')
-rw-r--r--main/migrations/0055_unique_package_in_repo.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/main/migrations/0055_unique_package_in_repo.py b/main/migrations/0055_unique_package_in_repo.py
index 36cc7193..9ae33719 100644
--- a/main/migrations/0055_unique_package_in_repo.py
+++ b/main/migrations/0055_unique_package_in_repo.py
@@ -2,11 +2,16 @@
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from django.db.utils import DatabaseError
class Migration(SchemaMigration):
def forwards(self, orm):
- db.delete_index('packages', ['pkgname'])
+ try:
+ db.delete_index('packages', ['pkgname'])
+ except DatabaseError as e:
+ if not 'no such index' in str(e):
+ raise e
db.create_unique('packages', ['pkgname', 'repo_id', 'arch_id'])
def backwards(self, orm):