Ghost/test/regression
Kevin Ansfield f45198245f Updated Settings.populateDefaults() to account for available columns
refs https://github.com/TryGhost/Ghost/issues/10318

`Settings.populateDefaults()` is run before migrations during Ghost's startup. This can cause problems when new settings table columns are added (and populated in `default-settings.json`) because `populateDefaults()` was using the model layer which assumes that those columns are available, resulting in `ER_BAD_FIELD_ERROR: Unknown column` type errors.

- query the database for the available `settings` table columns
- switch to using raw knex queries without Bookshelf for insertions so that we're in control of the columns that are added
- use `_.pick` to skip any properties in `default-settings.json` that do not match to an available column - those columns will be added and populated by later migrations
- moving away from using the model to insert settings has the side-effect of not emitting `settings.added/edited` and `settings.x.added/edited` events, this should be fine because `populateDefaults()` is called before anything else is set up and listening
- added a call to `populateDefaults()` in our knex-migrator "before migration" hook so that we have consistent db state across both startup initialised migrations and manually triggered knex migrations
2020-06-29 13:22:10 +00:00
..
api Updated settings API v3 tests to check for correct types returned for specific keys 2020-06-25 17:36:10 +12:00
exporter Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
importer Fixed importer mapping for renamed default_locale, active_timezone, ghost_* settings 2020-06-24 14:19:52 +12:00
migrations Fixed broken regression tests from #11861 2020-06-02 16:20:57 +02:00
models Updated Settings.populateDefaults() to account for available columns 2020-06-29 13:22:10 +00:00
site 🐛 Fixed custom redirects for subdirectory setups 2020-06-16 10:24:13 +02:00
update-check Updated var declarations to const/let and no lists 2020-04-29 16:51:13 +01:00
README.md Move tests from core to root (#11700) 2020-03-30 16:26:47 +01:00

Regression Tests

This folder should contain packages which we test in a cron job once per day. These tests should ensure that we don't break Ghost.

The goal is that most of these packages use Ghost's API's to test behaviours, otherwise transform the tests into unit tests.