files.id to 64 bits
Test and deploy / test (push) Successful in 1m52s
Test and deploy / deploy (push) Skipped

Seeding adds ~14M files a day; 32-bit ids run out at 2.1 billion in about
five months. Postgres can't change a partition key's type, so the
migration detaches the partitions, rewrites each as a plain table (a CHECK
added first spares the attach scan), and attaches them to a new 64-bit
parent with the same indexes, foreign keys and triggers. binaries.file_id
and the id sequence become 64-bit too. Meant to run with the writers
stopped and Postgres on wal_level=minimal (compose: PG_WAL_LEVEL,
PG_MAX_WAL_SENDERS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daan MeijerandClaude Opus 5.5 committed 2026-10-05 16:46:53 +02:00
1 parent f1773744c0
commit 9201e1200e
2 files changed
+94 -5

No files matched your search

+5 -5
View File
@@ -40,7 +40,7 @@ export class BinarySchema extends BaseModel {
@column.dateTime()
declare conflictedAt: DateTime | null
@column()
declare fileId: number | null
declare fileId: bigint | number | null
@column()
declare fileKey: string
@column.dateTime()
@@ -192,7 +192,7 @@ export class FileSchema extends BaseModel {
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: number
declare id: bigint | number
@column()
declare parts: number
@column()
@@ -229,7 +229,7 @@ export class FilesP0Schema extends BaseModel {
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: number
declare id: bigint | number
@column()
declare parts: number
@column()
@@ -266,7 +266,7 @@ export class FilesP1000000Schema extends BaseModel {
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: number
declare id: bigint | number
@column()
declare parts: number
@column()
@@ -303,7 +303,7 @@ export class FilesP5000000Schema extends BaseModel {
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: number
declare id: bigint | number
@column()
declare parts: number
@column()