Skip to content

Commit

Permalink
[SQL]: Fix openemr#3378 fix default date issue drug_inventory (open…
Browse files Browse the repository at this point in the history
…emr#3469)

* [fix]: updated last_notify in drug_inventory
* Made the last_notify column in the drug_inventory table NULL
* Removed the default value

* [fix]: added the update statments for the prev fixes

* 👌 added the parenthesis
  • Loading branch information
ShubhamBansal1997 committed May 10, 2020
1 parent b8aaa45 commit 32dc6c7
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
20 changes: 20 additions & 0 deletions sql/5_0_2-to-5_0_3_upgrade.sql
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,32 @@ ALTER TABLE `codes` MODIFY `code_text_short` varchar(255) NOT NULL default '';

#IfNotColumnTypeDefault amendments created_time timestamp NULL
ALTER TABLE `amendments` MODIFY `created_time` timestamp NULL COMMENT 'created time';
SET @currentSQLMode = (SELECT @@sql_mode);
SET sql_mode = '';
UPDATE `amendments` SET `created_time` = NULL WHERE `created_time` = '0000-00-00 00:00:00';
SET sql_mode = @currentSQLMode;
#EndIf

#IfNotColumnTypeDefault amendments_history created_time timestamp NULL
ALTER TABLE `amendments_history` MODIFY `created_time` timestamp NULL COMMENT 'created time';
SET @currentSQLMode = (SELECT @@sql_mode);
SET sql_mode = '';
UPDATE `amendments_history` SET `created_time` = NULL WHERE `created_time` = '0000-00-00 00:00:00';
SET sql_mode = @currentSQLMode;
#EndIf

#IfNotColumnTypeDefault batchcom msg_date_sent datetime NULL
ALTER TABLE `batchcom` MODIFY `msg_date_sent` datetime NULL;
SET @currentSQLMode = (SELECT @@sql_mode);
SET sql_mode = '';
UPDATE `batchcom` SET `msg_date_sent` = NULL WHERE `msg_date_sent` = '0000-00-00 00:00:00';
SET sql_mode = @currentSQLMode;
#EndIf

#IfNotColumnTypeDefault drug_inventory last_notify date NULL
ALTER TABLE `drug_inventory` MODIFY `last_notify` date NULL;
SET @currentSQLMode = (SELECT @@sql_mode);
SET sql_mode = '';
UPDATE `drug_inventory` SET `last_notify` = NULL WHERE `last_notify` = '0000-00-00';
SET sql_mode = @currentSQLMode;
#EndIf
2 changes: 1 addition & 1 deletion sql/database.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,7 @@ CREATE TABLE `drug_inventory` (
`on_hand` int(11) NOT NULL default '0',
`warehouse_id` varchar(31) NOT NULL DEFAULT '',
`vendor_id` bigint(20) NOT NULL DEFAULT 0,
`last_notify` date NOT NULL default '0000-00-00',
`last_notify` date NULL,
`destroy_date` date default NULL,
`destroy_method` varchar(255) default NULL,
`destroy_witness` varchar(255) default NULL,
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
// is a database change in the course of development. It is used
// internally to determine when a database upgrade is needed.
//
$v_database = 318;
$v_database = 319;

// Access control version identifier, this is to be incremented whenever there
// is a access control change in the course of development. It is used
Expand Down

0 comments on commit 32dc6c7

Please sign in to comment.