mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-14 15:11:52 +00:00
The Postgres test job is label-gated, so it does not run on every PR. This adds an always-on pre-commit hook that statically flags the *mechanical* breaks: MySQL-only functions (timestamp(date,time), timediff, str_to_date, date_format/add/sub, group_concat, period_diff, SQL IF()), SHOW INDEX/TABLES/COLUMNS, single-quoted aliases, UPDATE..JOIN, interpolated/f-string SQL carrying MySQL-isms, set_value/db_set(<Check>, bool), and MySQL SHOW INDEX result keys. It deliberately does NOT flag the framework auto-translations (ifnull->coalesce, backtick/locate/REGEXP, .like()->ILIKE) nor the *semantic* divergences (loose GROUP BY, case-sensitive ==/IN, NULL ordering, tiebreakers) — those need the test suite, which remains the backstop. AST + structure-gated regex keep false positives near zero (docstrings and prose skipped); '# pg-ok' exempts intentional MariaDB-only branches. Scoped to erpnext/ excluding patches/. Includes a unit test of the checker.