Add migration: make stripe_charge_id nullable, add manual_payment_id to earlybird purchases#788
Merged
olearycrew merged 1 commit intomainfrom Mar 3, 2026
Merged
Conversation
…column Allow earlybird purchases to be recorded via manual payment in addition to Stripe by making stripe_charge_id nullable and adding a new nullable manual_payment_id column with a unique constraint.
pandemicsyn
approved these changes
Mar 3, 2026
| .references(() => kilocode_users.id, { onDelete: 'cascade' }) | ||
| .unique(), | ||
| stripe_charge_id: text().notNull().unique(), | ||
| stripe_charge_id: text().unique(), |
Contributor
Author
There was a problem hiding this comment.
WARNING: stripe_charge_id is now nullable and manual_payment_id is also nullable, but there is no CHECK constraint ensuring at least one of them is non-null. This means a row could be inserted with no payment reference at all, which is a data integrity risk.
Consider adding a check constraint like:
CHECK (stripe_charge_id IS NOT NULL OR manual_payment_id IS NOT NULL)Also note: PostgreSQL UNIQUE constraints treat NULLs as distinct, so multiple rows with stripe_charge_id = NULL are allowed. The webhook idempotency for Stripe payments is still maintained via the user_id unique constraint, but this is worth being aware of.
Contributor
Author
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
SUGGESTION
Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (4 files)
|
olearycrew
approved these changes
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stripe_charge_idcolumn onkiloclaw_earlybird_purchasesnullable (wasNOT NULL)manual_payment_idcolumn (text,UNIQUE) to support non-Stripe payment trackingDetails
This migration allows earlybird purchases to be recorded via manual payment in addition to Stripe. Both
stripe_charge_idandmanual_payment_idare nullable with unique constraints, so each purchase can be identified by either payment method.Files changed
packages/db/src/schema.ts— updated Drizzle schema definitionpackages/db/src/migrations/0041_earlybird_manual_payment.sql— migration SQLpackages/db/src/migrations/meta/0041_snapshot.json— Drizzle snapshotpackages/db/src/migrations/meta/_journal.json— journal entry for migration 0041Built for Brendan by Kilo for Slack