Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
Merge branch 'develop' into feature/issue-1235-busy-routers
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBarnett committed Apr 8, 2015
2 parents 4d9ce61 + 2036eca commit f66577f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
12 changes: 7 additions & 5 deletions go/billing/migrations/0020_transaction_type_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
class Migration(SchemaMigration):

def forwards(self, orm):
messages = orm.Transaction.objects.exclude(message_direction='')
topups = orm.Transaction.objects.filter(message_direction='')
if not db.dry_run:
messages = orm.Transaction.objects.exclude(message_direction='')
topups = orm.Transaction.objects.filter(message_direction='')

messages.update(transaction_type='Message')
topups.update(transaction_type='Top Up')
messages.update(transaction_type='Message')
topups.update(transaction_type='Top Up')

def backwards(self, orm):
orm.Transaction.objects.update(transaction_type=None)
if not db.dry_run:
orm.Transaction.objects.update(transaction_type=None)

models = {
u'auth.group': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.db.utils import DatabaseError


class Migration(SchemaMigration):
Expand All @@ -14,16 +15,24 @@ def forwards(self, orm):
# Adding unique constraint on 'MessageCost', fields ['account', 'tag_pool', 'message_direction', 'provider']
db.create_unique(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction', 'provider'])

# Removing index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction']
db.delete_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction'])
try:
# Removing index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction']
db.delete_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction'])
except DatabaseError as e:
if not str(e).startswith("no such index: billing_messagecost_account_id_"):
raise

# Adding index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction', 'provider']
db.create_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction', 'provider'])


def backwards(self, orm):
# Removing index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction', 'provider']
db.delete_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction', 'provider'])
try:
# Removing index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction', 'provider']
db.delete_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction', 'provider'])
except DatabaseError as e:
if not str(e).startswith("no such index: billing_messagecost_account_id_"):
raise

# Adding index on 'MessageCost', fields ['account', 'tag_pool', 'message_direction']
db.create_index(u'billing_messagecost', ['account_id', 'tag_pool_id', 'message_direction'])
Expand Down Expand Up @@ -173,4 +182,4 @@ def backwards(self, orm):
}
}

complete_apps = ['billing']
complete_apps = ['billing']

0 comments on commit f66577f

Please sign in to comment.