Conversation
Run a locked hourly cron to: - report enabled growth add-ons on plans that do not support them; - activate due add-ons for eligible plans; - terminate add-ons whose end date has passed. Also adds `growth_features_starts_at` to `plans` in order to unlock the enabling of growth add-ons on a schedule.
Preview Deploys
|
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Confidence score: 4/5
packages/database/lib/migrations/20260911120000_plans_add_growth_addon_start.cjslacks an index for the hourlygrowth_features_starts_at <= snapshotpredicate, which could cause each run to scan every plan row and degrade database performance as data grows — add a partial index for this filter.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/database/lib/migrations/20260911120000_plans_add_growth_addon_start.cjs">
<violation number="1" location="packages/database/lib/migrations/20260911120000_plans_add_growth_addon_start.cjs:5">
P2: The hourly growth-addon update filters on `growth_features_starts_at <= snapshot`, but this migration creates no index for that predicate. Add a partial index so each hourly run does not scan every plan row as the plans table grows.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| * @param {import('knex').Knex} knex | ||
| */ | ||
| exports.up = async function (knex) { | ||
| await knex.raw(`ALTER TABLE plans ADD COLUMN IF NOT EXISTS growth_features_starts_at timestamptz`); |
There was a problem hiding this comment.
P2: The hourly growth-addon update filters on growth_features_starts_at <= snapshot, but this migration creates no index for that predicate. Add a partial index so each hourly run does not scan every plan row as the plans table grows.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/database/lib/migrations/20260911120000_plans_add_growth_addon_start.cjs, line 5:
<comment>The hourly growth-addon update filters on `growth_features_starts_at <= snapshot`, but this migration creates no index for that predicate. Add a partial index so each hourly run does not scan every plan row as the plans table grows.</comment>
<file context>
@@ -0,0 +1,11 @@
+ * @param {import('knex').Knex} knex
+ */
+exports.up = async function (knex) {
+ await knex.raw(`ALTER TABLE plans ADD COLUMN IF NOT EXISTS growth_features_starts_at timestamptz`);
+};
+
</file context>
There was a problem hiding this comment.
All reported issues were addressed across 1 file (changes from recent commits).
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Run a locked hourly cron to:
Also adds
growth_features_starts_attoplansin order to unlock the enabling of growth add-ons on a schedule.