Ghost/core/server/data/schema
Thibaut Patel 2bfd8f8b7e
Added the post-newsletter relation (#14411)
refs https://github.com/TryGhost/Team/issues/1471

- This is a many-to-one relation so that many posts can be linked to a specific newsletter
- The `newsletters` table had to come first in the schema file so that it's initialized before the `posts` table (because of the foreign key)
- Updated the model to make sure the new field doesn't leak in the API for now
- This migration isn't using the `createAddColumnMigration` util because of a performance issue. In MySQL, adding/dropping a column without `algorithm=copy` uses the INPLACE algorithm which was too slow on big posts tables (~3 minutes for 10k posts). Switching to the COPY algorithm fixed the issue (~3 seconds for 10k posts).
- SQLite isn't using the codepath where we run a raw SQL query because `knex` is doing multiple queries to add/remove a column
2022-04-07 10:26:37 +02:00
..
clients Switched to mysql2 library 2022-03-03 09:59:37 +01:00
default-settings 💡 Updated fixtures to make it easier to get started (#14299) 2022-03-10 17:41:46 +00:00
fixtures Enabled Admin integration for tiers and offers API (#14325) 2022-03-16 16:46:26 +05:30
commands.js Fixed migration util dropping foreign keys before columns 2022-04-04 13:03:38 +01:00
index.js Moved checks into frontend data service 2022-04-05 15:23:00 +01:00
schema.js Added the post-newsletter relation (#14411) 2022-04-07 10:26:37 +02:00
validator.js Switch to @trghost/validator, remove validator 2021-06-16 08:11:22 +01:00