0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-18 02:21:47 -05:00

Added fallback plan nickname to inteval instead of empty string

no issue

- On model layer in Ghost empty string is always converted to `null` for not nullable fields, which wasn't letting the value through to the database
- Current solution is a stopgap to fix imports of cyclic plans without nicknames. Ideally nickname field should become nullable in the future so this logic can be simplified
This commit is contained in:
Nazar Gargol 2020-02-11 14:02:40 +08:00
parent 38bfef2b83
commit a669cda605

View file

@ -301,7 +301,9 @@ module.exports = class StripePaymentProcessor {
default_payment_card_last4: payment && payment.card && payment.card.last4 || null,
plan_id: subscription.plan.id,
plan_nickname: subscription.plan.nickname || '', // NOTE: defaulting to empty string here as migration to nullable field turned to be too much bigger problem
// NOTE: Defaulting to interval as migration to nullable field turned out to be much bigger problem.
// Ideally, would need nickname field to be nullable on the DB level - condition can be simplified once this is done
plan_nickname: subscription.plan.nickname || subscription.plan.interval,
plan_interval: subscription.plan.interval,
plan_amount: subscription.plan.amount,
plan_currency: subscription.plan.currency