Skip to content

Commit c178302

Browse files
Firehedclaude
andauthored
fix(schema): remove 0000-00-00 values from document_templates inserts (openemr#11251)
Towards openemr#11179 #### Short description of what this resolves: Fixes one spot that prevents database.sql from importing into the db while in strict mode. Note: nothing in the code (that I or Claude found) references _either_ of these columns. #### Changes proposed in this pull request: Changes the zero date value in `document_templates` INSERTS to `now()` and `null` for `send_date` and `end_date` respectively. Updates existing data to follow this format. #### Does your code include anything generated by an AI Engine? Yes / No Claude made the change, I sanity-checked. --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 51659b9 commit c178302

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

sql/8_0_0-to-8_0_1_upgrade.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,16 @@ ALTER TABLE `medex_recalls` MODIFY `r_created` timestamp NOT NULL DEFAULT CURREN
247247
#IfIndex onetime_auth pid
248248
ALTER TABLE `onetime_auth` DROP INDEX `pid`, ADD INDEX `pid` (`pid`, `onetime_token`(32));
249249
#EndIf
250+
251+
--
252+
-- Fix document_templates zero dates for MySQL strict mode compatibility.
253+
-- See: https://github.com/openemr/openemr/issues/11179
254+
--
255+
256+
#IfTable document_templates
257+
SET @currentSQLMode = (SELECT @@sql_mode);
258+
SET sql_mode = '';
259+
UPDATE `document_templates` SET `send_date` = CURRENT_TIMESTAMP WHERE `send_date` = '0000-00-00 00:00:00';
260+
UPDATE `document_templates` SET `end_date` = NULL WHERE `end_date` = '0000-00-00 00:00:00';
261+
SET sql_mode = @currentSQLMode;
262+
#EndIf

0 commit comments

Comments
 (0)