[ckan-changes] commit/ckanext-harvest: dread: [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.

Bitbucket commits-noreply at bitbucket.org
Wed Aug 10 15:26:48 UTC 2011


1 new changeset in ckanext-harvest:

http://bitbucket.org/okfn/ckanext-harvest/changeset/d5d05c9e943b/
changeset:   d5d05c9e943b
user:        dread
date:        2011-08-10 17:25:57
summary:     [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.
affected #:  1 file (228 bytes)

--- a/ckanext/harvest/model/__init__.py	Fri Jul 29 11:31:03 2011 +0100
+++ b/ckanext/harvest/model/__init__.py	Wed Aug 10 16:25:57 2011 +0100
@@ -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 @@
 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):

Repository URL: https://bitbucket.org/okfn/ckanext-harvest/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list