Compare commits

...
2 Commits
Author SHA1 Message Date
shamoon 6d249b4932 Bump version to 3.0.2 2026-07-23 18:12:59 -07:00
shamoonandGitHub 371c4f57d3 Fix: fix broken migration in 3.0.1 (#13242) 2026-07-23 17:59:03 -07:00
8 changed files with 57 additions and 33 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "paperless-ngx"
version = "3.0.1"
version = "3.0.2"
description = "A community-supported supercharged document management system: scan, index and archive all your physical documents"
readme = "README.md"
requires-python = ">=3.11"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "paperless-ngx-ui",
"version": "3.0.1",
"version": "3.0.2",
"scripts": {
"preinstall": "npx only-allow pnpm",
"ng": "ng",
+1 -1
View File
@@ -8,7 +8,7 @@ export const environment = {
apiVersion: '10', // match src/paperless/settings.py
appTitle: DEFAULT_APP_TITLE,
tag: 'prod',
version: '3.0.1',
version: '3.0.2',
webSocketHost: window.location.host,
webSocketProtocol: window.location.protocol == 'https:' ? 'wss:' : 'ws:',
webSocketBaseUrl: base_url.pathname + 'ws/',
+1 -1
View File
@@ -1,6 +1,6 @@
from typing import Final
__version__: Final[tuple[int, int, int]] = (3, 0, 1)
__version__: Final[tuple[int, int, int]] = (3, 0, 2)
# Version string like X.Y.Z
__full_version_str__: Final[str] = ".".join(map(str, __version__))
# Version string like X.Y
@@ -1,27 +0,0 @@
# Split out of 0002_optimize_integer_field_sizes.py into its own migration
# (own transaction). Running this UPDATE in the same transaction as the
# later ALTER TABLE on paperless_mail_mailrule can fail on PostgreSQL with
# "cannot ALTER TABLE because it has pending trigger events", since the
# update queues FK trigger events against that table that are still pending
# when the subsequent AlterField tries to rewrite it. Committing the clamp
# here first avoids that.
from django.db import migrations
def clamp_mailrule_maximum_age(apps, schema_editor):
# Clamp the maximum_age field of MailRule because of PositiveIntegerField --> PositiveSmallIntegerField
MailRule = apps.get_model("paperless_mail", "MailRule")
MailRule.objects.filter(maximum_age__gt=32767).update(maximum_age=32767)
class Migration(migrations.Migration):
dependencies = [
("paperless_mail", "0001_squashed"),
]
operations = [
migrations.RunPython(
clamp_mailrule_maximum_age,
migrations.RunPython.noop,
),
]
@@ -4,9 +4,19 @@ from django.db import migrations
from django.db import models
def clamp_mailrule_maximum_age(apps, schema_editor):
# Clamp the maximum_age field of MailRule because of PositiveIntegerField --> PositiveSmallIntegerField
MailRule = apps.get_model("paperless_mail", "MailRule")
MailRule.objects.filter(maximum_age__gt=32767).update(maximum_age=32767)
class Migration(migrations.Migration):
# The data update must commit before PostgreSQL rewrites the table, otherwise
# pending foreign-key trigger events can block the subsequent ALTER TABLE.
atomic = False
dependencies = [
("paperless_mail", "0001_1_clamp_mailrule_maximum_age"),
("paperless_mail", "0001_squashed"),
]
operations = [
@@ -112,6 +122,10 @@ class Migration(migrations.Migration):
verbose_name="consumption scope",
),
),
migrations.RunPython(
clamp_mailrule_maximum_age,
migrations.RunPython.noop,
),
migrations.AlterField(
model_name="mailrule",
name="maximum_age",
@@ -0,0 +1,37 @@
import importlib
from django.db import migrations
def test_optimize_integer_fields_preserves_released_migration_history():
migration_module = importlib.import_module(
"paperless_mail.migrations.0002_optimize_integer_field_sizes",
)
assert migration_module.Migration.dependencies == [
("paperless_mail", "0001_squashed"),
]
def test_mailrule_maximum_age_is_clamped_before_non_atomic_alter():
migration_module = importlib.import_module(
"paperless_mail.migrations.0002_optimize_integer_field_sizes",
)
migration = migration_module.Migration
clamp_index = next(
index
for index, operation in enumerate(migration.operations)
if isinstance(operation, migrations.RunPython)
and operation.code is migration_module.clamp_mailrule_maximum_age
)
alter_index = next(
index
for index, operation in enumerate(migration.operations)
if isinstance(operation, migrations.AlterField)
and operation.model_name == "mailrule"
and operation.name == "maximum_age"
)
assert migration.atomic is False
assert clamp_index < alter_index
Generated
+1 -1
View File
@@ -2880,7 +2880,7 @@ wheels = [
[[package]]
name = "paperless-ngx"
version = "3.0.1"
version = "3.0.2"
source = { virtual = "." }
dependencies = [
{ name = "azure-ai-documentintelligence", marker = "sys_platform == 'darwin' or sys_platform == 'linux'" },