Skip to content

Commit

Permalink
Fix EventDocument migration for real now
Browse files Browse the repository at this point in the history
  • Loading branch information
DeD1rk committed Jun 22, 2023
1 parent 223e081 commit cdb32af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions website/events/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ruff: noqa: F403
from .documents import *
from .event import *
from .external_event import *
from .registration import *
10 changes: 5 additions & 5 deletions website/events/migrations/0068_eventdocument.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def populate_eventdocument(apps, schema_editor):
NewEventDocument.objects.create(
document_ptr=event_document.document_ptr,
owner=event_document.owner,
# For some reason, django INSERTs the existing Document row again (not only
# the new EventDocument row), but without the `created` field, as it's not
# actually creating a new Document. The DB doesn't allow this, as INSERT
# statements must specify all columns, and `created` is not nullable.
# So we can manually set created explicitly to solve this.
# For some reason we need to copy all fields, because
# Django uses an INSERT query on the Document table.
created=event_document.created,
file=event_document.file,
members_only=event_document.members_only,
name=event_document.name,
)


Expand Down

0 comments on commit cdb32af

Please sign in to comment.