Page MenuHomePhabricator

Simplify adding new database patches
ClosedPublic

Authored by epriestley on Jan 6 2014, 4:55 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 2:20 AM
Unknown Object (File)
Thu, Apr 11, 10:31 AM
Unknown Object (File)
Sat, Apr 6, 9:28 AM
Unknown Object (File)
Sat, Apr 6, 6:39 AM
Unknown Object (File)
Sat, Apr 6, 6:39 AM
Unknown Object (File)
Sat, Apr 6, 6:39 AM
Unknown Object (File)
Sat, Apr 6, 6:39 AM
Unknown Object (File)
Sat, Apr 6, 6:02 AM
Subscribers
Tokens
"Mountain of Wealth" token, awarded by btrahan.

Details

Reviewers
btrahan
Commits
Restricted Diffusion Commit
rPd32c09de4112: Simplify adding new database patches
Summary

Currently, to add new migration patches you need to:

  • Add a file to resources/sql/patches/; then
  • add an entry to src/infrastructure/storage/blahblah/BlahBlahBlah.php.

The second step isn't actually necessary, and we've been using this system for a long time without any issues arising.

Instead of requiring manual adjustments to the patch list, infer the patch specifications from the files on disk so you don't need to do step 2.

Also, simplify the existing data, which can mostly be derived from patch names. There are a few exceptions/errors, noted inline, which are preserved for compatibility.

Test Plan
  • For the new genration of name and type, I added code to check that the old and new values were the same before converting. This caught the two inline exceptions ("emailtableport", "drydockresouces").
  • Added new patches to autopatches/ and ran bin/storage status to verify they got picked up correctly.

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

epriestley updated this revision to Unknown Object (????).Jan 6 2014, 4:55 PM
  • Couple of last-second additions.
epriestley updated this revision to Unknown Object (????).Jan 6 2014, 5:15 PM
  • Simplify 'db' specifications.
  • Added and executed new patches (next revision).
  • Switched storage namespace and ran a complete upgrade from scratch.

Nice - I won't be able to make that mistake again! =D

src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
41

i think you should check in this empty autopatches folder / the next diff that has some autopatches. I think the Filesystem::listDirectory will throw exceptions if the folder isn't there.

src/infrastructure/storage/patch/PhabricatorBuiltinPatchList.php
41

Yeah, the mailKey thing populates this and I'll land it immediately after this.