Homestyx hydra

R1:5b463e634ccf

Write fewer "applied" rows and clean up excess historical rows

Summary:
- Only write the <ruleID, phid> row if the rule is a one-time rule.
- Delete all the rows for rules which aren't one-time.

NOTE: This is probably like several million rows for Facebook and could take a
while.

Test Plan:
Added some one-time and every-time rules, ran them against objects, verified
only relevant rows were inserted.
Ran upgrade script against a database with one-time and every-time "ruleapplied"
rows, got the…
Repository: R1 hydra
Commit Date: Jan 25 2012