Squash migrations (#12830)

* Squash migrations for "users" app

* Squash migrations for "common" app

Note: we will come back again later to squash some more

* Significant squashing

* Update legacy migrations

* Further squashing of migrations

* Even more cleanup

* Adjust CI workflow

* Update CI Job

* Update docs

* Update CHANGELOG.md

* Cleanup old comments

* Throw error if pre 1.0.0 DB detected

* Refactor incomplete migration check
This commit is contained in:
Oliver
2026-09-11 16:03:41 +10:00
committed by GitHub
parent 028d1cba1f
commit c26db6a790
548 changed files with 5875 additions and 18451 deletions
+4
View File
@@ -107,10 +107,14 @@ For more information, refer to the installation guides:
- [Docker Installation](./start/docker_install.md#updating-inventree)
- [Bare Metal Installation](./start/install.md#updating-inventree)
- [Package Installer](./start/installer.md#updating-inventree)
!!! warning "Invoke Update"
You must ensure that the `invoke update` command is performed *every time* you update InvenTree
!!! danger "Updating from Pre 1.0.0"
If your installation is running a version of InvenTree older than `1.0.0`, you cannot update directly to the current release - see [Updating from Pre 1.0.0](./start/migrate.md#updating-from-pre-100) for the required intermediate step.
### Breaking Changes
Before performing an update, check the release notes! Any *breaking changes* (changes which require user intervention) will be clearly noted.
+5
View File
@@ -116,6 +116,11 @@ An error occurred while rendering a component in the frontend. Typically this is
The InvenTree server failed to start, because the configured server URL does not include a top-level domain (TLD). A valid TLD is required for proper operation.
#### INVE-E19
**Database stuck mid-way through pre-1.0.0 migration squash - Backend**
If your installation is currently running a version of InvenTree older than `1.0.0`, you must first update to the `1.0.0` release before updating further. See [Updating from Pre 1.0.0](../start/migrate.md#updating-from-pre-100) for the full upgrade procedure.
## Warning Codes
### INVE-W (InvenTree Warning)
+3
View File
@@ -118,6 +118,9 @@ This command launches the following containers:
To update your InvenTree installation to the latest version, follow these steps:
!!! danger "Updating from Pre 1.0.0"
If your installation is running a version of InvenTree older than `1.0.0`, you cannot update directly to the current release. See [Updating from Pre 1.0.0](./migrate.md#updating-from-pre-100) for the required intermediate step.
### Stop Containers
Stop all running containers as below:
+3
View File
@@ -289,6 +289,9 @@ Administrators wishing to update InvenTree to the latest version should follow t
!!! info "Update Database"
It is advisable to [backup the InvenTree database](./backup.md) before performing these steps. The particular backup procedure may depend on your installation details.
!!! danger "Updating from Pre 1.0.0"
If your installation is running a version of InvenTree older than `1.0.0`, you cannot update directly to the current release. See [Updating from Pre 1.0.0](./migrate.md#updating-from-pre-100) for the required intermediate step.
### Stop InvenTree Server
Ensure the InvenTree server is stopped. This will depend on the particulars of your database installation.
+3
View File
@@ -140,6 +140,9 @@ To change the data storage location, link the new location to `/opt/inventree/da
## Updating InvenTree
!!! danger "Updating from Pre 1.0.0"
If your installation is running a version of InvenTree older than `1.0.0`, you cannot update directly to the current release. See [Updating from Pre 1.0.0](./migrate.md#updating-from-pre-100) for the required intermediate step.
To update InvenTree run the following command, which updates the InvenTree package to the latest version:
```bash
+21
View File
@@ -2,6 +2,24 @@
title: Migrating Data
---
## Updating from Pre 1.0.0
!!! danger "Required Stopover"
As part of the 1.0.0 release cycle, InvenTree's database migration history was *squashed* - many individual migration files were consolidated into a smaller number of squashed migrations, and the original (now-redundant) migration files were subsequently removed from the codebase.
As a result, InvenTree cannot migrate a database directly from a version **older than 1.0.0** to the current release. Attempting to do so will cause `invoke update` (or `invoke migrate`) to fail.
If your installation is currently running a version of InvenTree older than `1.0.0`, you must first update to the `1.0.0` release, before updating to the current release.
### How to Update
1. Determine your current InvenTree version. If it is older than `1.0.0`, do not skip directly to the latest release.
2. Follow the normal update procedure for your installation method - [Bare Metal](./install.md#updating-inventree), [Docker](./docker_install.md#updating-inventree), or [Package Installer](./installer.md#updating-inventree) - targeting a `1.0.0` release.
3. Once the database has been successfully updated to `1.0.0`, repeat the update procedure again to bring the installation up to the current release.
!!! danger "Skipping Directly to Latest"
Attempting to update directly from a pre-1.0.0 database to the current release, skipping the `1.0.0` stopover, is not supported and will fail.
## Migrating Data to a Different Database
In the case that data needs to be migrated from one database installation to another, the following procedure can be used to export data, initialize the new database, and re-import the data. The following instructions apply to bare-metal and docker installations, although the particular commands required may vary slightly in each case.
@@ -100,6 +118,9 @@ Copy the entire directory tree from the original InvenTree installation to the n
If you are updating from an older version of InvenTree to a newer version, the migration steps outlined above *do not apply*.
!!! danger "Updating from Pre 1.0.0"
If your existing installation is running a version older than `1.0.0`, you cannot update directly to the current release. See [Updating from Pre 1.0.0](#updating-from-pre-100) above for the required intermediate step.
An update from an old version to a new one requires not only that the database *schema* are updated, but the *data* held within the database must be updated in the correct sequence.
Follow the sequence of steps below to ensure that the database records are updated correctly.