Files
usenet-indexer/database/schema.ts
T
Daan MeijerandClaude Opus 5.5 693e6c3244
Test and deploy / test (push) Successful in 1m27s
Test and deploy / deploy (push) Failing after 33m7s
Seed plans fill every uncovered gap, with priorities; cheaper ingest and file storing
- seed:plan plans every part of a group's history no range covers (it
  started below the lowest known range and left a.b.ath's 13 most recent
  months out); seed_ranges.priority orders leases (seed:plan --priority).
- binaries.part_count, kept by the parts insert in the same statement:
  claimCompleted compares it instead of counting parts every batch.
- file_keys: 64-bit hashes of all file keys; FileStore.insert asks it
  before probing every files partition.
- worker:file stores 100 completed binaries per job with set-based queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 14:18:01 +02:00

629 lines
18 KiB
TypeScript

/**
* This file is automatically generated
* DO NOT EDIT manually
* Run "node ace migration:run" command to re-generate this file
*/
import { BaseModel, column } from '@adonisjs/lucid/orm'
import { DateTime } from 'luxon'
export class AuthAccessTokenSchema extends BaseModel {
static $columns = ['abilities', 'createdAt', 'expiresAt', 'hash', 'id', 'lastUsedAt', 'name', 'tokenableId', 'type', 'updatedAt'] as const
$columns = AuthAccessTokenSchema.$columns
@column()
declare abilities: string
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column.dateTime()
declare expiresAt: DateTime | null
@column()
declare hash: string
@column({ isPrimary: true })
declare id: number
@column.dateTime()
declare lastUsedAt: DateTime | null
@column()
declare name: string | null
@column()
declare tokenableId: number
@column()
declare type: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class BinarySchema extends BaseModel {
static $columns = ['completedAt', 'conflictedAt', 'fileId', 'fileKey', 'firstSeenAt', 'groups', 'id', 'lastSeenAt', 'md516K', 'name', 'parentBinaryId', 'partCount', 'postedAt', 'poster', 'realName', 'releaseId', 'size', 'splitAt', 'subject', 'totalParts'] as const
$columns = BinarySchema.$columns
@column.dateTime()
declare completedAt: DateTime | null
@column.dateTime()
declare conflictedAt: DateTime | null
@column()
declare fileId: bigint | number | null
@column()
declare fileKey: string
@column.dateTime()
declare firstSeenAt: DateTime
@column()
declare groups: any
@column({ isPrimary: true })
declare id: bigint | number
@column.dateTime()
declare lastSeenAt: DateTime
@column()
declare md516K: string | null
@column()
declare name: string
@column()
declare parentBinaryId: bigint | number | null
@column()
declare partCount: number | null
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string
@column()
declare realName: string | null
@column()
declare releaseId: bigint | number | null
@column()
declare size: bigint | number | null
@column.dateTime()
declare splitAt: DateTime | null
@column()
declare subject: string
@column()
declare totalParts: number
}
export class DeferredFileSchema extends BaseModel {
static $columns = ['articleCount', 'bytes', 'contentType', 'encrypted', 'error', 'fileKey', 'firstArticle', 'firstMessageId', 'firstSeenAt', 'groupName', 'id', 'lastArticle', 'lastSeenAt', 'name', 'postedAt', 'poster', 'processedAt', 'sampledPart', 'size', 'status', 'subject', 'totalParts', 'yencName'] as const
$columns = DeferredFileSchema.$columns
@column()
declare articleCount: number
@column()
declare bytes: bigint | number
@column()
declare contentType: string | null
@column()
declare encrypted: boolean | null
@column()
declare error: string | null
@column()
declare fileKey: string
@column()
declare firstArticle: bigint | number
@column()
declare firstMessageId: string
@column.dateTime()
declare firstSeenAt: DateTime
@column()
declare groupName: string
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare lastArticle: bigint | number
@column.dateTime()
declare lastSeenAt: DateTime
@column()
declare name: string
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string
@column.dateTime()
declare processedAt: DateTime | null
@column()
declare sampledPart: number | null
@column()
declare size: bigint | number | null
@column()
declare status: string
@column()
declare subject: string
@column()
declare totalParts: number | null
@column()
declare yencName: string | null
}
export class DeferredRangeSchema extends BaseModel {
static $columns = ['articleCount', 'bytes', 'createdAt', 'expandedAt', 'firstArticle', 'groupName', 'id', 'lastArticle'] as const
$columns = DeferredRangeSchema.$columns
@column()
declare articleCount: number
@column()
declare bytes: bigint | number
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime()
declare expandedAt: DateTime | null
@column()
declare firstArticle: bigint | number
@column()
declare groupName: string
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare lastArticle: bigint | number
}
export class FetchRangeSchema extends BaseModel {
static $columns = ['backfill', 'createdAt', 'endId', 'error', 'groupId', 'id', 'requeues', 'startId', 'status', 'updatedAt'] as const
$columns = FetchRangeSchema.$columns
@column()
declare backfill: boolean
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare endId: bigint | number
@column()
declare error: string | null
@column()
declare groupId: number
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare requeues: number
@column()
declare startId: bigint | number
@column()
declare status: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime
}
export class FileKeySchema extends BaseModel {
static $columns = ['keyHash'] as const
$columns = FileKeySchema.$columns
@column({ isPrimary: true })
declare keyHash: bigint | number
}
export class FileSchema extends BaseModel {
static $columns = ['archive', 'contentType', 'createdAt', 'date', 'fileKey', 'filename', 'firstMessageId', 'groups', 'id', 'parts', 'poster', 'realName', 'releaseId', 'segments', 'size', 'updatedAt'] as const
$columns = FileSchema.$columns
@column()
declare archive: any | null
@column()
declare contentType: string | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column()
declare date: bigint | number
@column()
declare fileKey: string | null
@column()
declare filename: string
@column()
declare firstMessageId: string | null
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare parts: number
@column()
declare poster: string
@column()
declare realName: string | null
@column()
declare releaseId: bigint | number | null
@column()
declare segments: Buffer
@column()
declare size: bigint | number | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class FilesP0Schema extends BaseModel {
static $columns = ['archive', 'contentType', 'createdAt', 'date', 'fileKey', 'filename', 'firstMessageId', 'groups', 'id', 'parts', 'poster', 'realName', 'releaseId', 'segments', 'size', 'updatedAt'] as const
$columns = FilesP0Schema.$columns
@column()
declare archive: any | null
@column()
declare contentType: string | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column()
declare date: bigint | number
@column()
declare fileKey: string | null
@column()
declare filename: string
@column()
declare firstMessageId: string | null
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare parts: number
@column()
declare poster: string
@column()
declare realName: string | null
@column()
declare releaseId: bigint | number | null
@column()
declare segments: Buffer
@column()
declare size: bigint | number | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class FilesP1000000Schema extends BaseModel {
static $columns = ['archive', 'contentType', 'createdAt', 'date', 'fileKey', 'filename', 'firstMessageId', 'groups', 'id', 'parts', 'poster', 'realName', 'releaseId', 'segments', 'size', 'updatedAt'] as const
$columns = FilesP1000000Schema.$columns
@column()
declare archive: any | null
@column()
declare contentType: string | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column()
declare date: bigint | number
@column()
declare fileKey: string | null
@column()
declare filename: string
@column()
declare firstMessageId: string | null
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare parts: number
@column()
declare poster: string
@column()
declare realName: string | null
@column()
declare releaseId: bigint | number | null
@column()
declare segments: Buffer
@column()
declare size: bigint | number | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class FilesP5000000Schema extends BaseModel {
static $columns = ['archive', 'contentType', 'createdAt', 'date', 'fileKey', 'filename', 'firstMessageId', 'groups', 'id', 'parts', 'poster', 'realName', 'releaseId', 'segments', 'size', 'updatedAt'] as const
$columns = FilesP5000000Schema.$columns
@column()
declare archive: any | null
@column()
declare contentType: string | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column()
declare date: bigint | number
@column()
declare fileKey: string | null
@column()
declare filename: string
@column()
declare firstMessageId: string | null
@column()
declare groups: any | null
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare parts: number
@column()
declare poster: string
@column()
declare realName: string | null
@column()
declare releaseId: bigint | number | null
@column()
declare segments: Buffer
@column()
declare size: bigint | number | null
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class GroupSchema extends BaseModel {
static $columns = ['active', 'backfillNextId', 'backfillUntilId', 'createdAt', 'fetchBodies', 'id', 'lastIndexedId', 'lastQueuedId', 'name', 'updatedAt'] as const
$columns = GroupSchema.$columns
@column()
declare active: boolean
@column()
declare backfillNextId: bigint | number | null
@column()
declare backfillUntilId: bigint | number | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime | null
@column()
declare fetchBodies: boolean
@column({ isPrimary: true })
declare id: number
@column()
declare lastIndexedId: bigint | number | null
@column()
declare lastQueuedId: bigint | number
@column()
declare name: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}
export class PartConflictSchema extends BaseModel {
static $columns = ['articleNumber', 'binaryId', 'bytes', 'fileCrc32', 'md516K', 'messageId', 'number', 'partSize', 'pcrc32'] as const
$columns = PartConflictSchema.$columns
@column()
declare articleNumber: bigint | number | null
@column({ isPrimary: true })
declare binaryId: bigint | number
@column()
declare bytes: number
@column()
declare fileCrc32: string | null
@column()
declare md516K: string | null
@column()
declare messageId: string
@column()
declare number: number
@column()
declare partSize: number | null
@column()
declare pcrc32: string | null
}
export class PartSchema extends BaseModel {
static $columns = ['articleNumber', 'binaryId', 'bytes', 'fileCrc32', 'md516K', 'messageId', 'number', 'partSize', 'pcrc32'] as const
$columns = PartSchema.$columns
@column()
declare articleNumber: bigint | number | null
@column({ isPrimary: true })
declare binaryId: bigint | number
@column()
declare bytes: number
@column()
declare fileCrc32: string | null
@column()
declare md516K: string | null
@column()
declare messageId: string
@column()
declare number: number
@column()
declare partSize: number | null
@column()
declare pcrc32: string | null
}
export class ReleaseDirtySchema extends BaseModel {
static $columns = ['releaseId'] as const
$columns = ReleaseDirtySchema.$columns
@column()
declare releaseId: bigint | number
}
export class ReleaseFileSchema extends BaseModel {
static $columns = ['md5', 'md516K', 'name', 'par2FileId', 'releaseId', 'setId', 'size'] as const
$columns = ReleaseFileSchema.$columns
@column()
declare md5: string | null
@column()
declare md516K: string
@column()
declare name: string
@column()
declare par2FileId: string
@column({ isPrimary: true })
declare releaseId: bigint | number
@column()
declare setId: string | null
@column()
declare size: bigint | number
}
export class ReleaseSchema extends BaseModel {
static $columns = ['category', 'complete', 'container', 'contents', 'contentsWalkedAt', 'encrypted', 'extensions', 'fileCount', 'fileTotal', 'firstSeenAt', 'groups', 'id', 'lastSeenAt', 'name', 'password', 'passwordSource', 'postedAt', 'poster', 'releaseKey', 'searchFiles', 'searchText', 'size', 'source'] as const
$columns = ReleaseSchema.$columns
@column()
declare category: number | null
@column()
declare complete: boolean
@column()
declare container: string | null
@column()
declare contents: any | null
@column.dateTime()
declare contentsWalkedAt: DateTime | null
@column()
declare encrypted: boolean | null
@column()
declare extensions: any | null
@column()
declare fileCount: number
@column()
declare fileTotal: number | null
@column.dateTime()
declare firstSeenAt: DateTime
@column()
declare groups: any
@column({ isPrimary: true })
declare id: bigint | number
@column.dateTime()
declare lastSeenAt: DateTime
@column()
declare name: string
@column({ serializeAs: null })
declare password: string | null
@column()
declare passwordSource: string | null
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string | null
@column()
declare releaseKey: string
@column()
declare searchFiles: string | null
@column()
declare searchText: string | null
@column()
declare size: bigint | number
@column()
declare source: string | null
}
export class SeedNodeSchema extends BaseModel {
static $columns = ['createdAt', 'disabled', 'id', 'lastSeenAt', 'name', 'tokenHash'] as const
$columns = SeedNodeSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare disabled: boolean
@column({ isPrimary: true })
declare id: number
@column.dateTime()
declare lastSeenAt: DateTime | null
@column()
declare name: string
@column()
declare tokenHash: string
}
export class SeedRangeSchema extends BaseModel {
static $columns = ['attempts', 'createdAt', 'doneAt', 'endId', 'error', 'files', 'fragments', 'groupName', 'headers', 'heartbeatAt', 'id', 'leasedAt', 'nextId', 'nodeId', 'priority', 'startId', 'status'] as const
$columns = SeedRangeSchema.$columns
@column()
declare attempts: number
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column.dateTime()
declare doneAt: DateTime | null
@column()
declare endId: bigint | number
@column()
declare error: string | null
@column()
declare files: bigint | number
@column()
declare fragments: bigint | number
@column()
declare groupName: string
@column()
declare headers: bigint | number
@column.dateTime()
declare heartbeatAt: DateTime | null
@column({ isPrimary: true })
declare id: bigint | number
@column.dateTime()
declare leasedAt: DateTime | null
@column()
declare nextId: bigint | number
@column()
declare nodeId: number | null
@column()
declare priority: number
@column()
declare startId: bigint | number
@column()
declare status: string
}
export class SfvEntrySchema extends BaseModel {
static $columns = ['crc', 'name', 'postedAt', 'poster', 'releaseId'] as const
$columns = SfvEntrySchema.$columns
@column()
declare crc: string
@column()
declare name: string
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string | null
@column({ isPrimary: true })
declare releaseId: bigint | number
}
export class SpotSchema extends BaseModel {
static $columns = ['articleNumber', 'category', 'createdAt', 'description', 'detailsAt', 'error', 'groupName', 'image', 'keyId', 'messageId', 'postedAt', 'poster', 'processedAt', 'releaseId', 'size', 'spotterId', 'status', 'subcats', 'tag', 'title', 'verified', 'website'] as const
$columns = SpotSchema.$columns
@column()
declare articleNumber: bigint | number | null
@column()
declare category: number | null
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare description: string | null
@column.dateTime()
declare detailsAt: DateTime | null
@column()
declare error: string | null
@column()
declare groupName: string
@column()
declare image: any | null
@column()
declare keyId: number | null
@column({ isPrimary: true })
declare messageId: string
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string
@column.dateTime()
declare processedAt: DateTime | null
@column()
declare releaseId: bigint | number | null
@column()
declare size: bigint | number | null
@column()
declare spotterId: string | null
@column()
declare status: string
@column()
declare subcats: any | null
@column()
declare tag: string | null
@column()
declare title: string
@column()
declare verified: boolean | null
@column()
declare website: string | null
}
export class StagedSegmentSchema extends BaseModel {
static $columns = ['counterKey', 'fileKey', 'segments', 'stagedAt'] as const
$columns = StagedSegmentSchema.$columns
@column()
declare counterKey: string | null
@column({ isPrimary: true })
declare fileKey: string
@column()
declare segments: any
@column.dateTime()
declare stagedAt: DateTime
}
export class UserSchema extends BaseModel {
static $columns = ['createdAt', 'email', 'fullName', 'id', 'password', 'updatedAt'] as const
$columns = UserSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare email: string
@column()
declare fullName: string | null
@column({ isPrimary: true })
declare id: number
@column({ serializeAs: null })
declare password: string
@column.dateTime({ autoCreate: true, autoUpdate: true })
declare updatedAt: DateTime | null
}