Commit Graph

8 Commits

Author SHA1 Message Date
Rishabh
7d8e18c802 Added migration to revert portal_plans setting to named values
closes https://github.com/TryGhost/Team/issues/753

Currently, the portal_plans setting is storing price ids for active monthly/yearly prices for the default product, which was done to allow multiple prices in Portal. Since we only want to limit the prices for a Product to monthly/yearly, we are reverting the earlier migration and only store the available prices as monthly / yearly in portal setting instead of ids. Its also in sync with the approach in theme/API where we use named prices for monthly/yearly instead of price id list.
2021-06-04 12:14:57 +05:30
Fabien O'Carroll
f660405937 Populated {monthly,yearly}_price_id from settings
refs https://github.com/TryGhost/Team/issues/711

As this migration relies on the settings being populated, it cannot be a
standard migration in Ghost core, as the settings are populated by these
code migrations.
2021-06-02 09:04:54 +01:00
Fabien O'Carroll
f3ecb44e08 Updated migration to use getPrice method
refs https://github.com/TryGhost/Team/issues/657

Since we have removed the getPlan method we need to update the migration
which is the last piece of code which used it. Prices are backwards
compatible with Plans - so this will continue to work as expected.
2021-05-20 15:35:58 +01:00
Fabien O'Carroll
ee32528006 Populated members_{monthly,yearly}_price_id settings
refs https://github.com/TryGhost/Team/issues/698

As this migration relies on the `stripe_prices` table being populated,
it can not be in a standard versioned migration in Ghost core.
2021-05-19 15:16:15 +01:00
Fabien O'Carroll
d32e44c73b Mapped Stripe Product name to Product name
closes https://github.com/TryGhost/Team/issues/682

This ensures that the Stripe Product name is updated during the
migrations of an existing site and any future updates to the Product
name.
2021-05-10 19:21:41 +01:00
Rishabh
aa640ada5e Added migration for stripe plans to custom prices
refs https://github.com/TryGhost/Team/issues/637

- Adds one-off migration that reads from current `stripe_plans data` for a price, and ensures that the corresponding price is present in `stripe_prices` table at start.
- Currently, the portal_plans setting is used to determine the prices available to Portal for showing on Signup or Subscription change screen. The values allowed in portal_plans currently only allow [free, monthly, yearly] , which needs to be updated now to store price ids of available prices instead. Uses above migration to populate `portal_plans` with ids instead of names.
2021-05-04 21:52:51 +05:30
Rish
c612b4d194 Ignored missing plans on Stripe for update
refs https://github.com/TryGhost/Team/issues/591

It's possible to have sites which still have subscriptions in their DB from old Stripe accounts, most likely added when we allowed Stripe Direct, as those subscriptions were not cleaned up. While populating plans and products for existing subscriptions, we want to ignore these old subscriptions which are not part of current Stripe account.
2021-04-22 11:49:08 +05:30
Rishabh Garg
836b7f235e Populate stripe prices and products for existing customers (#258)
refs https://github.com/TryGhost/Team/issues/586

On Ghost Boot, as part of configuring Stripe, this populates stripe products and prices for existing stripe customers in the newly created `stripe_prices` and `stripe_products` table, which allows us to map existing customers to default Ghost product and on current prices. The population script on boot is only run if we find -

- A Ghost Product
- No rows in `stripe_products`
- No rows in `stripe_prices`
- One or more rows in `members_stripe_customers_subscriptions`
2021-04-12 20:38:01 +05:30