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
Unknown Object (File)
Thu, Apr 11, 9:14 AM
Unknown Object (File)
Sun, Apr 7, 12:10 PM
Unknown Object (File)
Sun, Mar 31, 11:50 PM
Unknown Object (File)
Tue, Mar 26, 2:46 AM
Unknown Object (File)
Sat, Mar 23, 12:51 PM
Unknown Object (File)
Mar 14 2024, 6:11 PM
Unknown Object (File)
Mar 14 2024, 6:11 PM
Unknown Object (File)
Mar 14 2024, 6:11 PM
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