[model]: More careful about creating tables, since paster db upgrade loads the envrionment and therefore runs setup() before it does the migrations, and therefore in this instance we do not want to create the db tables.

This commit is contained in:
David Read 2011-08-10 16:25:57 +01:00
parent 7927329536
commit dd00e98d9d
1 changed files with 7 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import logging
import datetime
from ckan import model
from ckan.model.meta import *
from ckan.model.types import make_uuid
from ckan.model.core import *
@ -28,7 +29,12 @@ harvest_object_error_table = None
def setup():
if harvest_source_table is None:
create_harvester_tables()
metadata.create_all()
log.debug('Harvest tables defined in memory')
if model.repo.are_tables_created():
metadata.create_all()
log.debug('Harvest tables created')
else:
log.debug('Harvest table creation deferred')
class HarvestError(Exception):