owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

🔨 (db) add chart_configs table

Open sophiamersmann opened this issue 7 months ago • 1 comments

Summary

Adds a chart_configs table to the database. Shouldn't result in any functionality change.

Also adds a set of triggers that automatically update charts.slug, charts.type and charts.isPublished if a new charts row is inserted or a chart_configs row is updated.

Notes

  • For now, patchConfig = config for all chart config entries since inheritance hasn't been implemented yet

To do

  • [ ] Is it safe to rewrite the config's id?
  • [ ] Update the codebase to make it work with the new database structure
  • [ ] Do we need createdAt and updatedAt on both the chart_configs and the charts table?

To do before merging

  • [ ] Changing the db schema check list
  • [ ] Let Mojmir know and check if this affects the ETL in any way
  • [ ] If the worst case happens and all configs are dropped, how would we recover them?

To do after merging

  • [ ] Add the new table to Datasette

Next steps

The next thing I'll do is add the default config to the chart_configs table and make it so that all charts implicitly inherit from the default config.

sophiamersmann avatar Jul 03 '24 16:07 sophiamersmann