Files
usenet-indexer/database/schema.ts
T
Daan MeijerandClaude Opus 5.5 cd06f96f85
Test and deploy / test (push) Successful in 20s
Test and deploy / deploy (push) Skipped
Rebuild: first end-to-end runs; prefetch per chunk, executable rule, wire fixes
End to end on the workstation (coordinator:run, the API, edge:node, real
NNTP): a.b.e-book.french and a.b.cd.image.playstation2.dvdiso ranges.

- Prefetcher: every connection takes the next missing chunk (leased
  ranges first, in order); one connection per range (~26k lines/s) kept
  the worker waiting
- executable rule: releases of bare executables (malware floods named
  after films and software) are dropped; they were 92% of the catalog rows
  of the test ranges, 21% of the segments
- fragments per file (details once) and gzipped batch bodies; the JSON
  limit (1 MB by default) raised to 256 MB, empty strings kept (a rule
  count's key is '')
- release_chunks.batch_from is a bigint (boneless article numbers)
- tests get their own database; edge:bench --store times BatchStore:
  1.3 s for a boneless range (1.24 ms per release chunk)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 01:07:11 +02:00

302 lines
8.4 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 FragmentSchema extends BaseModel {
static $columns = ['articleNumber', 'fileKey', 'fragment', 'id', 'rangeId', 'segments'] as const
$columns = FragmentSchema.$columns
@column()
declare articleNumber: bigint | number
@column()
declare fileKey: string
@column()
declare fragment: any
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare rangeId: bigint | number
@column()
declare segments: number
}
export class GroupSchema extends BaseModel {
static $columns = ['active', 'createdAt', 'high', 'id', 'low', 'name', 'plannedAt', 'priority'] as const
$columns = GroupSchema.$columns
@column()
declare active: boolean
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare high: bigint | number | null
@column({ isPrimary: true })
declare id: number
@column()
declare low: bigint | number | null
@column()
declare name: string
@column.dateTime()
declare plannedAt: DateTime | null
@column()
declare priority: number
}
export class NodeAccessTokenSchema extends BaseModel {
static $columns = ['abilities', 'createdAt', 'expiresAt', 'hash', 'id', 'lastUsedAt', 'name', 'tokenableId', 'type', 'updatedAt'] as const
$columns = NodeAccessTokenSchema.$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 NodeSchema extends BaseModel {
static $columns = ['createdAt', 'id', 'lastSeenAt', 'name'] as const
$columns = NodeSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column({ isPrimary: true })
declare id: number
@column.dateTime()
declare lastSeenAt: DateTime | null
@column()
declare name: string
}
export class ProbeCandidateSchema extends BaseModel {
static $columns = ['createdAt', 'file', 'id', 'kind', 'messageId', 'releaseId', 'status'] as const
$columns = ProbeCandidateSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare file: string
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare kind: string
@column()
declare messageId: string
@column()
declare releaseId: bigint | number
@column()
declare status: string
}
export class RangeSchema extends BaseModel {
static $columns = ['attempts', 'doneAt', 'endId', 'error', 'groupId', 'headers', 'heartbeatAt', 'id', 'leasedAt', 'nextId', 'nodeId', 'priority', 'ruleVersion', 'spooledAt', 'spooledChunks', 'startId', 'status'] as const
$columns = RangeSchema.$columns
@column()
declare attempts: number
@column.dateTime()
declare doneAt: DateTime | null
@column()
declare endId: bigint | number
@column()
declare error: string | null
@column()
declare groupId: number
@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 ruleVersion: number | null
@column.dateTime()
declare spooledAt: DateTime | null
@column()
declare spooledChunks: number
@column()
declare startId: bigint | number
@column()
declare status: string
}
export class ReleaseChunkSchema extends BaseModel {
static $columns = ['batchFrom', 'createdAt', 'files', 'id', 'payload', 'rangeId', 'releaseId', 'segments'] as const
$columns = ReleaseChunkSchema.$columns
@column()
declare batchFrom: bigint | number
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare files: number
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare payload: Buffer
@column()
declare rangeId: bigint | number
@column()
declare releaseId: bigint | number
@column()
declare segments: number
}
export class ReleaseSchema extends BaseModel {
static $columns = ['bytes', 'chunks', 'complete', 'fileTotal', 'files', 'firstArticle', 'firstSeenAt', 'groups', 'hasPar2', 'id', 'lastArticle', 'lastSeenAt', 'name', 'postedAt', 'poster', 'readable', 'releaseKey', 'segments', 'settledAt', 'source'] as const
$columns = ReleaseSchema.$columns
@column()
declare bytes: bigint | number
@column()
declare chunks: number
@column()
declare complete: boolean | null
@column()
declare fileTotal: number | null
@column()
declare files: number
@column()
declare firstArticle: bigint | number | null
@column.dateTime()
declare firstSeenAt: DateTime
@column()
declare groups: any
@column()
declare hasPar2: boolean
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare lastArticle: bigint | number | null
@column.dateTime()
declare lastSeenAt: DateTime
@column()
declare name: string
@column.dateTime()
declare postedAt: DateTime | null
@column()
declare poster: string | null
@column()
declare readable: boolean
@column()
declare releaseKey: string
@column()
declare segments: bigint | number
@column.dateTime()
declare settledAt: DateTime | null
@column()
declare source: string
}
export class RuleCountSchema extends BaseModel {
static $columns = ['articles', 'files', 'key', 'rangeId', 'rule'] as const
$columns = RuleCountSchema.$columns
@column()
declare articles: bigint | number
@column()
declare files: bigint | number
@column()
declare key: string
@column({ isPrimary: true })
declare rangeId: bigint | number
@column()
declare rule: string
}
export class RuleSampleSchema extends BaseModel {
static $columns = ['files', 'id', 'name', 'payload', 'rangeId', 'releaseKey', 'rule', 'ruleKey', 'segments'] as const
$columns = RuleSampleSchema.$columns
@column()
declare files: number
@column({ isPrimary: true })
declare id: bigint | number
@column()
declare name: string
@column()
declare payload: Buffer
@column()
declare rangeId: bigint | number
@column()
declare releaseKey: string
@column()
declare rule: string
@column()
declare ruleKey: string
@column()
declare segments: number
}
export class RuleSetSchema extends BaseModel {
static $columns = ['createdAt', 'note', 'rules', 'version'] as const
$columns = RuleSetSchema.$columns
@column.dateTime({ autoCreate: true })
declare createdAt: DateTime
@column()
declare note: string | null
@column()
declare rules: any
@column({ isPrimary: true })
declare version: number
}
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
}