Skip to content

Commit

Permalink
Standardize email varchar length
Browse files Browse the repository at this point in the history
As I was writing some test scripts, I noticed that we have a really short length for the `email` field for patients.  I've standardized all `email` field lengths to `VARCHAR(150)`, which was our longest supported email field.
  • Loading branch information
jniles committed Dec 2, 2024
1 parent be4b6f5 commit 891283c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/models/01-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ CREATE TABLE `debtor_group` (
`account_id` INT(10) UNSIGNED NOT NULL,
`location_id` BINARY(16) NOT NULL,
`phone` VARCHAR(20) DEFAULT '',
`email` VARCHAR(100) DEFAULT '',
`email` VARCHAR(150) DEFAULT '',
`note` TEXT,
`locked` TINYINT(1) NOT NULL DEFAULT 0,
`max_credit` MEDIUMINT(8) UNSIGNED DEFAULT 0,
Expand Down Expand Up @@ -567,7 +567,7 @@ CREATE TABLE `enterprise` (
`name` VARCHAR(50) NOT NULL,
`abbr` VARCHAR(10) DEFAULT NULL,
`phone` VARCHAR(20) DEFAULT NULL,
`email` VARCHAR(100) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`address` VARCHAR(200) DEFAULT NULL,
`location_id` BINARY(16) DEFAULT NULL,
`logo` VARCHAR(100) DEFAULT NULL,
Expand Down Expand Up @@ -1032,7 +1032,7 @@ CREATE TABLE `patient` (
`religion` VARCHAR(50),
`marital_status` VARCHAR(50),
`phone` VARCHAR(12),
`email` VARCHAR(40),
`email` VARCHAR(150),
`address_1` VARCHAR(100),
`address_2` VARCHAR(100),
`origin_location_id` BINARY(16) NOT NULL,
Expand Down Expand Up @@ -1728,7 +1728,7 @@ CREATE TABLE `supplier` (
`display_name` VARCHAR(45) NOT NULL,
`address_1` TEXT,
`address_2` TEXT,
`email` VARCHAR(45) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`fax` VARCHAR(45) DEFAULT NULL,
`note` TEXT,
`phone` VARCHAR(15) DEFAULT NULL,
Expand Down Expand Up @@ -1803,7 +1803,7 @@ CREATE TABLE `user` (
`username` VARCHAR(80) NOT NULL,
`password` VARCHAR(100) NOT NULL,
`display_name` TEXT NOT NULL,
`email` VARCHAR(99) DEFAULT NULL,
`email` VARCHAR(150) DEFAULT NULL,
`active` TINYINT(4) NOT NULL DEFAULT 0,
`deactivated` TINYINT(1) NOT NULL DEFAULT 0,
`last_login` TIMESTAMP NULL,
Expand Down
7 changes: 7 additions & 0 deletions server/models/migrations/next/migrate.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

-- @jniles: modify the email fields to standarize the field length
ALTER TABLE `patient` MODIFY `email` VARCHAR(150) DEFAULT NULL;
ALTER TABLE `debtor_group` MODIFY `email` VARCHAR(150) DEFAULT '';
ALTER TABLE `enterprise` MODIFY `email` VARCHAR(150) DEFAULT NULL;
ALTER TABLE `supplier` MODIFY `email` VARCHAR(150) DEFAULT NULL;
ALTER TABLE `user` MODIFY `email` VARCHAR(150) DEFAULT NULL;

0 comments on commit 891283c

Please sign in to comment.