summaryrefslogtreecommitdiffstats
path: root/askbot/migrations
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2012-12-24 21:40:01 +0000
committerMonty Taylor <mordred@inaugust.com>2012-12-24 21:47:24 +0000
commit2f8e4244747948e6bf2fe967d326dfa2d6f6366c (patch)
treef053a1d1d597057f5cb9de078c78e80245c620db /askbot/migrations
parent13823c0ed6e0ec54e3068efa62b2fe889ef8d799 (diff)
downloadaskbot-2f8e4244747948e6bf2fe967d326dfa2d6f6366c.tar.gz
askbot-2f8e4244747948e6bf2fe967d326dfa2d6f6366c.tar.bz2
askbot-2f8e4244747948e6bf2fe967d326dfa2d6f6366c.zip
Fix fake migration errors so we can find the real ones.
Diffstat (limited to 'askbot/migrations')
-rw-r--r--askbot/migrations/0013_add_response_count__to_user.py17
-rw-r--r--askbot/migrations/0014_rename_schema_from_forum_to_askbot.py21
-rw-r--r--askbot/migrations/0018_add___status__field_to_user_model.py16
-rw-r--r--askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py8
-rw-r--r--askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py16
-rw-r--r--askbot/migrations/0035_add_country_fields_to_user.py8
-rw-r--r--askbot/migrations/0037_add_marked_tags_to_user_profile.py12
-rw-r--r--askbot/migrations/0038_add_tag_filter_strategies.py32
-rw-r--r--askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py6
-rw-r--r--askbot/migrations/0122_auth_user__add_subscribed_tag_field.py8
-rw-r--r--askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py15
-rw-r--r--askbot/migrations/0125_add_show_tags_field_to_user.py18
-rw-r--r--askbot/migrations/0126_add_field__auth_user__is_fake.py11
13 files changed, 83 insertions, 105 deletions
diff --git a/askbot/migrations/0013_add_response_count__to_user.py b/askbot/migrations/0013_add_response_count__to_user.py
index f3d724e3..68ac0c3c 100644
--- a/askbot/migrations/0013_add_response_count__to_user.py
+++ b/askbot/migrations/0013_add_response_count__to_user.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -13,16 +14,12 @@ class Migration(SchemaMigration):
a bit hacky but we have to do it as long as we keep patching auth models
within the forum application
"""
- try:
- db.add_column(
- u'auth_user',
- 'response_count',
- self.gf('django.db.models.fields.IntegerField')(default=0, ),
- keep_default=False
- )
- except:
- print 'probably already have column User.response_count'
- pass
+ safe_add_column(
+ u'auth_user',
+ 'response_count',
+ self.gf('django.db.models.fields.IntegerField')(default=0, ),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py b/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
index f5f913da..f9a5b739 100644
--- a/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
+++ b/askbot/migrations/0014_rename_schema_from_forum_to_askbot.py
@@ -10,19 +10,20 @@ app_dir_name = os.path.basename(os.path.dirname(os.path.dirname(__file__)))
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- db.rename_table('forum_anonymousanswer', 'askbot_anonymousanswer')
- db.rename_table('forum_anonymousquestion', 'askbot_anonymousquestion')
- db.rename_table('forum_emailfeedsetting', 'askbot_emailfeedsetting')
- db.rename_table('forum_markedtag', 'askbot_markedtag')
- db.rename_table('forum_questionview', 'askbot_questionview')
- db.rename_table('forum_validationhash', 'askbot_validationhash')
- except:
- pass
+ if app_dir_name == 'forum':
+ try:
+ db.rename_table('forum_anonymousanswer', 'askbot_anonymousanswer')
+ db.rename_table('forum_anonymousquestion', 'askbot_anonymousquestion')
+ db.rename_table('forum_emailfeedsetting', 'askbot_emailfeedsetting')
+ db.rename_table('forum_markedtag', 'askbot_markedtag')
+ db.rename_table('forum_questionview', 'askbot_questionview')
+ db.rename_table('forum_validationhash', 'askbot_validationhash')
+ except:
+ pass
def backwards(self, orm):
- if app_dirname == 'forum':
+ if app_dir_name == 'forum':
db.rename_table('askbot_anonymousanswer', 'forum_anonymousanswer')
db.rename_table('askbot_anonymousquestion', 'forum_anonymousquestion')
db.rename_table('askbot_emailfeedsetting', 'forum_emailfeedsetting')
diff --git a/askbot/migrations/0018_add___status__field_to_user_model.py b/askbot/migrations/0018_add___status__field_to_user_model.py
index 5a713866..b30f30d7 100644
--- a/askbot/migrations/0018_add___status__field_to_user_model.py
+++ b/askbot/migrations/0018_add___status__field_to_user_model.py
@@ -3,21 +3,19 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'User.status'
- try:
- db.add_column(
- u'auth_user',
- 'status',
- self.gf('django.db.models.fields.CharField')(default ='w', max_length = 2),
- keep_default=False
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'status',
+ self.gf('django.db.models.fields.CharField')(default ='w', max_length = 2),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py b/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
index 4cd05f83..8b6002bf 100644
--- a/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
+++ b/askbot/migrations/0026_add_seen_and_new_response_counts_to_user.py
@@ -3,16 +3,14 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding fields
- try:
- db.add_column('auth_user', 'new_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
- db.add_column('auth_user', 'seen_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
- except:
- pass
+ safe_add_column('auth_user', 'new_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
+ safe_add_column('auth_user', 'seen_response_count', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
def backwards(self, orm):
# Deleting fields
diff --git a/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py b/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
index 580c2f25..e5a10faf 100644
--- a/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
+++ b/askbot/migrations/0033_add__consecutive_days_visit_count__to__auth_user.py
@@ -3,21 +3,19 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'User.consecutive_days_visit_count'
- try:
- db.add_column(
- u'auth_user',
- 'consecutive_days_visit_count',
- self.gf('django.db.models.fields.IntegerField')(default = 0, max_length = 2),
- keep_default=False
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'consecutive_days_visit_count',
+ self.gf('django.db.models.fields.IntegerField')(default = 0, max_length = 2),
+ keep_default=False
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0035_add_country_fields_to_user.py b/askbot/migrations/0035_add_country_fields_to_user.py
index 02dd404c..340883ba 100644
--- a/askbot/migrations/0035_add_country_fields_to_user.py
+++ b/askbot/migrations/0035_add_country_fields_to_user.py
@@ -3,17 +3,15 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model country fields to the model auth_user
- try:
- db.add_column(u'auth_user', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, blank=True, null=True))
- db.add_column(u'auth_user', 'show_country', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True))
- except:
- pass
+ safe_add_column(u'auth_user', 'country', self.gf('django_countries.fields.CountryField')(max_length=2, blank=True, null=True))
+ safe_add_column(u'auth_user', 'show_country', self.gf('django.db.models.fields.BooleanField')(default=False, blank=True))
def backwards(self, orm):
diff --git a/askbot/migrations/0037_add_marked_tags_to_user_profile.py b/askbot/migrations/0037_add_marked_tags_to_user_profile.py
index f10f53be..306e16e6 100644
--- a/askbot/migrations/0037_add_marked_tags_to_user_profile.py
+++ b/askbot/migrations/0037_add_marked_tags_to_user_profile.py
@@ -3,18 +3,16 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'interesting_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- # Adding field 'User.ignored_tags'
- db.add_column(u'auth_user', 'ignored_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- except:
- pass
+ # Adding field 'User.interesting_tags'
+ safe_add_column(u'auth_user', 'interesting_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
+ # Adding field 'User.ignored_tags'
+ safe_add_column(u'auth_user', 'ignored_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
def backwards(self, orm):
diff --git a/askbot/migrations/0038_add_tag_filter_strategies.py b/askbot/migrations/0038_add_tag_filter_strategies.py
index c2596366..a24d12bf 100644
--- a/askbot/migrations/0038_add_tag_filter_strategies.py
+++ b/askbot/migrations/0038_add_tag_filter_strategies.py
@@ -4,29 +4,27 @@ from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from askbot import const
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model country fields to the model auth_user
- try:
- db.add_column(
- u'auth_user',
- 'email_tag_filter_strategy',
- self.gf(
- 'django.db.models.fields.SmallIntegerField'
- )(default = const.EXCLUDE_IGNORED)
- )
- db.add_column(
- u'auth_user',
- 'display_tag_filter_strategy',
- self.gf(
- 'django.db.models.fields.SmallIntegerField'
- )(default = const.INCLUDE_ALL)
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'email_tag_filter_strategy',
+ self.gf(
+ 'django.db.models.fields.SmallIntegerField'
+ )(default = const.EXCLUDE_IGNORED)
+ )
+ safe_add_column(
+ u'auth_user',
+ 'display_tag_filter_strategy',
+ self.gf(
+ 'django.db.models.fields.SmallIntegerField'
+ )(default = const.INCLUDE_ALL)
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py b/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
index 4a8140a4..7582dc04 100644
--- a/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
+++ b/askbot/migrations/0043_add_temporal_extra_column_for_datamigration.py
@@ -3,14 +3,12 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- db.add_column(u'auth_user', 'avatar_type', self.gf('django.db.models.fields.CharField')(max_length=1, default='n'), keep_default=False)
- except:
- pass
+ safe_add_column(u'auth_user', 'avatar_type', self.gf('django.db.models.fields.CharField')(max_length=1, default='n'), keep_default=False)
def backwards(self, orm):
db.delete_column(u'auth_user', 'avatar_type')
diff --git a/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py b/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
index d84666fb..7f7ff971 100644
--- a/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
+++ b/askbot/migrations/0122_auth_user__add_subscribed_tag_field.py
@@ -3,15 +3,13 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'subscribed_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
- except:
- pass
+ # Adding field 'User.interesting_tags'
+ safe_add_column(u'auth_user', 'subscribed_tags', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
def backwards(self, orm):
# Deleting field 'User.interesting_tags'
diff --git a/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py b/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
index b5a1e0c9..11b891da 100644
--- a/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
+++ b/askbot/migrations/0124_auto__add_field_post_is_private__add_field_replyaddress_reply_action.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -10,14 +11,14 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Post.is_private'
db.start_transaction()
- db.add_column('askbot_post', 'is_private',
- self.gf('django.db.models.fields.BooleanField')(default=False),
- keep_default=False)
+ safe_add_column('askbot_post', 'is_private',
+ self.gf('django.db.models.fields.BooleanField')(default=False),
+ keep_default=False)
# Adding field 'ReplyAddress.reply_action'
- db.add_column('askbot_replyaddress', 'reply_action',
- self.gf('django.db.models.fields.CharField')(default='auto_answer_or_comment', max_length=32),
- keep_default=False)
+ safe_add_column('askbot_replyaddress', 'reply_action',
+ self.gf('django.db.models.fields.CharField')(default='auto_answer_or_comment', max_length=32),
+ keep_default=False)
# Changing field 'ReplyAddress.post'
db.alter_column('askbot_replyaddress', 'post_id', self.gf('django.db.models.fields.related.ForeignKey')(null=True, to=orm['askbot.Post']))
@@ -26,7 +27,7 @@ class Migration(SchemaMigration):
try:
db.start_transaction()
# Adding field 'User.interesting_tags'
- db.add_column(u'auth_user', 'email_signature', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
+ safe_add_column(u'auth_user', 'email_signature', self.gf('django.db.models.fields.TextField')(blank=True, default = ''), keep_default=False)
db.commit_transaction()
except:
db.rollback_transaction()
diff --git a/askbot/migrations/0125_add_show_tags_field_to_user.py b/askbot/migrations/0125_add_show_tags_field_to_user.py
index cb7ab2bd..fc299d18 100644
--- a/askbot/migrations/0125_add_show_tags_field_to_user.py
+++ b/askbot/migrations/0125_add_show_tags_field_to_user.py
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
@@ -10,16 +11,13 @@ class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model show_marked_tags fields to the model auth_user
- try:
- db.add_column(
- u'auth_user',
- 'show_marked_tags',
- self.gf(
- 'django.db.models.fields.BooleanField'
- )(default=True, blank=True)
- )
- except:
- pass
+ safe_add_column(
+ u'auth_user',
+ 'show_marked_tags',
+ self.gf(
+ 'django.db.models.fields.BooleanField'
+ )(default=True, blank=True)
+ )
def backwards(self, orm):
diff --git a/askbot/migrations/0126_add_field__auth_user__is_fake.py b/askbot/migrations/0126_add_field__auth_user__is_fake.py
index e0928ed7..783d1e27 100644
--- a/askbot/migrations/0126_add_field__auth_user__is_fake.py
+++ b/askbot/migrations/0126_add_field__auth_user__is_fake.py
@@ -1,17 +1,14 @@
# -*- coding: utf-8 -*-
from south.db import db
from south.v2 import SchemaMigration
+from askbot.migrations_api import safe_add_column
class Migration(SchemaMigration):
def forwards(self, orm):
- try:
- # Adding field 'User.is_fake'
- db.add_column(
- u'auth_user', 'is_fake',
- self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
- except:
- pass
+ safe_add_column(
+ u'auth_user', 'is_fake',
+ self.gf('django.db.models.fields.BooleanField')(default=False), keep_default=False)
def backwards(self, orm):
db.delete_column('auth_user', 'is_fake')