diff options
author | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-03-04 15:47:05 -0600 |
---|---|---|
committer | Christopher Allan Webber <cwebber@dustycloud.org> | 2013-03-04 15:47:05 -0600 |
commit | f415c35b4ec5aebbc46bc6602a90ca29254838d6 (patch) | |
tree | ad66f33756f393fbeca2e25864a1d969b0c4c8e1 /mediagoblin/db/migration_tools.py | |
parent | 99a54c0095ccadcebeb640cb20cb6eadb8b9a39d (diff) | |
parent | f51a416778bc71ec373fac1cbfbf7df60815b68d (diff) | |
download | mediagoblin-f415c35b4ec5aebbc46bc6602a90ca29254838d6.tar.lz mediagoblin-f415c35b4ec5aebbc46bc6602a90ca29254838d6.tar.xz mediagoblin-f415c35b4ec5aebbc46bc6602a90ca29254838d6.zip |
Merge branch 'master' into 419_cherrypick_large_uploads
Diffstat (limited to 'mediagoblin/db/migration_tools.py')
-rw-r--r-- | mediagoblin/db/migration_tools.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mediagoblin/db/migration_tools.py b/mediagoblin/db/migration_tools.py index e5380a3b..c0c7e998 100644 --- a/mediagoblin/db/migration_tools.py +++ b/mediagoblin/db/migration_tools.py @@ -17,6 +17,9 @@ from mediagoblin.tools.common import simple_printer from sqlalchemy import Table +class TableAlreadyExists(Exception): + pass + class MigrationManager(object): """ @@ -128,7 +131,10 @@ class MigrationManager(object): # sanity check before we proceed, none of these should be created for model in self.models: # Maybe in the future just print out a "Yikes!" or something? - assert not model.__table__.exists(self.session.bind) + if model.__table__.exists(self.session.bind): + raise TableAlreadyExists( + u"Intended to create table '%s' but it already exists" % + model.__table__.name) self.migration_model.metadata.create_all( self.session.bind, |