0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core
Matt Hanley d4700e048a Mapped subscribers to newsletter (#14518)
Closes https://github.com/TryGhost/Team/issues/1508
Refs https://github.com/TryGhost/Ghost/pull/14468

- Maps existing subscribers to the default newsletter

A note on performance:
We loop over the rows in a potentially large table (members) but I've minimised the impact by limiting the columns we fetch. The alternative is a raw SQL query like the one below: the SQL version takes ~0.9s vs ~1.1s for the migration (my laptop, ~30k members). The disadvantage of the raw SQL implementation is the approximation of the ObjectID (instead of a legit bson ID) which isn't sequential and may impact index size/performance.

```sql
insert into members_newsletters (id, member_id, newsletter_id)
    select
        substr(replace(uuid(),'-',''),1,24),
        id,
        '62595dcbfad4e031d85d166f'
    from members
    where members.subscribed=true;
```
2022-04-26 12:31:34 +01:00
..
client@bedc41d7bf Updated Admin to v4.45.0 2022-04-22 16:00:32 +01:00
frontend Moved cors middleware to own file 2022-04-19 11:19:59 +01:00
server Mapped subscribers to newsletter (#14518) 2022-04-26 12:31:34 +01:00
shared Added multiple newsletters UI feature flag 2022-04-22 12:40:51 +05:30
app.js Fixed express app stacking 2021-12-06 21:28:53 +13:00
boot.js Hooked up api version compatibility service 2022-04-22 16:31:56 +08:00
bridge.js 💡 Pinned frontend API version to canary 2022-02-17 17:55:55 +00:00