-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alter entity spec version and add branchId, trunkVersion in form sche…
…ma (#1210) * XML schema method to alter entity spec version and add branchId, trunkVersion * Dont replace xml if entities-version doesnt match expected old version * minor code improvements * worker wip * working with published and draft forms separately * update version in a draft * more tests * More test and code refinement * moving args around * Migration and test * change suffix and exclude deleted forms/projects * moving code around * changing code and tests * responding to code review
- Loading branch information
Showing
10 changed files
with
1,021 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
lib/model/migrations/20241010-01-schedule-entity-form-upgrade.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2024 ODK Central Developers | ||
// See the NOTICE file at the top-level directory of this distribution and at | ||
// https://github.com/getodk/central-backend/blob/master/NOTICE. | ||
// This file is part of ODK Central. It is subject to the license terms in | ||
// the LICENSE file found in the top-level directory of this distribution and at | ||
// https://www.apache.org/licenses/LICENSE-2.0. No part of ODK Central, | ||
// including this file, may be copied, modified, propagated, or distributed | ||
// except according to the terms contained in the LICENSE file. | ||
|
||
const up = (db) => db.raw(` | ||
INSERT INTO audits ("action", "acteeId", "loggedAt", "details") | ||
SELECT 'upgrade.process.form.entities_version', forms."acteeId", clock_timestamp(), | ||
'{"upgrade": "As part of upgrading Central to v2024.3, this form is being updated to the latest entities-version spec."}' | ||
FROM forms | ||
JOIN form_defs fd ON forms."id" = fd."formId" | ||
JOIN dataset_form_defs dfd ON fd."id" = dfd."formDefId" | ||
JOIN projects ON projects."id" = forms."projectId" | ||
WHERE dfd."actions" @> '["update"]' | ||
AND forms."deletedAt" IS NULL | ||
AND projects."deletedAt" IS NULL | ||
GROUP BY forms."acteeId"; | ||
`); | ||
|
||
const down = () => {}; | ||
|
||
module.exports = { up, down }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.