Repository: paperless-ngx/paperless-ngx

Issue:
[BUG] Rollback doesn't work as described in the documentation
### Description

Rollback doesn't work properly as described in the documentation.

### Steps to reproduce

1. Go to 'https://docs.paperless-ngx.com/setup/#moving-back-to-paperless'
2. Open a terminal from the container and execute the command like mentioned at 'Or without docker:'
3. Error

### Webserver logs

```bash
root@ad747fe4e9e8:/usr/src/paperless/src# python3 manage.py migrate documents 0023
Operations to perform:
  Target specific migration: 0023_document_current_filename, from documents
Running migrations:
  Rendering model states... DONE
  Unapplying paperless_mail.0016_mailrule_consumption_scope... OK
  Unapplying paperless_mail.0015_alter_mailrule_action... OK
  Unapplying paperless_mail.0014_alter_mailrule_action... OK
  Unapplying paperless_mail.0013_merge_20220412_1051... OK
  Unapplying paperless_mail.0012_alter_mailrule_assign_tags... OK
  Unapplying paperless_mail.0011_remove_mailrule_assign_tag... OK
  Unapplying paperless_mail.0010_auto_20220311_1602... OK
  Unapplying paperless_mail.0009_mailrule_assign_tags... OK
  Unapplying paperless_mail.0009_alter_mailrule_action_alter_mailrule_folder... OK
  Unapplying paperless_mail.0008_auto_20210516_0940... OK
  Unapplying paperless_mail.0007_auto_20210106_0138... OK
  Unapplying paperless_mail.0006_auto_20210101_2340... OK
  Unapplying paperless_mail.0005_help_texts... OK
  Unapplying paperless_mail.0004_mailrule_order... OK
  Unapplying paperless_mail.0003_auto_20201118_1940... OK
  Unapplying paperless_mail.0002_auto_20201117_1334... OK
  Unapplying paperless_mail.0001_initial... OK
  Unapplying documents.1028_remove_paperlesstask_task_args_and_more... OK
  Unapplying documents.1027_remove_paperlesstask_attempted_task_and_more... OK
  Unapplying documents.1026_transition_to_celery...Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 357, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: NOT NULL constraint failed: new__documents_paperlesstask.name

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/paperless/src/manage.py", line 11, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.9/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/django/core/management/commands/migrate.py", line 349, in handle
    post_migrate_state = executor.migrate(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 141, in migrate
    state = self._migrate_all_backwards(plan, full_plan, fake=fake)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 219, in _migrate_all_backwards
    self.unapply_migration(states[migration], migration, fake=fake)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/executor.py", line 279, in unapply_migration
    state = migration.unapply(state, schema_editor)
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/migration.py", line 191, in unapply
    operation.database_backwards(
  File "/usr/local/lib/python3.9/site-packages/django/db/migrations/operations/fields.py", line 178, in database_backwards
    schema_editor.add_field(from_model, to_model._meta.get_field(self.name))
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/sqlite3/schema.py", line 397, in add_field
    self._remake_table(model, create_field=field)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/sqlite3/schema.py", line 333, in _remake_table
    self.execute(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/base/schema.py", line 199, in execute
    cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
  File "/usr/local/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 357, in execute
    return Database.Cursor.execute(self, query, params)
django.db.utils.IntegrityError: NOT NULL constraint failed: new__documents_paperlesstask.name
```


### Browser logs

_No response_

### Paperless-ngx version

1.11.3

### Host OS

Unraid 6.11.5

### Installation method

Docker - official image

### Browser

Firefox

### Configuration changes

_No response_

### Other

_No response_


Discussion:
Yeah, that's probably something which should be removed from the documentation.  I think it's only relevant from paperless-ng to paperless and was merely name changed during the fork.

Resolving patch:
diff --git a/src/documents/migrations/1022_paperlesstask.py b/src/documents/migrations/1022_paperlesstask.py
--- a/src/documents/migrations/1022_paperlesstask.py
+++ b/src/documents/migrations/1022_paperlesstask.py
@@ -24,7 +24,7 @@ class Migration(migrations.Migration):
                     ),
                 ),
                 ("task_id", models.CharField(max_length=128)),
-                ("name", models.CharField(max_length=256)),
+                ("name", models.CharField(max_length=256, null=True)),
                 (
                     "created",
                     models.DateTimeField(auto_now=True, verbose_name="created"),


Test patch: