-
Notifications
You must be signed in to change notification settings - Fork 308
keep track of funding goal changes #141
Comments
TODO: * Tests * Migration of current `goal` field to goals table entry for each user * Removing the `goal` column from participant
There is a |
Per verbal discussion, let's go with the latter option (no |
Per verbal discussion, @whit537 is going to take it from here. He offered to write the migration SQL and I gladly accepted said offer. |
!m @dowski Next steps:
|
I've reviewed #745. See comments inline. |
I've merged #745 into a "goals" branch, which is pushed up here. |
|
Postgres has a feature called "rules," where we can rewrite queries based on certain conditions. I've decided to implement #141 using a rule. Starting with the example here: http://www.postgresql.org/docs/9.1/static/rules-update.html this commit adds a rule to log changes to the participant.goal column to a separate `goals` table. This means that we can keep the simplicity of reading and writing that value as we've always done, *and* we can have a detailed log of changes to drive more advanced visualizations. Huzzah! :D
The Goal model is only needed right now by the test suite, and there only to ensure that the database is torn down properly. I'm actually a little nervous having this object around, because the `goals` table should be considered immutable. Harumph.
This dodges a race condition where we could fail to log some goal changes.
Let's try out this pattern: feature branches should collect new SQL statements in a branch.sql file, and if this exists we'll apply it during makedb.sh. That should avoid some conflicts when merging from master out to feature branches, as well as making it clearer that branch.sql is a work in progress.
I considered adding NULL records to the goals table for all participants (or perhaps all claimed participants) but decided against it. As with |
Okay! The |
I've run this against the production database.c
We did make one small code change with this, porting goals.json to use the ORM. That's now deployed. Case closed! !m @dowski |
I meant to make funding goal (#110) immutable like tips but forgot.
That is, it should be an insert into a "goals" table instead of updating a column in participants. Then we can show how funding goals evolve over time, which is an important part of telling the story in numbers.
The text was updated successfully, but these errors were encountered: