owid-grapher
owid-grapher copied to clipboard
🔨 (db) add chart_configs table
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
andupdatedAt
on both thechart_configs
and thecharts
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.