tubearr/src/db/schema/channels.ts
John Lightner 4606dce553 feat: Tubearr — full project state through M006/S01
Migrated git root from W:/programming/Projects/ to W:/programming/Projects/Tubearr/.
Previous history preserved in Tubearr-full-backup.bundle at parent directory.

Completed milestones: M001 through M005
Active: M006/S02 (Add Channel UX)
2026-03-24 20:20:10 -05:00

31 lines
1.3 KiB
TypeScript

import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';
import { sql } from 'drizzle-orm';
import { formatProfiles } from './content';
/** Monitored channels (YouTube channels, SoundCloud artists, etc.). */
export const channels = sqliteTable('channels', {
id: integer('id').primaryKey({ autoIncrement: true }),
name: text('name').notNull(),
platform: text('platform').notNull(), // 'youtube' | 'soundcloud'
platformId: text('platform_id').notNull(),
url: text('url').notNull(),
monitoringEnabled: integer('monitoring_enabled', { mode: 'boolean' })
.notNull()
.default(true),
checkInterval: integer('check_interval').notNull().default(360), // minutes
imageUrl: text('image_url'),
metadata: text('metadata', { mode: 'json' }), // platform-specific extras
formatProfileId: integer('format_profile_id').references(
() => formatProfiles.id,
{ onDelete: 'set null' }
),
createdAt: text('created_at')
.notNull()
.default(sql`(datetime('now'))`),
updatedAt: text('updated_at')
.notNull()
.default(sql`(datetime('now'))`),
lastCheckedAt: text('last_checked_at'), // null until first monitoring check
lastCheckStatus: text('last_check_status'), // 'success' | 'error' | 'rate_limited'
monitoringMode: text('monitoring_mode').notNull().default('all'), // 'all' | 'future' | 'existing' | 'none'
});