Fix lastsent TIMESTAMP default incompatible with MySQL strict mode (issue #289)#315
Open
thegushi wants to merge 5 commits into
Open
Fix lastsent TIMESTAMP default incompatible with MySQL strict mode (issue #289)#315thegushi wants to merge 5 commits into
thegushi wants to merge 5 commits into
Conversation
added 5 commits
May 16, 2026 07:45
Replace NOT NULL DEFAULT '1970-01-01 00:00:00' with NULL DEFAULT NULL, which is valid in all MySQL/MariaDB configurations. Update the two WHERE clauses in opendmarc-reports to treat NULL lastsent as always eligible for reporting (i.e. never sent).
Existing installs will have lastsent as NOT NULL; detect this via INFORMATION_SCHEMA and print a warning with the ALTER TABLE command needed to upgrade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
lastsentindb/schema.mysqlfromNOT NULL DEFAULT '1970-01-01 00:00:00'toNULL DEFAULT NULL, which is valid across all MySQL/MariaDB configurations including strict modeWHEREclauses inopendmarc-reportsto treatNULL lastsentas "never sent" (always eligible for reporting)opendmarc-reportsthat detects existing installs with the oldNOT NULLschema and prints a warning with theALTER TABLEcommand needed to upgradeFixes #289.
Test plan
db/schema.mysqlon MySQL withsql_mode=STRICT_TRANS_TABLESand confirm no error onlastsentcolumnopendmarc-reportsruns without error against a fresh schema (NULL lastsent rows treated as unsent)opendmarc-reportsprints a warning when run against an existing install withlastsent NOT NULL