From 1fc10fb32634acb232bde17ebb6131b7ddbbb81c Mon Sep 17 00:00:00 2001 From: David Read Date: Fri, 3 May 2019 12:43:20 +0100 Subject: [PATCH] No need to print migration message on fresh ckan install (eg travis) --- .../089_package_activity_migration_check.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ckan/migration/versions/089_package_activity_migration_check.py b/ckan/migration/versions/089_package_activity_migration_check.py index 01757ad9b46..f0f70b753a5 100644 --- a/ckan/migration/versions/089_package_activity_migration_check.py +++ b/ckan/migration/versions/089_package_activity_migration_check.py @@ -16,17 +16,23 @@ def upgrade(migrate_engine): should run the package activity migration, so that the Activity Stream can display the detailed history of datasets: - python migrate_package_activity.py -c /etc/ckan/production.ini + python migrate_package_activity.py -c /etc/ckan/production.ini Once you've done that, the detailed history is visible in Activity Stream to *admins only*. However you are encouraged to make it available to the public, by setting this in production.ini: - ckan.auth.public_activity_stream_detail = true + ckan.auth.public_activity_stream_detail = true More information about all of this is here: https://github.com/ckan/ckan/wiki/Migrate-package-activity '''.format(num_unmigrated=num_unmigrated_dataset_activities)) else: - print(u'You have no unmigrated package activities - you do not need to' - 'run migrate_package_activity.py.') + # there are no unmigrated package activities + are_any_datasets = bool( + migrate_engine.execute('SELECT id FROM PACKAGE LIMIT 1').rowcount) + # no need to tell the user if there are no datasets - this could just + # be a fresh CKAN install + if are_any_datasets: + print(u'You have no unmigrated package activities - you do not ' + 'need to run migrate_package_activity.py.')