* Whether the database holds `table`, or its `column`. An index an older * release built lacks what later migrations add until a writer's open * migrates it, and a read-only open migrates nothing: the CLI's read * commands and the prompt hook open read-only so that a running rebuild is *
(table: string, column?: string)
| 631 | * looked for again, so a writer's later migration is seen. |
| 632 | */ |
| 633 | private hasSchema(table: string, column?: string): boolean { |
| 634 | const key = column ? `${table}.${column}` : table; |
| 635 | if (this.presentSchema.has(key)) return true; |
| 636 | const found = column |
| 637 | ? this.db.prepare('SELECT 1 FROM pragma_table_info(?) WHERE name = ?').get(table, column) !== undefined |
| 638 | : this.db.prepare("SELECT 1 FROM sqlite_master WHERE type = 'table' AND name = ?").get(table) !== undefined; |
| 639 | if (found) this.presentSchema.add(key); |
| 640 | return found; |
| 641 | } |
| 642 | |
| 643 | /** |
| 644 | * `compute()`'s answer, reused until the database changes (see |
no test coverage detected