Repository navigation
feat(backend): ensure restore of backups only works in correct enviroments - #11372
Conversation
✅ Deploy Preview for inventree-web-pui-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Merging this PR will improve performance by 11.3%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_search_performance[stockitem] |
108 ms | 100 ms | +8.05% |
| ⚡ | WallTime | test_api_options_performance[/api/order/po-line/] |
154 ms | 142.5 ms | +8.11% |
| ⚡ | WallTime | test_search_performance[build] |
35 ms | 32.6 ms | +7.44% |
| ⚡ | WallTime | test_api_list_performance[/api/build/item/] |
316.6 ms | 291.3 ms | +8.68% |
| ⚡ | WallTime | test_api_options_performance[/api/build/line/] |
392.4 ms | 352.6 ms | +11.3% |
| ⚡ | WallTime | test_api_options_performance[/api/build/item/] |
320.8 ms | 294.1 ms | +9.1% |
| ⚡ | WallTime | test_api_options_performance[/api/order/so/] |
53.9 ms | 50.7 ms | +6.44% |
Comparing matmair:matmair/issue11214 (21e402f) with master (246108e)1
Footnotes
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #11372 +/- ##
==========================================
+ Coverage 87.99% 88.02% +0.02%
==========================================
Files 1295 1295
Lines 58793 58917 +124
Branches 1938 1941 +3
==========================================
+ Hits 51733 51859 +126
+ Misses 6578 6574 -4
- Partials 482 484 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
there is no realy db dep here
|
Nice work, and great job getting the functionality merged upstream. dbbackup versionHave we already updated to the required version of django-dbbackup? There is no version bump in this PR? docsIt would be great to add a brief paragraph to the backup docs regarding compatibility |
yes, that was included in the latest bump (5.2.0 included the change)
This PR mostly prevents footguns, there is no functional change other than (by default) stopping restores from newer versions. I will add a short section on some basic restrictions. Real world functional decencies will probably only enter with #11235 |
|
@matmair fair enough - if you can submit some brief docs too that would be great, but happy to merge this now |
…ments (inventree#11372) * [FR] ensure restore of backups only works in correct enviroments Fixes inventree#11214 * update PR nbr * fix wrong ty detection * fix link * ensure tracing does not enagage while running backup ops * fix import * remove debugging string * add error codes * add tests for backup and restore * complete test for restore * we do not need e2e on every matrix entry there is no realy db dep here * fix changelog format * add flag to allow bypass
* add "updated_at" field to PurchaseOrder model * change to use abstract po instead * add api filters * add show, order and filter by po updated_at date to frontend * add tests and increment api_version * change updated_at to null by default * never trust github conflict resolution * bump docker image to python 3.14 (#11414) * chore(deps): bump the dependencies group across 1 directory with 4 updates (#11416) Bumps the dependencies group with 4 updates in the / directory: [depot/setup-action](https://github.com/depot/setup-action), [depot/build-push-action](https://github.com/depot/build-push-action), [anchore/sbom-action](https://github.com/anchore/sbom-action) and [actions/stale](https://github.com/actions/stale). Updates `depot/setup-action` from 1.6.0 to 1.7.1 - [Release notes](https://github.com/depot/setup-action/releases) - [Commits](depot/setup-action@b0b1ea4...15c09a5) Updates `depot/build-push-action` from 1.16.2 to 1.17.0 - [Release notes](https://github.com/depot/build-push-action/releases) - [Commits](depot/build-push-action@9785b13...5f3b3c2) Updates `anchore/sbom-action` from 0.21.1 to 0.22.2 - [Release notes](https://github.com/anchore/sbom-action/releases) - [Changelog](https://github.com/anchore/sbom-action/blob/main/RELEASE.md) - [Commits](anchore/sbom-action@0b82b0b...28d7154) Updates `actions/stale` from 10.1.1 to 10.2.0 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](actions/stale@9971854...b5d41d4) --- updated-dependencies: - dependency-name: depot/setup-action dependency-version: 1.7.1 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: depot/build-push-action dependency-version: 1.17.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: anchore/sbom-action dependency-version: 0.22.2 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies - dependency-name: actions/stale dependency-version: 10.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: dependencies ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [UI] Copy cells expansion (#11410) * Prevent copy button if copy value is null * Add "link" columns to order tables * Support copy for default column types * Tweak padding to avoid flickering issues * Refactor IPNColumn * Adjust visual styling * Copy for SKU and MPN columns * Add more copy columns * More tweaks * Tweak playwright testing * Further cleanup * More copy cols * Fix auto pricing overwriting manual purchase price #10846 (#11411) * Fix auto pricing overwriting manual purchase price #10846 * Added entry to api_version.py --------- Co-authored-by: Oliver <[email protected]> * [UI] Default locale (#11412) * [UI] Support default server language * Handle faulty theme * Add option for default language * Improve language selection * Brief docs entry * Fix typo * Fix yarn build * Remove debug msg * Fix calendar locale * feat(backend): ensure restore of backups only works in correct enviroments (#11372) * [FR] ensure restore of backups only works in correct enviroments Fixes #11214 * update PR nbr * fix wrong ty detection * fix link * ensure tracing does not enagage while running backup ops * fix import * remove debugging string * add error codes * add tests for backup and restore * complete test for restore * we do not need e2e on every matrix entry there is no realy db dep here * fix changelog format * add flag to allow bypass * update CHANGELOG.md --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Oliver <[email protected]> Co-authored-by: Matthias Mair <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JustusRijke <[email protected]>

This uses a new function I upstreamed in dbbackup to allow us checking various environment markers.
The names of variables are chosen in a manner to keep long-term restore compatibility in place as we might evolve this schema. It is no rocket science but should help with some common issues, especially if we get logs for debugging.
To-do:
Fixes #11214