feat(event-db): Revised Election-DB Schema (#145)
This should be a backward-compatible revision of the DB Schema used for Vit-SS but expanded to handle general elections, not just funds. The election-db crate is intended to be self contained, such that DB logic is only contained in this crate. The crate does not handle migrations, but it does check if the db schema it was built against is correct with respect to the db schema in the database, This schema is only intended to work on postgres, but it is intended in future that this crate may actually create a generic election information data source, so that we could retrieve this data from multiple data sources (web 2 and web 3) without changing the consuming code. `config_table.rs` is intentionally incomplete. It is an example of how the db operations should be encapsulated fully internally to this crate. It will be completed in a further round of work to this crate, and not this PR. There is a test to ensure the schema validation works, but its not great and I am open to suggestions of how we test it in CICD. It checks if the schema known to the crate has been fully applied to the connected DB. Tests we would need to fully test it: 1. Test all combinations of db connection strings, env vars, and ,env files work as expected (Valid, invalid and not set). Also needs to test that Parameter has priority over env var which has priority over the .env file. And that when an error is returned, its meaningful and sensible. 2. Test that when the migrations are only partially applied, that is detected and an error returned listing the missing migrations. 3. Test that when an unknown migration is applied to the db, that an error is returned listing the unknown migrations. 4. A combination of 2 & 3. ps. Given the nature of this PR, I made this a draft so it can have a full round of review, and approval will not auto merge. But its not a draft, other than the notes above, it should be complete. I will merge when reviews are complete.