Skip to content

Work out how to automate and formalise custom DB changes in medic-analytics #8

@SCdF

Description

@SCdF

The medic-analytics code alters the DB schema to create various tables and views. It also refreshes all existing materialised views in the database at the end of each run. It makes schema alterations by running migration scripts on startup. These scripts get baked into each release.

Tech leads need to be able to alter the DB schema per project, to create their own views (materialised or not). They may also need to add their own custom indexes to existing tables.

We need to think up some mechanism for them to do that in a way that is more formal than "here is the DB credentials go nuts". Though I'm not against it as a plan z.

This problem is somewhat like app settings. But, you can't take back a migration. This means you cannot "wholesale" replace migrations like you can with app settings.

Here are some off-the-cuff options:

  • Alter medic-analytics to support a configurable third-party migration directory on the server. Tech leads would upload their scripts to this directory. The code would either listen for changes and execute them, or it would occur on startup. Tech leads would self-manage their scripts in git.
  • Create an app for each client to contain migrations. This would be a fork of a skeleton project, that boots, check for migrations and runs them, then closes. There would be tests to make sure that these migrations sit correctly on top of medic-analtyics. It would run on medic-os like medic-analytics does, with the same credentials. This would force you to version and check in your schema changes. You would need to store them in medic-projects

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions