refactor(db): drop the unused raw document provider seeder

seedDocumentProviders() had no caller left: the migration that creates the
tables and DocumentProviderSeeder both import only the DOCUMENT_PROVIDERS and
DOCUMENT_PROVIDER_FIELDS constants. Its two INSERT OR IGNORE statements were
the only SQLite-only spellings in the file and had been baselined rather than
removed. Deleting it lets the file leave the dialect baseline (13 hits down to
11) and the better-sqlite3 import allowlist in eslint.config.mjs, since nothing
in it touches the driver any more. DOCUMENT_PROVIDER_SEED_IDS goes with it, it
had no importer either.
This commit is contained in:
Maurice
2026-10-08 15:30:27 +02:00
parent 6d45a26e46
commit 6ef6a7efd2
3 changed files with 5 additions and 38 deletions
+1 -2
View File
@@ -273,12 +273,11 @@ export default tseslint.config(
// outside the app's ORM and connection.
'src/nest/plugins/host/plugin-data.service.ts',
// Frozen forever (ruling 7): invoked from inside numbered, already-shipped
// MikroORM migrations — rewriting either onto the ORM would change what a
// MikroORM migrations: rewriting it onto the ORM would change what a
// re-run of an old migration against an old schema snapshot produces,
// which is never done to a landed migration. Not Plan 4's or any future
// plan's to touch.
'src/db/reseat-booked-nights.ts',
'src/db/document-provider-seed.ts',
],
rules: {
'no-restricted-imports': [
-3
View File
@@ -1,7 +1,4 @@
{
"src/db/document-provider-seed.ts": {
"insert-or": 2
},
"src/db/entities/IdempotencyKeys.entity.ts": {
"strftime": 1
},
+4 -33
View File
@@ -1,12 +1,11 @@
import type Database from 'better-sqlite3';
/**
* The five document providers and the fields their connection form asks for.
*
* Shared by the migration that introduces the tables and by `seeds.ts`, so a
* fresh install and an upgraded one end up with the same rows. Both call sites
* use INSERT OR IGNORE, which is what lets an operator rename or re-sort a row
* without a later boot undoing it.
* Shared by the migration that introduces the tables and by
* DocumentProviderSeeder, so a fresh install and an upgraded one end up with
* the same rows. Both insert without overwriting an existing row, which is what
* lets an operator rename or re-sort a row without a later boot undoing it.
*
* `label` and `hint` are i18n key suffixes, never display text: the client
* resolves them as `docsync.<label>`, the same way the photo provider form
@@ -337,31 +336,3 @@ export const DOCUMENT_PROVIDER_FIELDS: ProviderFieldRow[] = [
sort_order: 5,
},
];
export function seedDocumentProviders(db: Database.Database): void {
const insertProvider = db.prepare(
'INSERT OR IGNORE INTO document_providers (id, name, description, icon, enabled, sort_order) VALUES (?, ?, ?, ?, 0, ?)',
);
for (const p of DOCUMENT_PROVIDERS) insertProvider.run(p.id, p.name, p.description, p.icon, p.sort_order);
const insertField = db.prepare(
`INSERT OR IGNORE INTO document_provider_fields
(provider_id, field_key, label, input_type, placeholder, hint, required, secret, sort_order)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
);
for (const f of DOCUMENT_PROVIDER_FIELDS) {
insertField.run(
f.provider_id,
f.field_key,
f.label,
f.input_type,
f.placeholder,
f.hint,
f.required,
f.secret,
f.sort_order,
);
}
}
export const DOCUMENT_PROVIDER_SEED_IDS = DOCUMENT_PROVIDERS.map((p) => p.id);