-
Notifications
You must be signed in to change notification settings - Fork 54
chore: remove v1 subscription_histories table #2317
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Update CurrentTeam type to reference stripePricingPlanSubscriptionHistories instead of subscriptionHistories for activeSubscriptionId type inference.
Drop the legacy subscription_histories table that was used for v1 Stripe API. All subscription history is now tracked in stripe_pricing_plan_subscription_histories.
|
|
Finished running flow.
|
||||||||||||||||||
WalkthroughThis PR removes the legacy subscription_histories table via database migration, eliminates its schema definition, and updates type references to use the new stripePricingPlanSubscriptionHistories table instead across the codebase. Changes
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes the legacy v1 subscription_histories table as part of the Stripe v2 migration, replacing all references with the v2 stripe_pricing_plan_subscription_histories table.
- Updates TypeScript types to reference the v2 subscription histories table
- Removes the deprecated table schema definition and relations
- Adds database migration to drop the legacy table
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| apps/studio.giselles.ai/services/teams/types.ts | Updates CurrentTeam type to use v2 stripePricingPlanSubscriptionHistories instead of v1 subscriptionHistories |
| apps/studio.giselles.ai/db/schema.ts | Removes the legacy subscription_histories table definition and its relations |
| apps/studio.giselles.ai/db/migrate/meta/_journal.json | Adds migration entry for the table drop operation |
| apps/studio.giselles.ai/db/migrate/0070_even_living_lightning.sql | Contains SQL to drop the subscription_histories table with CASCADE |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
🔍 QA Testing Assistant by Giselle📋 Manual QA ChecklistBased on the changes in this PR, here are the key areas to test manually:
✨ Prompt for AI AgentsUse the following prompts with Cursor or Claude Code to automate E2E testing: 📝 E2E Test Generation Prompt |
|
Thank you! 🚀 |
User description
Summary
CurrentTeamtype to use v2stripePricingPlanSubscriptionHistoriesinstead of v1subscriptionHistoriessubscription_historiestable definition from schemasubscription_historiestableThis is part of the Stripe v2 migration. All subscription history is now tracked in
stripe_pricing_plan_subscription_historiestable, making the v1 table obsolete.Related Issue
Part of #2061
Testing
PR Type
Enhancement
Description
Remove legacy v1
subscription_historiestable from schemaUpdate
CurrentTeamtype to use v2stripePricingPlanSubscriptionHistoriesAdd database migration to drop obsolete subscription_histories table
Remove unused Stripe type import from schema file
Diagram Walkthrough
File Walkthrough
schema.ts
Remove v1 subscription_histories table definitionapps/studio.giselles.ai/db/schema.ts
subscriptionHistoriestable definition with all associatedfields and indexes
subscriptionHistoryRelationsrelation definitionStripetype import from stripe packagestripePricingPlanSubscriptionHistoriestable intacttypes.ts
Update CurrentTeam type to use v2 subscription historyapps/studio.giselles.ai/services/teams/types.ts
stripePricingPlanSubscriptionHistoriesinsteadof
subscriptionHistoriesCurrentTeam.activeSubscriptionIdtype to reference v2 table'ssubscription ID type
subscriptionHistories.$inferInsert.idtostripePricingPlanSubscriptionHistories.$inferInsert.id0070_even_living_lightning.sql
Add migration to drop v1 subscription_histories tableapps/studio.giselles.ai/db/migrate/0070_even_living_lightning.sql
subscription_historiestable withCASCADE option
0070_snapshot.json
Update migration snapshot metadataapps/studio.giselles.ai/db/migrate/meta/0070_snapshot.json
table removal
subscription_historiestable is no longer present_journal.json
Record new migration in journalapps/studio.giselles.ai/db/migrate/meta/_journal.json
Note
Drops the deprecated
subscription_historiestable and switchesCurrentTeam.activeSubscriptionIdto use v2stripe_pricing_plan_subscription_histories.subscription_historiestable via migration0070_even_living_lightningand update migration journal/snapshot.subscription_historiestable and its relations fromapps/studio.giselles.ai/db/schema.ts.CurrentTeam.activeSubscriptionIdto referencestripe_pricing_plan_subscription_histories(v2).Written by Cursor Bugbot for commit 67ab7b0. This will update automatically on new commits. Configure here.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.