--- name: db-table-usage-scan description: Find every application/repository that reads or writes a given database table and produce a report (Writers vs Readers). Use for impact analysis before changing or retiring a table. --- # Database table usage scan ## Steps 1. Confirm the exact table name(s) and schema. Match whole words only (`ROUTE` must not match `ROUTES` or `ROUTE_STOP`). 2. Search code (SQL, Java, COBOL, PL/I, XML mappers, stored procedures, config) for the table name. - GitHub code search: `org: /\bTABLE_NAME\b/ (INSERT OR UPDATE OR DELETE OR MERGE)` - Code search covers default branches only; mention that in the report. 3. Classify each hit: - WRITE: `INSERT INTO`, `UPDATE`, `DELETE FROM`, `MERGE INTO` targeting the table (allow a `SCHEMA.` prefix) - READ: `FROM` / `JOIN` the table - OTHER: any other exact reference (DDL, comments, config) 4. Join Java string concatenation (`"INSERT INTO " + "TABLE"`) before matching. 5. Cross-check with the database catalog (package dependencies / table authorizations) to catch code not in source control. ## Report format Sheets/tables: Summary by application | Writers | Details (repo, file, line, operation, snippet) | Files scanned | Errors. State the limits (default branches only, search result caps, archived repos).