Add company overview skeleton and cache

This commit is contained in:
2026-03-13 19:05:17 -04:00
parent b1c9c0ef08
commit 0394f4e795
18 changed files with 1571 additions and 158 deletions

View File

@@ -607,6 +607,20 @@ export const companyFinancialBundle = sqliteTable('company_financial_bundle', {
companyFinancialBundleTickerIndex: index('company_financial_bundle_ticker_idx').on(table.ticker, table.updated_at)
}));
export const companyOverviewCache = sqliteTable('company_overview_cache', {
id: integer('id').primaryKey({ autoIncrement: true }),
user_id: text('user_id').notNull().references(() => user.id, { onDelete: 'cascade' }),
ticker: text('ticker').notNull(),
cache_version: integer('cache_version').notNull(),
source_signature: text('source_signature').notNull(),
payload: text('payload', { mode: 'json' }).$type<Record<string, unknown>>().notNull(),
created_at: text('created_at').notNull(),
updated_at: text('updated_at').notNull()
}, (table) => ({
companyOverviewCacheUnique: uniqueIndex('company_overview_cache_uidx').on(table.user_id, table.ticker),
companyOverviewCacheLookupIndex: index('company_overview_cache_lookup_idx').on(table.user_id, table.ticker, table.updated_at)
}));
export const filingLink = sqliteTable('filing_link', {
id: integer('id').primaryKey({ autoIncrement: true }),
filing_id: integer('filing_id').notNull().references(() => filing.id, { onDelete: 'cascade' }),
@@ -831,6 +845,7 @@ export const appSchema = {
filingTaxonomyFact,
filingTaxonomyMetricValidation,
companyFinancialBundle,
companyOverviewCache,
filingLink,
taskRun,
taskStageEvent,