mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-19 10:19:27 -05:00
Django migrations doesn't account for PostgreSQL completely
This was a weird bug to run into. Basically I changed a CharField into a ForeignKey field and ran `makemigrations` to get the job done. However, rather than doing a `RemoveField` and an `AddField`, migrations created a single `AlterField` which worked just fine in SQLite, but blew up in PostgreSQL with: psycopg2.ProgrammingError: operator class "varchar_pattern_ops" does not accept data type integer The fix was to rewrite the single migration into the two separate steps.
This commit is contained in:
parent
3a427c9130
commit
8bc2dfe4c6
@ -47,7 +47,11 @@ class Migration(migrations.Migration):
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.RunPython(move_sender_strings_to_sender_model),
|
migrations.RunPython(move_sender_strings_to_sender_model),
|
||||||
migrations.AlterField(
|
migrations.RemoveField(
|
||||||
|
model_name='document',
|
||||||
|
name='sender',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
model_name='document',
|
model_name='document',
|
||||||
name='sender',
|
name='sender',
|
||||||
field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='documents.Sender'),
|
field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.CASCADE, to='documents.Sender'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user