Skip to content

Fix lastsent TIMESTAMP default incompatible with MySQL strict mode (issue #289)#315

Open
thegushi wants to merge 5 commits into
trusteddomainproject:developfrom
thegushi:fix/issue-289-lastsent-default
Open

Fix lastsent TIMESTAMP default incompatible with MySQL strict mode (issue #289)#315
thegushi wants to merge 5 commits into
trusteddomainproject:developfrom
thegushi:fix/issue-289-lastsent-default

Conversation

@thegushi
Copy link
Copy Markdown
Collaborator

Summary

  • Changes lastsent in db/schema.mysql from NOT NULL DEFAULT '1970-01-01 00:00:00' to NULL DEFAULT NULL, which is valid across all MySQL/MariaDB configurations including strict mode
  • Updates the two WHERE clauses in opendmarc-reports to treat NULL lastsent as "never sent" (always eligible for reporting)
  • Adds a startup check in opendmarc-reports that detects existing installs with the old NOT NULL schema and prints a warning with the ALTER TABLE command needed to upgrade

Fixes #289.

Test plan

  • Create schema fresh with db/schema.mysql on MySQL with sql_mode=STRICT_TRANS_TABLES and confirm no error on lastsent column
  • Confirm opendmarc-reports runs without error against a fresh schema (NULL lastsent rows treated as unsent)
  • Confirm opendmarc-reports prints a warning when run against an existing install with lastsent NOT NULL

Dan Mahoney 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant