[add} Saving new person

This commit is contained in:
2018-08-05 23:44:46 -06:00
parent 692f52b533
commit 304e3045c7
3 changed files with 95 additions and 5 deletions

View File

@@ -16,8 +16,7 @@ CREATE TABLE IF NOT EXISTS `persons` (
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'The date on which the registry was created',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'The date of the last time the row was modified',
PRIMARY KEY (`id`),
UNIQUE (`phone`),
UNIQUE (`firstName`,`middleName`,`lastName`,`birthDate`)
UNIQUE (`phone`)
);
INSERT INTO persons (firstName, middleName, lastName, birthDate, email, phone)
@@ -60,3 +59,16 @@ CREATE TABLE IF NOT EXISTS `employeeType` (
INSERT INTO employeeType (name) VALUES ('Chofer'),
('Cargador'),
('Auxiliar');
DROP TABLE IF EXISTS employees;
CREATE TABLE IF NOT EXISTS `employees` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`idEmployeeType` INT UNSIGNED NOT NULL comment 'Defines the rol within the company',
`numero` VARCHAR(100) NOT NULL comment 'A code to reference the employee',
`contractType` ENUM('INTERNO', 'EXTERNO') NOT NULL comment 'The type of contract',
`status` ENUM('ACTIVE', 'INACTIVE') NOT NULL DEFAULT 'ACTIVE',
`created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP comment 'The date on which the registry was created',
`updated_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment 'The date of the last time the row was modified',
PRIMARY KEY (`id`),
UNIQUE (`name`)
);