Beim Update auf die stabile Version (v2.7.8) im ersten Container war SKIP_POST_DEPLOYMENT_MIGRATIONS aktiviert.
Beim zweiten Durchlauf im anderen Container, bei dem die Skip-Option deaktiviert war, schlug die Migration CorrectlyMoveAssignmentsFromCustomFieldsToATable fehl:
PG::NotNullViolation: ERROR: null value in column "assigned_to_type"
of relation "assignments" violates not-null constraint
Soweit ich das überblicke, sollte die Upgrade-Aufgabe AddAssignedToTypeToAssignments (die die Not-Null-Einschränkung erstellt) erst ausgeführt werden, nachdem CorrectlyMoveAssignmentsFromCustomFieldsToATable abgeschlossen ist.
Als Workaround habe ich Folgendes durchgeführt:
INSERT INTO assignments
(assigned_to_id, assigned_by_user_id, topic_id, created_at, updated_at,assigned_to_type)
SELECT
assigned_to.value::integer,
assigned_by.value::integer,
assigned_by.topic_id,
assigned_by.created_at,
assigned_by.updated_at,
'User'
FROM topic_custom_fields assigned_by
INNER JOIN topic_custom_fields assigned_to
ON assigned_to.topic_id = assigned_by.topic_id
WHERE assigned_by.name = 'assigned_by_id'
AND assigned_to.name = 'assigned_to_id'
ORDER BY assigned_by.created_at DESC
ON CONFLICT DO NOTHING;
INSERT INTO schema_migration_details
(version,
name,
hostname,
git_version,
rails_version,
duration,
direction,
created_at)
values(
'20210714173022',
'CorrectlyMoveAssignmentsFromCustomFieldsToATable',
'ce4fb45daf62',
'98b0621d538fa4e8a53e1e74127c24c384be9b58',
'6.1.3.2',
0,
'up',
'2021-09-28 15:20:00.123456'
);
INSERT INTO schema_migrations values('20210714173022');
Anschließend konnte ich den Container neu aufbauen.