/**
 * Yii2 migrations audit (N2).
 *
 * Yii2 ships its own PHP-DSL migration system — `extends Migration` with
 * `$this->createTable()`, `$this->addColumn()`, `$this->dropTable()`, etc.
 * The generic SQL toolchain (migration_lint, analyze_schema, sql_audit) is
 * auto-loaded for composer.json projects but parses only `.sql` files, so
 * the 379 migrations in tgm-panel are invisible to it.
 *
 * This tool fills that gap. For each migration class we:
 *   1. Map the DSL calls to a structured operation list
 *      (create_table, drop_table, add_column, ...).
 *   2. Run audit checks per migration:
 *        - missing_safe_down       (irreversible)
 *        - drop_without_safety     (drop in safeUp without index/backup hint)
 *        - alter_without_online_ddl (alter on large tables without
 *                                    ALGORITHM=INPLACE, LOCK=NONE for MySQL 8)
 *        - fk_without_index        (addForeignKey on a column without
 *                                   a corresponding createIndex earlier)
 *   3. Surface a per-table operation index (which migrations touch table X).
 *
 * The DSL parser is deliberately regex-based, not tree-sitter. Migration
 * methods follow a small, stable grammar (a few verbs from yii\\db\\Migration
 * with predictable argument shapes) and the AST coverage we'd buy with a
 * full walker isn't worth the cost. The audit is a discovery tool, not a
 * gate — false positives are acceptable, false negatives are the failure
 * mode we minimize.
 */
export type YiiMigrationOpKind = "create_table" | "drop_table" | "rename_table" | "add_column" | "drop_column" | "alter_column" | "rename_column" | "create_index" | "drop_index" | "add_primary_key" | "drop_primary_key" | "add_foreign_key" | "drop_foreign_key" | "execute_raw_sql" | "insert" | "update" | "delete" | "batch_insert";
export interface YiiMigrationOp {
    kind: YiiMigrationOpKind;
    /** Primary table the op touches, when statically determinable. */
    table: string | null;
    /** Column name when applicable (add_column, alter_column, rename_column). */
    column?: string;
    /** Index name when applicable (create_index, drop_index). */
    index_name?: string;
    /** Foreign key constraint name when applicable. */
    fk_name?: string;
    /** 1-based line within the migration class source where the op occurred. */
    line: number;
    /** Raw method name from the DSL call. */
    raw: string;
}
export interface YiiMigrationAuditFinding {
    rule_id: "missing-safe-down" | "drop-without-safety" | "alter-without-online-ddl" | "fk-without-index" | "raw-sql-without-comment";
    severity: "high" | "medium" | "low";
    description: string;
    fix: string;
}
export interface YiiMigrationFile {
    file: string;
    class_name: string;
    /** Up-flow operations (`up()` or `safeUp()`). */
    up_ops: YiiMigrationOp[];
    /** Down-flow operations (`down()` or `safeDown()`). */
    down_ops: YiiMigrationOp[];
    /** True iff the migration uses safeUp/safeDown (transactional in Yii2). */
    is_safe_transactional: boolean;
    /** Tables touched by this migration (union of up + down). */
    tables: string[];
    findings: YiiMigrationAuditFinding[];
}
export interface YiiMigrationsAudit {
    repo: string;
    scanned_files: number;
    total_migrations: number;
    /** All migration files keyed by canonical relative path. */
    migrations: YiiMigrationFile[];
    /** Per-table back-index: list of migrations touching that table. */
    by_table: Record<string, string[]>;
    /** Aggregate finding counts by rule. */
    findings_summary: Record<string, number>;
}
export declare function analyzeYiiMigrations(repo: string, options?: {
    file_pattern?: string;
    rules?: YiiMigrationAuditFinding["rule_id"][];
}): Promise<YiiMigrationsAudit>;
//# sourceMappingURL=yii-migrations-tools.d.ts.map