Skip to content

Commit 3c0aa90

Browse files
chore(payments): deploy manual-payouts + related migrations to cloud (#500) (#508)
* chore(payments): regenerate types after deploying payout/enforcement migrations to cloud Applies three previously-local-only migrations to the cloud Supabase project (20260724120000_manual_payouts, 20260724130000_access_cutoff_enforcement, 20260724140000_transaction_split_snapshot) and repairs migration history to match the repo filenames. Regenerates lib/database.types.ts for the columns each adds (payouts.payout_method/note/recorded_by + nullable period_start/ period_end, transactions.school_percentage_snapshot). Deploying the latter two (beyond #500's manual_payouts scope) was necessary because getPayoutsOwed() already selects transactions.school_percentage_snapshot on every /platform/payouts load — that column didn't exist on cloud, so the page was erroring in production before this change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcZgbBpQtpKipPwQq38EjT * chore(payments): regenerate database.types.ts fully against cloud Fixes pre-existing type drift unrelated to any migration in this branch — the checked-in types file was stale relative to migrations already deployed to both local and cloud: adds lessons.transcript, subscriptions.superseded_by (+ FK), the user_ui_state table, and the change_subscription_plan RPC return shape; removes the handle_manual_subscription_expiry function type (dropped by migration 20260719120000/20260719130000, confirmed no live callers — the app-layer cron at app/api/cron/expire-platform-subscriptions/route.ts replaced it). Also picks up the current typegen format (adds __InternalSupabase version marker, drops the empty graphql_public schema block) — nothing in the codebase references graphql_public. npm run typecheck, lint, and build all pass clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcZgbBpQtpKipPwQq38EjT --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 3a36763 commit 3c0aa90

1 file changed

Lines changed: 88 additions & 35 deletions

File tree

lib/database.types.ts

Lines changed: 88 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,10 @@ export type Json =
77
| Json[]
88

99
export type Database = {
10-
graphql_public: {
11-
Tables: {
12-
[_ in never]: never
13-
}
14-
Views: {
15-
[_ in never]: never
16-
}
17-
Functions: {
18-
graphql: {
19-
Args: {
20-
extensions?: Json
21-
operationName?: string
22-
query?: string
23-
variables?: Json
24-
}
25-
Returns: Json
26-
}
27-
}
28-
Enums: {
29-
[_ in never]: never
30-
}
31-
CompositeTypes: {
32-
[_ in never]: never
33-
}
10+
// Allows to automatically instantiate createClient with right options
11+
// instead of createClient<Database, { PostgrestVersion: 'XX' }>(URL, KEY)
12+
__InternalSupabase: {
13+
PostgrestVersion: "12.0.2 (a4e00ff)"
3414
}
3515
public: {
3616
Tables: {
@@ -3796,6 +3776,7 @@ export type Database = {
37963776
summary: string | null
37973777
tenant_id: string
37983778
title: string | null
3779+
transcript: Json | null
37993780
updated_at: string | null
38003781
video_url: string | null
38013782
}
@@ -3816,6 +3797,7 @@ export type Database = {
38163797
summary?: string | null
38173798
tenant_id?: string
38183799
title?: string | null
3800+
transcript?: Json | null
38193801
updated_at?: string | null
38203802
video_url?: string | null
38213803
}
@@ -3836,6 +3818,7 @@ export type Database = {
38363818
summary?: string | null
38373819
tenant_id?: string
38383820
title?: string | null
3821+
transcript?: Json | null
38393822
updated_at?: string | null
38403823
video_url?: string | null
38413824
}
@@ -4397,10 +4380,13 @@ export type Database = {
43974380
currency: string | null
43984381
failed_at: string | null
43994382
failure_reason: string | null
4383+
note: string | null
44004384
paid_at: string | null
44014385
payout_id: number
4402-
period_end: string
4403-
period_start: string
4386+
payout_method: string
4387+
period_end: string | null
4388+
period_start: string | null
4389+
recorded_by: string | null
44044390
status: string
44054391
stripe_metadata: Json | null
44064392
stripe_payout_id: string | null
@@ -4412,10 +4398,13 @@ export type Database = {
44124398
currency?: string | null
44134399
failed_at?: string | null
44144400
failure_reason?: string | null
4401+
note?: string | null
44154402
paid_at?: string | null
44164403
payout_id?: number
4417-
period_end: string
4418-
period_start: string
4404+
payout_method?: string
4405+
period_end?: string | null
4406+
period_start?: string | null
4407+
recorded_by?: string | null
44194408
status?: string
44204409
stripe_metadata?: Json | null
44214410
stripe_payout_id?: string | null
@@ -4427,10 +4416,13 @@ export type Database = {
44274416
currency?: string | null
44284417
failed_at?: string | null
44294418
failure_reason?: string | null
4419+
note?: string | null
44304420
paid_at?: string | null
44314421
payout_id?: number
4432-
period_end?: string
4433-
period_start?: string
4422+
payout_method?: string
4423+
period_end?: string | null
4424+
period_start?: string | null
4425+
recorded_by?: string | null
44344426
status?: string
44354427
stripe_metadata?: Json | null
44364428
stripe_payout_id?: string | null
@@ -5454,6 +5446,7 @@ export type Database = {
54545446
start_date: string
54555447
subscription_id: number
54565448
subscription_status: Database["public"]["Enums"]["subscription_status"]
5449+
superseded_by: number | null
54575450
tenant_id: string
54585451
transaction_id: number
54595452
trial_end: string | null
@@ -5476,6 +5469,7 @@ export type Database = {
54765469
start_date?: string
54775470
subscription_id?: number
54785471
subscription_status?: Database["public"]["Enums"]["subscription_status"]
5472+
superseded_by?: number | null
54795473
tenant_id?: string
54805474
transaction_id: number
54815475
trial_end?: string | null
@@ -5498,6 +5492,7 @@ export type Database = {
54985492
start_date?: string
54995493
subscription_id?: number
55005494
subscription_status?: Database["public"]["Enums"]["subscription_status"]
5495+
superseded_by?: number | null
55015496
tenant_id?: string
55025497
transaction_id?: number
55035498
trial_end?: string | null
@@ -5512,6 +5507,13 @@ export type Database = {
55125507
referencedRelation: "plans"
55135508
referencedColumns: ["plan_id"]
55145509
},
5510+
{
5511+
foreignKeyName: "subscriptions_superseded_by_fkey"
5512+
columns: ["superseded_by"]
5513+
isOneToOne: false
5514+
referencedRelation: "subscriptions"
5515+
referencedColumns: ["subscription_id"]
5516+
},
55155517
{
55165518
foreignKeyName: "subscriptions_tenant_id_fkey"
55175519
columns: ["tenant_id"]
@@ -5911,6 +5913,7 @@ export type Database = {
59115913
provider_charge_id: string | null
59125914
provider_metadata: Json | null
59135915
provider_subscription_id: string | null
5916+
school_percentage_snapshot: number | null
59145917
settlement_base: number | null
59155918
settlement_currency: string | null
59165919
settlement_mint: string | null
@@ -5932,6 +5935,7 @@ export type Database = {
59325935
provider_charge_id?: string | null
59335936
provider_metadata?: Json | null
59345937
provider_subscription_id?: string | null
5938+
school_percentage_snapshot?: number | null
59355939
settlement_base?: number | null
59365940
settlement_currency?: string | null
59375941
settlement_mint?: string | null
@@ -5953,6 +5957,7 @@ export type Database = {
59535957
provider_charge_id?: string | null
59545958
provider_metadata?: Json | null
59555959
provider_subscription_id?: string | null
5960+
school_percentage_snapshot?: number | null
59565961
settlement_base?: number | null
59575962
settlement_currency?: string | null
59585963
settlement_mint?: string | null
@@ -6065,6 +6070,27 @@ export type Database = {
60656070
}
60666071
Relationships: []
60676072
}
6073+
user_ui_state: {
6074+
Row: {
6075+
key: string
6076+
updated_at: string
6077+
user_id: string
6078+
value: Json
6079+
}
6080+
Insert: {
6081+
key: string
6082+
updated_at?: string
6083+
user_id: string
6084+
value: Json
6085+
}
6086+
Update: {
6087+
key?: string
6088+
updated_at?: string
6089+
user_id?: string
6090+
value?: Json
6091+
}
6092+
Relationships: []
6093+
}
60686094
webhook_events: {
60696095
Row: {
60706096
error: string | null
@@ -6259,6 +6285,38 @@ export type Database = {
62596285
Args: { _plan_id: number; _user_id: string }
62606286
Returns: undefined
62616287
}
6288+
change_subscription_plan: {
6289+
Args: { _new_plan_id: number }
6290+
Returns: {
6291+
cancel_at: string
6292+
cancel_at_period_end: boolean | null
6293+
canceled_at: string | null
6294+
created: string
6295+
current_period_end: string
6296+
current_period_start: string
6297+
end_date: string
6298+
ended_at: string | null
6299+
payment_provider: string
6300+
plan_id: number
6301+
provider_metadata: Json | null
6302+
provider_subscription_id: string | null
6303+
start_date: string
6304+
subscription_id: number
6305+
subscription_status: Database["public"]["Enums"]["subscription_status"]
6306+
superseded_by: number | null
6307+
tenant_id: string
6308+
transaction_id: number
6309+
trial_end: string | null
6310+
trial_start: string | null
6311+
user_id: string
6312+
}
6313+
SetofOptions: {
6314+
from: "*"
6315+
to: "subscriptions"
6316+
isOneToOne: true
6317+
isSetofReturn: false
6318+
}
6319+
}
62626320
check_and_issue_certificate: {
62636321
Args: { p_course_id: number; p_user_id: string }
62646322
Returns: Json
@@ -6373,7 +6431,6 @@ export type Database = {
63736431
Args: { _plan_id: number; _user_id: string }
63746432
Returns: undefined
63756433
}
6376-
handle_manual_subscription_expiry: { Args: never; Returns: undefined }
63776434
handle_new_subscription: {
63786435
Args: {
63796436
_plan_id: number
@@ -6676,9 +6733,6 @@ export type CompositeTypes<
66766733
: never
66776734

66786735
export const Constants = {
6679-
graphql_public: {
6680-
Enums: {},
6681-
},
66826736
public: {
66836737
Enums: {
66846738
ai_sender_type: [
@@ -6740,4 +6794,3 @@ export const Constants = {
67406794
},
67416795
},
67426796
} as const
6743-

0 commit comments

Comments
 (0)