-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor: Adicionei um comando de criação automática do usuário admin…
…istrador no arquivo de script SQL, onde o mesmo terá acesso a página de gerenciamento de usuário.
- Loading branch information
Showing
3 changed files
with
38 additions
and
116 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,81 @@ | ||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; | ||
START TRANSACTION; | ||
SET time_zone = "+00:00"; | ||
|
||
-- | ||
-- Execute o script SQL em seu banco de dados para criar as tabelas e inserir o usuário administrador. | ||
-- Ao tentar fazer login com o e-mail [email protected] e senha 8525, o sistema deve reconhecer o usuário como administrador e direcioná-lo para a página degerenciamento de usuário. | ||
-- Banco de dados: `seguradora` | ||
-- | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Estrutura para tabela `e0_usuario` | ||
-- | ||
|
||
CREATE TABLE `e0_usuario` ( | ||
`ID` int(11) NOT NULL, | ||
`ID` int(11) NOT NULL AUTO_INCREMENT, | ||
`NOME` varchar(140) DEFAULT NULL, | ||
`EMAIL` varchar(140) DEFAULT NULL, | ||
`SENHA` varchar(16) DEFAULT NULL | ||
`SENHA` varchar(16) DEFAULT NULL, | ||
PRIMARY KEY (`ID`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Inserção do usuário administrador | ||
-- Para acessar o usuário admin, deve-se fazer login com o e-mail "[email protected]" e senha "8525" | ||
-- | ||
INSERT INTO `e0_usuario` (`NOME`, `EMAIL`, `SENHA`) | ||
VALUES ('Administrador', '[email protected]', '8525'); | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Estrutura para tabela `e1_cliente` | ||
-- | ||
|
||
CREATE TABLE `e1_cliente` ( | ||
`COD` int(3) NOT NULL, | ||
`COD` int(11) NOT NULL AUTO_INCREMENT, | ||
`NOME` varchar(30) DEFAULT NULL, | ||
`CPF` varchar(11) DEFAULT NULL, | ||
`RG` varchar(10) DEFAULT NULL, | ||
`TEL` varchar(9) DEFAULT NULL, | ||
`FK_E2_VEICULOS_COD` int(3) DEFAULT NULL | ||
PRIMARY KEY (`COD`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Estrutura para tabela `e2_veiculos` | ||
-- | ||
|
||
CREATE TABLE `e2_veiculos` ( | ||
`COD` int(3) NOT NULL, | ||
`COD` int(11) NOT NULL AUTO_INCREMENT, | ||
`PLACA` varchar(8) DEFAULT NULL, | ||
`RENAVAN` varchar(11) DEFAULT NULL, | ||
`FABRICANTE` varchar(15) DEFAULT NULL, | ||
`MODELO` varchar(15) DEFAULT NULL, | ||
`ANO` int(4) DEFAULT NULL | ||
`ANO` int(4) DEFAULT NULL, | ||
PRIMARY KEY (`COD`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Estrutura para tabela `e3_ocorrencias` | ||
-- | ||
|
||
CREATE TABLE `e3_ocorrencias` ( | ||
`NR_OCOR` int(3) NOT NULL, | ||
`DATA` date DEFAULT NULL, | ||
`LOCAL` varchar(50) DEFAULT NULL, | ||
`DESCR` varchar(100) DEFAULT NULL | ||
`COD` int(11) NOT NULL AUTO_INCREMENT, | ||
`COD_CLIENTE` int(11) NOT NULL, | ||
`COD_VEICULO` int(11) NOT NULL, | ||
`DATA_OCORRENCIA` date DEFAULT NULL, | ||
`LOCAL_OCORRENCIA` varchar(50) DEFAULT NULL, | ||
`DESCRICAO_OCORRENCIA` varchar(100) DEFAULT NULL, | ||
PRIMARY KEY (`COD`), | ||
FOREIGN KEY (`COD_CLIENTE`) REFERENCES `e1_cliente`(`COD`), | ||
FOREIGN KEY (`COD_VEICULO`) REFERENCES `e2_veiculos`(`COD`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- Índices para tabelas despejadas | ||
|
||
-- Índices de tabela `e0_usuario` | ||
ALTER TABLE `e0_usuario` | ||
ADD PRIMARY KEY (`ID`); | ||
|
||
-- Índices de tabela `e1_cliente` | ||
ALTER TABLE `e1_cliente` | ||
ADD PRIMARY KEY (`COD`), | ||
ADD KEY `FK_E1_CLIENTE_3` (`FK_E2_VEICULOS_COD`); | ||
|
||
-- Índices de tabela `e2_veiculos` | ||
ALTER TABLE `e2_veiculos` | ||
ADD PRIMARY KEY (`COD`); | ||
|
||
-- Índices de tabela `e3_ocorrencias` | ||
ALTER TABLE `e3_ocorrencias` | ||
ADD PRIMARY KEY (`NR_OCOR`); | ||
|
||
-- AUTO_INCREMENT para tabelas despejadas | ||
|
||
-- AUTO_INCREMENT de tabela `e0_usuario` | ||
ALTER TABLE `e0_usuario` | ||
MODIFY `ID` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4; | ||
|
||
-- Restrições para tabelas despejadas | ||
|
||
-- Restrições para tabelas `e1_cliente` | ||
ALTER TABLE `e1_cliente` | ||
ADD CONSTRAINT `FK_E1_CLIENTE_3` FOREIGN KEY (`FK_E2_VEICULOS_COD`) REFERENCES `e2_veiculos` (`COD`); | ||
|
||
COMMIT; |
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