diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-26 23:17:10 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2012-08-26 23:17:10 -0400 |
commit | 337302e494329a2387262a40efc538dc2a620ee3 (patch) | |
tree | e64792623ff426d08a8bbf46f2630cf3d2d007a2 /askbot/migrations_api | |
parent | 41a23a3a8e9adaf1b877c49f8d0d5eab007ae693 (diff) | |
download | askbot-337302e494329a2387262a40efc538dc2a620ee3.tar.gz askbot-337302e494329a2387262a40efc538dc2a620ee3.tar.bz2 askbot-337302e494329a2387262a40efc538dc2a620ee3.zip |
broken commit - migration 137 fails!
Diffstat (limited to 'askbot/migrations_api')
-rw-r--r-- | askbot/migrations_api/__init__.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/askbot/migrations_api/__init__.py b/askbot/migrations_api/__init__.py index 1e213613..586c02d9 100644 --- a/askbot/migrations_api/__init__.py +++ b/askbot/migrations_api/__init__.py @@ -4,6 +4,23 @@ by mitigating absence of access to the django model api since models change with time, this api is implemented in different versions. Different versions do not need to have all the same functions. """ +from south.db import db + +def safe_add_column(table, column, column_data, keep_default = False): + """when user calls syncdb with askbot the first time + the auth_user table will be created together with the patched columns + so, we need to add these columns here in separate transactions + and roll back if they fail, if we want we could also record - which columns clash + """ + try: + db.start_transaction() + db.add_column(table, column, column_data, keep_default = keep_default) + db.commit_transaction() + return True + except: + db.rollback_transaction() + return False + class BaseAPI(object): def __init__(self, orm): |