diff --git a/src/main/resources/database/changelog-master.yml b/src/main/resources/database/changelog-master.yml index 54259a2fc..7f17c066d 100644 --- a/src/main/resources/database/changelog-master.yml +++ b/src/main/resources/database/changelog-master.yml @@ -45,7 +45,7 @@ databaseChangeLog: - include: file: database/changes/release-13/changelog.yml - + # When adding new groups of migrations to this file the numbers are arbitrary, please follow the following format for # all migrations after this point, using the the format "release-$NEXT_NUMBER". Incrementing $NEXT_NUMBER each # time. diff --git a/src/main/resources/database/changes/release-14/changelog.yml b/src/main/resources/database/changes/release-14/changelog.yml new file mode 100644 index 000000000..c934f7eec --- /dev/null +++ b/src/main/resources/database/changes/release-14/changelog.yml @@ -0,0 +1,11 @@ +databaseChangeLog: + + - changeSet: + id: 14.1 + author: Jon Fox + changes: + - sqlFile: + comment: update existing events with correct status + path: update_existing_events_status.sql + relativeToChangelogFile: true + splitStatements: false diff --git a/src/main/resources/database/changes/release-14/update_existing_events_status.sql b/src/main/resources/database/changes/release-14/update_existing_events_status.sql new file mode 100644 index 000000000..410f1d639 --- /dev/null +++ b/src/main/resources/database/changes/release-14/update_existing_events_status.sql @@ -0,0 +1,11 @@ +UPDATE collectionexercise.event AS e +SET status = 'SCHEDULED' +WHERE e.status = 'NOT_SET' + AND e.timestamp >= now() + AND e.timestamp IS NOT NULL; + +UPDATE collectionexercise.event AS e +SET status = 'PROCESSED' +WHERE e.status = 'NOT_SET' + AND e.timestamp < now() + AND e.timestamp IS NOT NULL;