mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22:21:10 +02:00
fix(mana-events): cascade rate buckets when an event is unpublished
Add an ON DELETE CASCADE FK from rsvp_rate_buckets.token to events_published.token. Without it, deleting a snapshot left orphaned rate-limit rows behind, slowly leaking storage. Verified with a direct SQL cascade test.
This commit is contained in:
parent
59a9c05872
commit
e7585fb870
1 changed files with 3 additions and 1 deletions
|
|
@ -74,7 +74,9 @@ export const publicRsvps = eventsSchema.table(
|
|||
export const rsvpRateBuckets = eventsSchema.table(
|
||||
'rsvp_rate_buckets',
|
||||
{
|
||||
token: text('token').notNull(),
|
||||
token: text('token')
|
||||
.notNull()
|
||||
.references(() => eventsPublished.token, { onDelete: 'cascade' }),
|
||||
hourBucket: text('hour_bucket').notNull(), // YYYY-MM-DDTHH
|
||||
count: integer('count').default(0).notNull(),
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue