summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/migrations/0002_make_maintainer_nullable.py23
-rw-r--r--main/migrations/0003_migrate_maintainer.py8
-rw-r--r--main/migrations/0005_fix_empty_url_pkgdesc.py10
-rw-r--r--main/migrations/0013_mark_repos_testing.py6
-rw-r--r--main/migrations/0055_unique_package_in_repo.py7
5 files changed, 22 insertions, 32 deletions
diff --git a/main/migrations/0002_make_maintainer_nullable.py b/main/migrations/0002_make_maintainer_nullable.py
index 138b103b..675635df 100644
--- a/main/migrations/0002_make_maintainer_nullable.py
+++ b/main/migrations/0002_make_maintainer_nullable.py
@@ -1,26 +1,17 @@
-
+# encoding: utf-8
from south.db import db
+from south.v2 import SchemaMigration
from django.db import models
-from main.models import *
-class Migration:
-
+class Migration(SchemaMigration):
+
def forwards(self, orm):
-
- # Changing field 'Package.maintainer'
- # (to signature: django.db.models.fields.related.ForeignKey(null=True, to=orm['auth.User']))
db.alter_column('packages', 'maintainer_id', orm['main.package:maintainer'])
-
-
-
+
def backwards(self, orm):
-
- # Changing field 'Package.maintainer'
- # (to signature: django.db.models.fields.related.ForeignKey(to=orm['auth.User']))
db.alter_column('packages', 'maintainer_id', orm['main.package:maintainer'])
-
-
-
+
+
models = {
'auth.group': {
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
diff --git a/main/migrations/0003_migrate_maintainer.py b/main/migrations/0003_migrate_maintainer.py
index a3a4793f..4169a5c9 100644
--- a/main/migrations/0003_migrate_maintainer.py
+++ b/main/migrations/0003_migrate_maintainer.py
@@ -1,11 +1,9 @@
-
+# -*- coding: utf-8 -*-
from south.db import db
+from south.v2 import DataMigration
from django.db import models
-from main.models import *
-
-class Migration:
- no_dry_run = True
+class Migration(DataMigration):
def forwards(self, orm):
orm.Package.objects.filter(maintainer=0).update(maintainer=None)
diff --git a/main/migrations/0005_fix_empty_url_pkgdesc.py b/main/migrations/0005_fix_empty_url_pkgdesc.py
index c7cc1d8c..54658c17 100644
--- a/main/migrations/0005_fix_empty_url_pkgdesc.py
+++ b/main/migrations/0005_fix_empty_url_pkgdesc.py
@@ -1,14 +1,11 @@
-
+# -*- coding: utf-8 -*-
from south.db import db
+from south.v2 import DataMigration
from django.db import models
-from main.models import *
-class Migration:
+class Migration(DataMigration):
- no_dry_run = True
-
def forwards(self, orm):
- "Write your forwards migration here"
for p in orm.Package.objects.filter(pkgdesc=''):
p.pkgdesc = None
p.save()
@@ -24,7 +21,6 @@ class Migration:
def backwards(self, orm):
- "Write your backwards migration here"
for p in orm.Package.objects.filter(pkgdesc=None):
p.pkgdesc = ''
p.save()
diff --git a/main/migrations/0013_mark_repos_testing.py b/main/migrations/0013_mark_repos_testing.py
index 617a3ab8..e50010b2 100644
--- a/main/migrations/0013_mark_repos_testing.py
+++ b/main/migrations/0013_mark_repos_testing.py
@@ -1,9 +1,9 @@
+# -*- coding: utf-8 -*-
from south.db import db
+from south.v2 import DataMigration
from django.db import models
-from main.models import *
-class Migration:
- no_dry_run = True
+class Migration(DataMigration):
def forwards(self, orm):
orm.Repo.objects.filter(name__endswith="Testing").update(testing=True)
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):