fluidex/dingir-exchange

clean up migrations scripts

Opened this issue · 3 comments

Tejón Melero (@gcomte, tg hanle: subatomiq): The file 20210114140803_kline.sql exists in the 'migrations' folder as well as in the 'migrations/ts' folder. These files are identical. Why does it exist twice? I see the one in the 'ts' folder is being called in persist.rs, but does it even make sense to call this file multiple times? --> It contains CREATE TABLE queries ...

  • make it clear that the purpose of db_log and db_history
  • sort out what should be in "migrations/ts" and what should not be
  • we use db_log for operation_log (and slices) and config (assets/markets...)
  • we use db_history for states (history) and kline

MIGRATORs are a bit messy:

  • message::persist::MIGRATOR is related to persistor bin, and reads "./migrations/ts"
    • then seems we should also put all db_history stuff into "./migrations/ts"?
  • crate::persist may write to MQ or write to DB directly (so it connects both db_log and db_history), and reads "./migrations"

we should either fully combine these 2 DBs, or
use different endpoint for these 2 DBs and let them do their own jobs.

so that

  • db_log is involved with "operation_log (and slices) and config (assets/markets...)"-related scripts in "./migrations/"
  • db_history is involved with
    • "state_changes"-related scripts in "./migrations/" and
    • "kline"-related scripts in "./migrations/ts"