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)
Sat, Nov 23, 2:58 PM
Unknown Object (File)
Sun, Nov 3, 10:07 AM
Unknown Object (File)
Oct 24 2024, 2:05 PM
Unknown Object (File)
Oct 19 2024, 12:31 PM
Unknown Object (File)
Oct 15 2024, 11:56 PM
Unknown Object (File)
Oct 14 2024, 10:27 AM
Unknown Object (File)
Sep 26 2024, 2:56 PM
Unknown Object (File)
Sep 3 2024, 9:38 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