[PR #3179] [CLOSED] Fix/3138 stripe updatedAt #21593

Closed
opened 2026-04-15 20:28:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/3179
Author: @tinkerer-shubh
Created: 6/26/2025
Status: Closed

Base: mainHead: fix/3138-stripe-updatedAt


📝 Commits (2)

  • 419427e feat(stripe): add createdAt and updatedAt fields to subscription schema and types
  • 2a57171 fix(stripe): ensure updatedAt timestamp is refreshed on every subscription/user update

📊 Changes

3 files changed (+22 additions, -0 deletions)

View changed files

📝 packages/stripe/src/index.ts (+4 -0)
📝 packages/stripe/src/schema.ts (+10 -0)
📝 packages/stripe/src/types.ts (+8 -0)

📄 Description

Purpose:
This PR fixes missing timestamp columns that caused updatedAt write errors in the Stripe plugin and ensures the updatedAt field is kept in sync on every mutation.

Summary of Changes:

  1. schema.ts

    • Added createdAt and updatedAt fields to the subscription model.
    • Both fields now have a default value of new Date(), ensuring new subscriptions always get timestamped.
  2. types.ts

    • The Subscription interface now includes optional createdAt and updatedAt properties.
    • This allows for type-safe use of these fields throughout the codebase.
  3. index.ts (Stripe plugin logic)

    • Updated several code paths using adapter.update to explicitly set updatedAt: new Date():
      • Customer creation
      • Cancel-at-period-end
      • Manual cancel fallback
      • Restore operation
    • This ensures the updatedAt field is always updated properly on relevant mutations.

closes: https://github.com/better-auth/better-auth/issues/3138


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/3179 **Author:** [@tinkerer-shubh](https://github.com/tinkerer-shubh) **Created:** 6/26/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/3138-stripe-updatedAt` --- ### 📝 Commits (2) - [`419427e`](https://github.com/better-auth/better-auth/commit/419427e60c30b793ec0f12449483bcc03483bfb2) feat(stripe): add createdAt and updatedAt fields to subscription schema and types - [`2a57171`](https://github.com/better-auth/better-auth/commit/2a57171b3f01f3c5262adf9aebd5055ae377b8f5) fix(stripe): ensure updatedAt timestamp is refreshed on every subscription/user update ### 📊 Changes **3 files changed** (+22 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/index.ts` (+4 -0) 📝 `packages/stripe/src/schema.ts` (+10 -0) 📝 `packages/stripe/src/types.ts` (+8 -0) </details> ### 📄 Description **Purpose:** This PR fixes missing timestamp columns that caused `updatedAt` write errors in the Stripe plugin and ensures the `updatedAt` field is kept in sync on every mutation. **Summary of Changes:** 1. **schema.ts** - Added `createdAt` and `updatedAt` fields to the `subscription` model. - Both fields now have a default value of `new Date()`, ensuring new subscriptions always get timestamped. 2. **types.ts** - The `Subscription` interface now includes optional `createdAt` and `updatedAt` properties. - This allows for type-safe use of these fields throughout the codebase. 3. **index.ts** (Stripe plugin logic) - Updated several code paths using `adapter.update` to explicitly set `updatedAt: new Date()`: - Customer creation - Cancel-at-period-end - Manual cancel fallback - Restore operation - This ensures the `updatedAt` field is always updated properly on relevant mutations. closes: https://github.com/better-auth/better-auth/issues/3138 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 20:28:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#21593