summaryrefslogtreecommitdiff
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
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>
-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
-rw-r--r--todolists/migrations/0002_add_todolist_and_todolistpackage.py4
6 files changed, 26 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):
diff --git a/todolists/migrations/0002_add_todolist_and_todolistpackage.py b/todolists/migrations/0002_add_todolist_and_todolistpackage.py
index 8365535a..ba8f7ebe 100644
--- a/todolists/migrations/0002_add_todolist_and_todolistpackage.py
+++ b/todolists/migrations/0002_add_todolist_and_todolistpackage.py
@@ -6,6 +6,10 @@ from django.db import models
class Migration(SchemaMigration):
+ depends_on = (
+ ('main', '0024_set_initial_flag_date'),
+ )
+
def forwards(self, orm):
db.create_table('todolists_todolist', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),