Page MenuHomePhabricator

Update a very old Phriction migration which incorrectly uses "save()"
ClosedPublic

Authored by epriestley on Apr 15 2020, 3:03 PM.
Tags
None
Referenced Files
F17773221: D21124.id50306.diff
Wed, Jul 23, 5:14 PM
F17744177: D21124.diff
Mon, Jul 21, 3:23 PM
F17732127: D21124.id.diff
Sun, Jul 20, 3:54 AM
Unknown Object (File)
May 26 2025, 6:25 AM
Unknown Object (File)
May 10 2025, 12:38 AM
Unknown Object (File)
May 6 2025, 10:40 AM
Unknown Object (File)
Apr 10 2025, 6:36 PM
Unknown Object (File)
Apr 7 2025, 4:44 AM
Subscribers
Restricted Owners Package

Details

Summary

See https://discourse.phabricator-community.org/t/storage-upgrade-error/3748.

It is broadly unsafe for migrations to use "save()". If the object gains new fields later, the query will include "SET newField = X", which will fail against the old schema which is in the process of being upgraded.

Instead, migrations must issue raw SQL against the schema as it is expected to exist at the time the migration executes.

Migrations have followed this rule for a long time, but this ~6 year old migration was overlooked. Update it to issue a raw query to perform the policy update.

Test Plan

This is somewhat flimsy since rebuilding a genuine reproduction case is messy, but used "bin/storage --apply ..." to at least get the new query to execute against modern Phabricator without issues.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable