Created
June 8, 2019 05:40
-
-
Save barraponto/9914e135bfacd7a660026fd912829e11 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE problemas ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
problema_1 VARCHAR(100) NOT NULL, | |
problema_2 VARCHAR(100), | |
problema_3 VARCHAR(100), | |
problema_4 VARCHAR(100), | |
problema_5 VARCHAR(100), | |
problema_6 VARCHAR(100), | |
problema_7 VARCHAR(100), | |
problema_8 VARCHAR(100), | |
problema_9 VARCHAR(100), | |
problema_10 VARCHAR(100) | |
); | |
CREATE TABLE cliente ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
nome VARCHAR(100) NOT NULL, | |
cpf_cnpj VARCHAR(50), | |
tipo_pessoa VARCHAR(2), | |
tipo_empresa VARCHAR(100), | |
tel_1 VARCHAR(15), | |
tel_2 VARCHAR(15), | |
tel_3 VARCHAR(15), | |
email VARCHAR(100) NOT NULL, | |
logradouro VARCHAR(100), | |
numero INT, | |
bairro VARCHAR(100), | |
cidade VARCHAR(100), | |
estado_sigla VARCHAR(2), | |
cep CHAR(7) | |
); | |
CREATE TABLE impressoras ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
cliente INT NOT NULL, | |
serie VARCHAR(100), | |
marca VARCHAR(100), | |
modelo VARCHAR(100), | |
data_compra DATE, | |
FOREIGN KEY fk_cliente(cliente) REFERENCES cliente(id) | |
); | |
CREATE TABLE solucoes ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
solucao TEXT | |
); | |
CREATE TABLE historico ( | |
id INT AUTO_INCREMENT PRIMARY KEY, | |
problema INT NOT NULL, | |
impressora INT NOT NULL, | |
bot_resolve BOOLEAN, | |
tecnico_resolve BOOLEAN, | |
solucao INT, | |
inicio_atendimento DATETIME NOT NULL, | |
fim_atendimento DATETIME, | |
FOREIGN KEY fk_problema(problema) REFERENCES problemas(id), | |
FOREIGN KEY fk_impressora(impressora) REFERENCES impressoras(id), | |
FOREIGN KEY fk_solucao(solucao) REFERENCES solucoes(id) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment