Add a new recurrenceLastExpansion column to the BillingRecurrence table (#1650)

* Add a new recurrenceLastExpansion column to the BillingRecurrence table

This will be used to determine which recurrences are in scope for
expansion. Anything that has already been expanded within the past year is
automatically out of scope.

Note that the default value is set to just over a year ago, so that, initially,
everything is in scope for expansion, and then will gradually be winnowed down
over time so that most recurrences at any given point are out of scope. Newly
created recurrings (after the subsequent code change goes in) will have their
last expansion time set to the same as the event time of when the recurring is
written, such that they'll first be considered in-scope precisely one year
later.
This commit is contained in:
Ben McIlwain 2022-06-01 14:23:56 -04:00 committed by GitHub
parent 857cb833a5
commit 2377774bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 1617 additions and 1554 deletions

View file

@ -120,7 +120,8 @@ CREATE TABLE public."BillingRecurrence" (
recurrence_time_of_year text,
renewal_price_behavior text DEFAULT 'DEFAULT'::text NOT NULL,
renewal_price_currency text,
renewal_price_amount numeric(19,2)
renewal_price_amount numeric(19,2),
recurrence_last_expansion timestamp with time zone DEFAULT '2021-06-01 00:00:00+00'::timestamp with time zone NOT NULL
);
@ -1879,6 +1880,13 @@ CREATE INDEX idxoqttafcywwdn41um6kwlt0n8b ON public."BillingRecurrence" USING bt
CREATE INDEX idxovmntef6l45tw2bsfl56tcugx ON public."Host" USING btree (deletion_time);
--
-- Name: idxp0pxi708hlu4n40qhbtihge8x; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX idxp0pxi708hlu4n40qhbtihge8x ON public."BillingRecurrence" USING btree (recurrence_last_expansion);
--
-- Name: idxp3usbtvk0v1m14i5tdp4xnxgc; Type: INDEX; Schema: public; Owner: -
--