#IfNotRow lang_constants cons_id 6

##
##  Data for language translations
##

## phpMyAdmin SQL Dump
## version 2.6.4-pl1-Debian-1ubuntu1.1
## http://www.phpmyadmin.net
##
## Host: localhost
## Generation Time: Feb 07, 2006 at 05:39 PM
## Server version: 4.1.12
## PHP Version: 4.4.0-3ubuntu1
##
## Database: `openemr`
##

##
## Dumping data for table `lang_constants`
##

INSERT INTO `lang_constants` VALUES (6, 'Group');
INSERT INTO `lang_constants` VALUES (8, 'Username:');
INSERT INTO `lang_constants` VALUES (10, 'EOB Posting - Instructions');
INSERT INTO `lang_constants` VALUES (11, 'Zip Code');
INSERT INTO `lang_constants` VALUES (12, 'Last Name');
INSERT INTO `lang_constants` VALUES (13, 'Male');
INSERT INTO `lang_constants` VALUES (14, 'Female');
INSERT INTO `lang_constants` VALUES (15, 'Appointment Date');
INSERT INTO `lang_constants` VALUES (16, 'Batch Communication Tool');
INSERT INTO `lang_constants` VALUES (17, 'Age From:');
INSERT INTO `lang_constants` VALUES (18, ' Up to:');
INSERT INTO `lang_constants` VALUES (19, 'SSN');
INSERT INTO `lang_constants` VALUES (20, 'User & Group Administration');
INSERT INTO `lang_constants` VALUES (21, 'Logout');
INSERT INTO `lang_constants` VALUES (22, 'Password:');
INSERT INTO `lang_constants` VALUES (23, 'Login');
INSERT INTO `lang_constants` VALUES (24, 'Administration');
INSERT INTO `lang_constants` VALUES (25, 'Password');
INSERT INTO `lang_constants` VALUES (26, 'Reports');
INSERT INTO `lang_constants` VALUES (27, 'Notes');
INSERT INTO `lang_constants` VALUES (28, 'Billing');
INSERT INTO `lang_constants` VALUES (29, 'Home');
INSERT INTO `lang_constants` VALUES (30, 'Patient Notes');
INSERT INTO `lang_constants` VALUES (31, 'Authorizations');
INSERT INTO `lang_constants` VALUES (32, '(More)');
INSERT INTO `lang_constants` VALUES (33, 'Find Patient');
INSERT INTO `lang_constants` VALUES (34, 'New Patient');
INSERT INTO `lang_constants` VALUES (35, 'Name');
INSERT INTO `lang_constants` VALUES (36, 'ID');
INSERT INTO `lang_constants` VALUES (37, 'DOB');
INSERT INTO `lang_constants` VALUES (38, 'and');
INSERT INTO `lang_constants` VALUES (39, 'Patient Appointment');
INSERT INTO `lang_constants` VALUES (40, '(Notes and Authorizations)');
INSERT INTO `lang_constants` VALUES (41, 'Search');
INSERT INTO `lang_constants` VALUES (42, 'Category');
INSERT INTO `lang_constants` VALUES (43, 'Date');
INSERT INTO `lang_constants` VALUES (44, 'Title');
INSERT INTO `lang_constants` VALUES (45, 'Patient');
INSERT INTO `lang_constants` VALUES (46, 'Provider');
INSERT INTO `lang_constants` VALUES (47, 'Comments');
INSERT INTO `lang_constants` VALUES (48, 'duration');
INSERT INTO `lang_constants` VALUES (49, 'Records Found');
INSERT INTO `lang_constants` VALUES (50, '(New Patient)');
INSERT INTO `lang_constants` VALUES (51, 'All day event');
INSERT INTO `lang_constants` VALUES (52, 'Time');
INSERT INTO `lang_constants` VALUES (53, 'minutes');
INSERT INTO `lang_constants` VALUES (54, 'day');
INSERT INTO `lang_constants` VALUES (55, 'Repeats');
INSERT INTO `lang_constants` VALUES (56, 'until');


##
## now translations
##

# phpMyAdmin SQL Dump
# version 2.5.5-pl1
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Feb 14, 2006 at 09:21 AM
# Server version: 4.1.12
# PHP Version: 4.4.0-3ubuntu1
# 
# Database : `openemr`
# 

#
# Dumping data for table `lang_definitions`
#

INSERT INTO `lang_definitions` VALUES (1, 6, 3, 'Grupo');
INSERT INTO `lang_definitions` VALUES (2, 8, 3, 'Usuario:');
INSERT INTO `lang_definitions` VALUES (5, 10, 3, 'EOB Posting - Instrucciones');
INSERT INTO `lang_definitions` VALUES (6, 11, 3, 'Codigo Postal');
INSERT INTO `lang_definitions` VALUES (7, 12, 3, 'Apellido');
INSERT INTO `lang_definitions` VALUES (8, 18, 3, 'Hasta:');
INSERT INTO `lang_definitions` VALUES (9, 17, 3, 'Edades desde:');
INSERT INTO `lang_definitions` VALUES (10, 15, 3, 'Fecha de Cita');
INSERT INTO `lang_definitions` VALUES (11, 16, 3, 'Herramienta de Comunicaciones');
INSERT INTO `lang_definitions` VALUES (12, 14, 3, 'Femenino');
INSERT INTO `lang_definitions` VALUES (13, 13, 3, 'Masculino');
INSERT INTO `lang_definitions` VALUES (14, 19, 3, 'Seguro Social');
INSERT INTO `lang_definitions` VALUES (15, 20, 3, 'Administracion de Usuarios y Grupos');
INSERT INTO `lang_definitions` VALUES (16, 21, 3, 'Salir');
INSERT INTO `lang_definitions` VALUES (17, 22, 3, 'Contrase�:');
INSERT INTO `lang_definitions` VALUES (18, 23, 3, 'Entrar');
INSERT INTO `lang_definitions` VALUES (19, 24, 3, 'Administraci�');
INSERT INTO `lang_definitions` VALUES (20, 25, 3, 'Contrase�');
INSERT INTO `lang_definitions` VALUES (21, 28, 3, 'Facturaci�');
INSERT INTO `lang_definitions` VALUES (22, 29, 3, 'Inicio');
INSERT INTO `lang_definitions` VALUES (23, 27, 3, 'Notas');
INSERT INTO `lang_definitions` VALUES (24, 26, 3, 'Informes');
INSERT INTO `lang_definitions` VALUES (25, 32, 3, '(M�)');
INSERT INTO `lang_definitions` VALUES (26, 31, 3, 'Autorizaci�es');
INSERT INTO `lang_definitions` VALUES (27, 33, 3, 'Localizar Paciente');
INSERT INTO `lang_definitions` VALUES (28, 30, 3, 'Notas de Paciente');
INSERT INTO `lang_definitions` VALUES (29, 34, 3, 'Paciente Nuevo');
INSERT INTO `lang_definitions` VALUES (30, 37, 3, 'Fecha Nacimiento');
INSERT INTO `lang_definitions` VALUES (31, 36, 3, 'Num Expediente');
INSERT INTO `lang_definitions` VALUES (32, 35, 3, 'Nombre');
INSERT INTO `lang_definitions` VALUES (33, 38, 3, 'y');
INSERT INTO `lang_definitions` VALUES (34, 39, 3, 'Cita(s) del Paciente');
INSERT INTO `lang_definitions` VALUES (35, 40, 3, '(Notas y Autorizaciones)');
INSERT INTO `lang_definitions` VALUES (36, 41, 3, 'Bsqueda');
INSERT INTO `lang_definitions` VALUES (37, 42, 3, 'Categor�');
INSERT INTO `lang_definitions` VALUES (38, 43, 3, 'Fecha');
INSERT INTO `lang_definitions` VALUES (39, 44, 3, 'T�ulo');
INSERT INTO `lang_definitions` VALUES (40, 45, 3, 'Paciente');
INSERT INTO `lang_definitions` VALUES (41, 46, 3, 'M�ico');
INSERT INTO `lang_definitions` VALUES (42, 47, 3, 'Notas');
INSERT INTO `lang_definitions` VALUES (43, 48, 3, 'Duraci�');
INSERT INTO `lang_definitions` VALUES (44, 49, 3, 'Expedientes Localizado');
INSERT INTO `lang_definitions` VALUES (45, 50, 3, '(Paciente Nuevo)');
INSERT INTO `lang_definitions` VALUES (46, 51, 3, 'D� completo');
INSERT INTO `lang_definitions` VALUES (47, 52, 3, 'Hora');
INSERT INTO `lang_definitions` VALUES (48, 53, 3, 'Minutos');
INSERT INTO `lang_definitions` VALUES (49, 54, 3, 'D�');
INSERT INTO `lang_definitions` VALUES (50, 55, 3, 'Repite');
INSERT INTO `lang_definitions` VALUES (51, 56, 3, 'Hasta');
INSERT INTO `lang_definitions` VALUES (52, 57, 3, 'Ver Todos');
INSERT INTO `lang_definitions` VALUES (53, 58, 3, 'M�');
INSERT INTO `lang_definitions` VALUES (54, 59, 3, 'Localizar Paciente');
INSERT INTO `lang_definitions` VALUES (55, 60, 3, 'Favor de ingresar datos');
INSERT INTO `lang_definitions` VALUES (56, 61, 3, 'Escoja Paciente');
INSERT INTO `lang_definitions` VALUES (57, 62, 3, 'por');
INSERT INTO `lang_definitions` VALUES (58, 63, 3, 'Apellido');
INSERT INTO `lang_definitions` VALUES (59, 64, 3, 'Volver');
INSERT INTO `lang_definitions` VALUES (60, 65, 3, 'Primer Nombre');
INSERT INTO `lang_definitions` VALUES (61, 66, 3, 'Segundo Nombre');
INSERT INTO `lang_definitions` VALUES (62, 67, 3, 'Nmero de Expediente');
INSERT INTO `lang_definitions` VALUES (63, 68, 3, 'Omitir para Autoasignaci�');
INSERT INTO `lang_definitions` VALUES (64, 69, 3, 'Usuario');
INSERT INTO `lang_definitions` VALUES (65, 70, 3, 'Informaci� de Nuevas Facilidades');
INSERT INTO `lang_definitions` VALUES (66, 71, 3, 'Pa�');
INSERT INTO `lang_definitions` VALUES (67, 72, 3, 'Direcci�');
INSERT INTO `lang_definitions` VALUES (69, 74, 3, 'Estado');
INSERT INTO `lang_definitions` VALUES (70, 75, 3, 'Ciudad');
INSERT INTO `lang_definitions` VALUES (71, 76, 3, 'Seguro Social Patronal');
INSERT INTO `lang_definitions` VALUES (72, 77, 3, 'Acepta Facturaci�');
INSERT INTO `lang_definitions` VALUES (73, 78, 3, 'Centro de Facturaci�');
INSERT INTO `lang_definitions` VALUES (74, 79, 3, 'Aplicable si es Centro de Facturaci�');
INSERT INTO `lang_definitions` VALUES (75, 80, 3, 'Cod�o de Lugar de Servic�');
INSERT INTO `lang_definitions` VALUES (76, 81, 3, 'Facturas a Nombre');
INSERT INTO `lang_definitions` VALUES (77, 82, 3, 'C�igo de Laboratorio Cl�ico');
INSERT INTO `lang_definitions` VALUES (78, 83, 3, 'Tel�ono');
INSERT INTO `lang_definitions` VALUES (79, 84, 3, 'como');
INSERT INTO `lang_definitions` VALUES (80, 85, 3, 'Editar Informaci� de Facilidades');
INSERT INTO `lang_definitions` VALUES (81, 86, 3, 'Informaci� de Facilidades');
INSERT INTO `lang_definitions` VALUES (82, 87, 3, 'Actualizar');
INSERT INTO `lang_definitions` VALUES (83, 88, 3, 'Administracion de Usuarios');
INSERT INTO `lang_definitions` VALUES (84, 89, 3, 'Usuario');
INSERT INTO `lang_definitions` VALUES (85, 90, 3, 'Autorizado');
INSERT INTO `lang_definitions` VALUES (86, 91, 3, 'Nmero de Identifcaci� Federal');
INSERT INTO `lang_definitions` VALUES (87, 92, 3, 'Ver Autorizaciones');
INSERT INTO `lang_definitions` VALUES (88, 93, 3, 'Ninguno');
INSERT INTO `lang_definitions` VALUES (89, 94, 3, 'Mio Solamente');
INSERT INTO `lang_definitions` VALUES (90, 95, 3, 'Todos');
INSERT INTO `lang_definitions` VALUES (91, 96, 3, 'Informaci� Addicional');
INSERT INTO `lang_definitions` VALUES (92, 97, 3, 'Guardar Cambios');
INSERT INTO `lang_definitions` VALUES (93, 98, 3, 'Dejar en Blanco para no cambiar contrase�');
INSERT INTO `lang_definitions` VALUES (94, 99, 3, 'Nombre de Cl�ica');
INSERT INTO `lang_definitions` VALUES (95, 100, 3, 'Nombre de Grupo');
INSERT INTO `lang_definitions` VALUES (96, 101, 3, 'Usuario Inicial');
INSERT INTO `lang_definitions` VALUES (97, 102, 3, 'Usuario');
INSERT INTO `lang_definitions` VALUES (98, 103, 3, 'Modificar');
INSERT INTO `lang_definitions` VALUES (99, 104, 3, 'Nombre Real');
INSERT INTO `lang_definitions` VALUES (100, 105, 3, 'Informaci�');
INSERT INTO `lang_definitions` VALUES (101, 106, 3, 'si');
INSERT INTO `lang_definitions` VALUES (102, 107, 3, 'Salir de Administraci�');
INSERT INTO `lang_definitions` VALUES (103, 108, 3, 'Ver Registro');
INSERT INTO `lang_definitions` VALUES (104, 109, 3, 'Registro');
INSERT INTO `lang_definitions` VALUES (105, 110, 3, 'Idioma');
INSERT INTO `lang_definitions` VALUES (106, 111, 3, 'Base de Datos');
INSERT INTO `lang_definitions` VALUES (107, 116, 3, 'Communicaci�');
INSERT INTO `lang_definitions` VALUES (108, 112, 3, 'Calendario');
INSERT INTO `lang_definitions` VALUES (109, 114, 3, 'Formularios');
INSERT INTO `lang_definitions` VALUES (110, 113, 3, 'Consultorio');
INSERT INTO `lang_definitions` VALUES (111, 115, 3, 'Usuarios y Grupos');
INSERT INTO `lang_definitions` VALUES (112, 117, 3, 'Modificar Facilidades');
INSERT INTO `lang_definitions` VALUES (113, 118, 3, 'Usuario Nuevo');
INSERT INTO `lang_definitions` VALUES (114, 119, 3, 'Grupo Nuevo');
INSERT INTO `lang_definitions` VALUES (115, 120, 3, 'Agrega Usuario a Grupo');
INSERT INTO `lang_definitions` VALUES (116, 121, 3, 'D� Laboral');
INSERT INTO `lang_definitions` VALUES (117, 123, 3, 'mes');
INSERT INTO `lang_definitions` VALUES (118, 122, 3, 'semana');
INSERT INTO `lang_definitions` VALUES (119, 124, 3, 'a�');
INSERT INTO `lang_definitions` VALUES (120, 126, 3, '2ndo');
INSERT INTO `lang_definitions` VALUES (121, 127, 3, '3er');
INSERT INTO `lang_definitions` VALUES (122, 128, 3, '4to');
INSERT INTO `lang_definitions` VALUES (123, 129, 3, '5to');
INSERT INTO `lang_definitions` VALUES (124, 130, 3, '6to');
INSERT INTO `lang_definitions` VALUES (125, 125, 3, 'cada');
INSERT INTO `lang_definitions` VALUES (126, 131, 3, 'Localizar');
INSERT INTO `lang_definitions` VALUES (127, 132, 3, 'Cancelar');
INSERT INTO `lang_definitions` VALUES (128, 133, 3, 'Guardar');
INSERT INTO `lang_definitions` VALUES (129, 134, 3, 'Eliminar');
INSERT INTO `lang_definitions` VALUES (130, 135, 3, 'Registro');
INSERT INTO `lang_definitions` VALUES (131, 136, 3, 'Evento');
INSERT INTO `lang_definitions` VALUES (132, 137, 3, 'Atenci�');
INSERT INTO `lang_definitions` VALUES (133, 138, 3, 'Registrado');
INSERT INTO `lang_definitions` VALUES (134, 139, 3, 'No Registrado');
INSERT INTO `lang_definitions` VALUES (135, 140, 3, 'Administraci� de Formularios');
INSERT INTO `lang_definitions` VALUES (136, 142, 3, 'desactivado');
INSERT INTO `lang_definitions` VALUES (137, 141, 3, 'activado');
INSERT INTO `lang_definitions` VALUES (138, 143, 3, 'Instalado');
INSERT INTO `lang_definitions` VALUES (139, 144, 3, 'PHP descomprimido');
INSERT INTO `lang_definitions` VALUES (140, 145, 3, 'Instalar');
INSERT INTO `lang_definitions` VALUES (141, 146, 3, 'Informe de Facturaci�');
INSERT INTO `lang_definitions` VALUES (142, 147, 3, 'Notas Oficiales');
INSERT INTO `lang_definitions` VALUES (143, 149, 3, 'Activos');
INSERT INTO `lang_definitions` VALUES (144, 150, 3, 'Inactivos');
INSERT INTO `lang_definitions` VALUES (145, 148, 3, 'Ver');
INSERT INTO `lang_definitions` VALUES (146, 151, 3, 'Modificar Actividad');
INSERT INTO `lang_definitions` VALUES (147, 152, 3, 'Agregar Nota Nueva');
INSERT INTO `lang_definitions` VALUES (148, 153, 3, 'Modificar Contrase�');
INSERT INTO `lang_definitions` VALUES (149, 154, 3, 'Al cambiar su contrase�, Re-valida.');
INSERT INTO `lang_definitions` VALUES (150, 155, 3, 'Nuevamente');
INSERT INTO `lang_definitions` VALUES (151, 156, 3, 'O');
INSERT INTO `lang_definitions` VALUES (152, 157, 3, 'Sexo');
INSERT INTO `lang_definitions` VALUES (153, 158, 3, 'Formato');
INSERT INTO `lang_definitions` VALUES (154, 159, 3, 'Citado entre');
INSERT INTO `lang_definitions` VALUES (155, 160, 3, 'Visto desde');
INSERT INTO `lang_definitions` VALUES (156, 161, 3, 'No visto desde');
INSERT INTO `lang_definitions` VALUES (157, 162, 3, 'Organizado por');
INSERT INTO `lang_definitions` VALUES (158, 163, 3, 'Correo Electronico por');
INSERT INTO `lang_definitions` VALUES (159, 164, 3, 'Tema de Correo Electronico');
INSERT INTO `lang_definitions` VALUES (160, 165, 3, 'Texto de Correo Electronico, Utiliza formato de Tag: ***NAME*** , eg. Saludos ***NAME***');
INSERT INTO `lang_definitions` VALUES (161, 166, 3, 'Processo Lento');
INSERT INTO `lang_definitions` VALUES (162, 167, 3, 'Solamente para uso de  Correo Electronico a pacientes');
INSERT INTO `lang_definitions` VALUES (163, 168, 3, 'Edad desde');
INSERT INTO `lang_definitions` VALUES (164, 169, 3, 'Hasta');
INSERT INTO `lang_definitions` VALUES (165, 171, 3, 'Contacto');
INSERT INTO `lang_definitions` VALUES (166, 172, 3, 'No enviado por error con servidor');
INSERT INTO `lang_definitions` VALUES (167, 173, 3, 'Correo Electronico no enviado');
INSERT INTO `lang_definitions` VALUES (168, 170, 3, 'Empleo');
INSERT INTO `lang_definitions` VALUES (169, 174, 3, 'Ignorar HIPAA');
INSERT INTO `lang_definitions` VALUES (170, 175, 3, 'Archivo CSV');
INSERT INTO `lang_definitions` VALUES (171, 177, 3, 'Correo Electr�ico');
INSERT INTO `lang_definitions` VALUES (172, 176, 3, 'Lista de llamadas telef�icas');
INSERT INTO `lang_definitions` VALUES (173, 178, 3, 'Cualquier');

#EndIf

#IfMissingColumn registry priority
## alters to categorize forms / per Mark 
ALTER TABLE registry ADD COLUMN priority INT DEFAULT 0 AFTER date;
ALTER TABLE registry ADD COLUMN category VARCHAR(255) DEFAULT "category" AFTER priority;
ALTER TABLE registry ADD COLUMN nickname VARCHAR(255) DEFAULT '' AFTER category;
#EndIf

#IfMissingColumn patient_data phone_pharmacy
ALTER TABLE patient_data
  ADD phone_pharmacy varchar(255) NOT NULL default '';
#EndIf

#IfNotTable array
## array table for storing configuration data and string lists etc...
CREATE TABLE `array` (
  `array_key` varchar(255) default NULL,
  `array_value` longtext
) ENGINE=MyISAM;
#EndIf

#IfMissingColumn patient_data drivers_license
ALTER TABLE patient_data
  ADD drivers_license varchar(255) NOT NULL default '';
#EndIf

#IfNotColumnType form_vitals oxygen_saturation float(5,2)
ALTER TABLE form_vitals
  MODIFY oxygen_saturation float(5,2) default 0;
#EndIf

#IfNotTable drugs
CREATE TABLE drugs (
  drug_id       int(11)      NOT NULL auto_increment,
  name          varchar(255) NOT NULL DEFAULT '',
  ndc_number    varchar(20)  NOT NULL DEFAULT '',
  on_order      int(11)      NOT NULL DEFAULT 0,
  reorder_point int(11)      NOT NULL DEFAULT 0,
  last_notify   date         NOT NULL DEFAULT '0000-00-00',
  reactions     text         NOT NULL DEFAULT '',
  form          int(3)       NOT NULL DEFAULT 0,
  size          int(11)      NOT NULL DEFAULT 0,
  unit          int(11)      NOT NULL DEFAULT 0,
  route         int(11)      NOT NULL DEFAULT 0,
  substitute    int(11)      NOT NULL DEFAULT 0,
  PRIMARY KEY (drug_id)
) ENGINE=MyISAM;
CREATE TABLE drug_inventory (
  inventory_id    int(11)      NOT NULL auto_increment,
  drug_id         int(11)      NOT NULL,
  lot_number      varchar(20)  NOT NULL DEFAULT '',
  expiration      date         DEFAULT NULL,
  manufacturer    varchar(255) NOT NULL DEFAULT '',
  on_hand         int(11)      NOT NULL DEFAULT 0,
  last_notify     date         NOT NULL DEFAULT '0000-00-00',
  PRIMARY KEY (inventory_id)
) ENGINE=MyISAM;
CREATE TABLE drug_sales (
  sale_id         int(11)      NOT NULL auto_increment,
  drug_id         int(11)      NOT NULL,
  inventory_id    int(11)      NOT NULL,
  prescription_id int(11)      NOT NULL DEFAULT 0,
  pid             int(11)      NOT NULL DEFAULT 0,
  encounter       int(11)      NOT NULL DEFAULT 0,
  user            varchar(255) NOT NULL DEFAULT '',
  sale_date       date         NOT NULL,
  quantity        int(11)      NOT NULL DEFAULT 0,
  fee             decimal(7,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (sale_id)
) ENGINE=MyISAM;
#EndIf

#IfMissingColumn prescriptions drug_id
ALTER TABLE prescriptions
  ADD drug_id    int(11) NOT NULL DEFAULT 0;
#EndIf

#IfMissingColumn patient_data pharmacy_id
ALTER TABLE patient_data
  ADD pharmacy_id     int(11)     NOT NULL DEFAULT 0,
  ADD referral_source varchar(30) NOT NULL DEFAULT '';
#EndIf

#IfNotRow lang_languages lang_id 4
# new options in lang tables
INSERT INTO `lang_languages` (`lang_id`, `lang_code`, `lang_description`) VALUES (4, 'de', 'German');
INSERT INTO `lang_languages` (`lang_id`, `lang_code`, `lang_description`) VALUES (5, 'du', 'Dutch');
INSERT INTO `lang_languages` (`lang_id`, `lang_code`, `lang_description`) VALUES (6, 'he', 'Hebrew');
#EndIf

#IfMissingColumn openemr_postcalendar_events pc_prefcatid
ALTER TABLE openemr_postcalendar_events
  ADD pc_prefcatid int(11) NOT NULL DEFAULT 0;
#EndIf

#IfMissingColumn prescriptions medication
# Option to deal with prescriptions on the medication list
ALTER TABLE prescriptions
  ADD medication int(11);
#EndIf

#IfMissingColumn facility fax
# Add fax to facility table
ALTER TABLE facility
  ADD fax varchar(30) default NULL;
#EndIf

#IfNotTable drug_templates
CREATE TABLE drug_templates (
  drug_id       int(11)      NOT NULL,
  selector      varchar(255) NOT NULL,
  dosage        varchar(10)  NOT NULL DEFAULT '',
  period        int(11)      NOT NULL DEFAULT 0,
  quantity      int(11)      NOT NULL DEFAULT 0,
  refills       int(11)      NOT NULL DEFAULT 0,
  PRIMARY KEY (drug_id, selector)
) ENGINE=MyISAM;
#EndIf

#IfMissingColumn drug_inventory destroy_date
ALTER TABLE drug_inventory
  ADD destroy_date    date         DEFAULT NULL,
  ADD destroy_method  varchar(255) NOT NULL DEFAULT '',
  ADD destroy_witness varchar(255) NOT NULL DEFAULT '',
  ADD destroy_notes   varchar(255) NOT NULL DEFAULT '';
#EndIf

#IfNotColumnType prescriptions size float
ALTER TABLE prescriptions
  MODIFY `size` float unsigned DEFAULT NULL;
#EndIf

#IfNotColumnType drugs size float
ALTER TABLE drugs
  MODIFY `size` float unsigned NOT NULL DEFAULT 0;
#EndIf

#IfMissingColumn form_encounter sensitivity
ALTER TABLE form_encounter
  ADD sensitivity varchar(30) NOT NULL DEFAULT '';
#EndIf

#IfMissingColumn lists returndate
ALTER TABLE lists
  ADD returndate date DEFAULT NULL;
#EndIf

#IfMissingColumn users active
ALTER TABLE users
  ADD active    tinyint(1)   NOT NULL DEFAULT 1,
  ADD npi       varchar(15)  NOT NULL DEFAULT '',
  ADD specialty varchar(255) NOT NULL DEFAULT '',
  ADD billname  varchar(255) NOT NULL DEFAULT '',
  ADD email     varchar(255) NOT NULL DEFAULT '',
  ADD url       varchar(255) NOT NULL DEFAULT '',
  ADD street    varchar(60)  NOT NULL DEFAULT '',
  ADD city      varchar(30)  NOT NULL DEFAULT '',
  ADD state     varchar(30)  NOT NULL DEFAULT '',
  ADD zip       varchar(20)  NOT NULL DEFAULT '',
  ADD phone     varchar(30)  NOT NULL DEFAULT '',
  ADD fax       varchar(30)  NOT NULL DEFAULT '',
  ADD title     varchar(30)  NOT NULL DEFAULT '',
  ADD phonew1   varchar(30)  NOT NULL DEFAULT '',
  ADD phonew2   varchar(30)  NOT NULL DEFAULT '',
  ADD phonecell varchar(30)  NOT NULL DEFAULT '',
  ADD assistant varchar(255) NOT NULL DEFAULT '',
  ADD street2   varchar(60)  NOT NULL DEFAULT '',
  ADD city2     varchar(30)  NOT NULL DEFAULT '',
  ADD state2    varchar(30)  NOT NULL DEFAULT '',
  ADD zip2      varchar(20)  NOT NULL DEFAULT '';
#EndIf

#IfMissingColumn patient_data hipaa_notice
ALTER TABLE patient_data
  ADD `hipaa_notice`  VARCHAR(3)  DEFAULT 'NO' NOT NULL,
  ADD `hipaa_message` VARCHAR(20);
#EndIf

#IfNotColumnType prescriptions dosage varchar(100)
ALTER TABLE prescriptions
  MODIFY `dosage`   varchar(100) DEFAULT NULL,
  MODIFY `quantity` varchar(11)  DEFAULT NULL;
#EndIf
