-
Notifications
You must be signed in to change notification settings - Fork 0
/
DERprojetoIntegrador.sql
78 lines (68 loc) · 2.87 KB
/
DERprojetoIntegrador.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
-- MySQL Script generated by MySQL Workbench
-- Wed Mar 6 15:23:59 2024
-- Model: New Model Version: 1.0
-- MySQL Workbench Forward Engineering
SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;
SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;
SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';
-- -----------------------------------------------------
-- Schema db_greenGen72
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema db_greenGen72
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `db_greenGen72` DEFAULT CHARACTER SET utf8 ;
USE `db_greenGen72` ;
-- -----------------------------------------------------
-- Table `db_greenGen72`.`tb_categorias`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_greenGen72`.`tb_categorias` (
`id_categorias` BIGINT NOT NULL,
`descricao` VARCHAR(255) NOT NULL,
`nome` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id_categorias`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `db_greenGen72`.`tb_usuarios`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_greenGen72`.`tb_usuarios` (
`id_usuarios` BIGINT NOT NULL,
`nome` VARCHAR(45) NOT NULL,
`usuario` VARCHAR(45) NOT NULL,
`senha` VARCHAR(100) NOT NULL,
`email` VARCHAR(45) NOT NULL,
`endereco` VARCHAR(250) NOT NULL,
`telefone` INT NOT NULL,
`pontos` INT NOT NULL,
PRIMARY KEY (`id_usuarios`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `db_greenGen72`.`tb_produtos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_greenGen72`.`tb_produtos` (
`id_produtos` BIGINT NOT NULL,
`nome` VARCHAR(255) NOT NULL,
`descricao` VARCHAR(255) NOT NULL,
`preco` DECIMAL(8,2) NOT NULL,
`quantidade` INT NOT NULL,
`foto` VARCHAR(5000) NOT NULL,
`pontos` INT NOT NULL,
`fk_id_categoria` BIGINT NOT NULL,
`fk_id_usuarios` BIGINT NOT NULL,
PRIMARY KEY (`id_produtos`, `fk_id_categoria`, `fk_id_usuarios`),
INDEX `fk_tb_produtos_tb_categoria_idx` (`fk_id_categoria` ASC) VISIBLE,
INDEX `fk_tb_produtos_tb_usuarios1_idx` (`fk_id_usuarios` ASC) VISIBLE,
CONSTRAINT `fk_tb_produtos_tb_categoria`
FOREIGN KEY (`fk_id_categoria`)
REFERENCES `db_greenGen72`.`tb_categorias` (`id_categorias`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tb_produtos_tb_usuarios1`
FOREIGN KEY (`fk_id_usuarios`)
REFERENCES `db_greenGen72`.`tb_usuarios` (`id_usuarios`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;