Ghost/core/server/data/schema
Daniel Lockyer ddaa4ee5e1 Removed unnecessary checks during initial DB init
refs https://github.com/TryGhost/Toolbox/issues/202

- during DB init, we have to create all the tables
- right now we loop over all tables and call the `createTable` command
  - this command checks if the table exists and if not, creates the table
  - this works fine but it means we query the database for every table
  - in MySQL, we query the information_schema table, which we've seen
    issues with before because it doesn't have indexes
- the smarter thing to do here is to get all the tables that already exist,
  remove them from the list, and just straight up create them without
  further checks
- this entire thing should be protected by the migration lock so we
  shouldn't encounter issues from multiple processes initializing the DB
  and tables existing after the initial check
- this commit also removes the check from `createTable` because this isn't
  really needed. We should be using the migration utils, which do
  check for existing tables. I've added a note to the function and
  audited anywhere we still call the function
- this commit removes (- 49 tables + 1 initial check) 48 queries from
  the initial DB init
2022-02-21 08:44:40 +01:00
..
clients Fixed "no-shadow" linting error in server/data modules (#12288) 2020-10-20 11:56:46 +13:00
default-settings Made default settings file location configurable 2022-02-21 20:06:20 +13:00
fixtures Added active column to products table (#14016) 2022-01-20 15:50:18 +02:00
checks.js Update Test & linting packages (major) (#10858) 2019-07-05 13:40:43 +02:00
commands.js Removed unnecessary checks during initial DB init 2022-02-21 08:44:40 +01:00
index.js Moved schema validator into the schema module 2021-06-15 11:54:34 +01:00
schema.js Added the last_seen_at column to members 2022-02-09 11:57:45 +01:00
validator.js Switch to @trghost/validator, remove validator 2021-06-16 08:11:22 +01:00