-
Notifications
You must be signed in to change notification settings - Fork 0
/
engenharia reversa.sql
68 lines (58 loc) · 2.48 KB
/
engenharia reversa.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
-- 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_blogpessoal
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema db_blogpessoal
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `db_blogpessoal` DEFAULT CHARACTER SET utf8 ;
USE `db_blogpessoal` ;
-- -----------------------------------------------------
-- Table `db_blogpessoal`.`tb_usuario`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_blogpessoal`.`tb_usuario` (
`id` BIGINT NOT NULL,
`nome` VARCHAR(255) NOT NULL,
`usuario` VARCHAR(255) NOT NULL,
`senha` VARCHAR(255) NOT NULL,
`foto` VARCHAR(255) NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `db_blogpessoal`.`tb_temas`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_blogpessoal`.`tb_temas` (
`id` BIGINT NOT NULL,
`descricao` VARCHAR(255) NOT NULL,
PRIMARY KEY (`id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `db_blogpessoal`.`tb_postagens`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `db_blogpessoal`.`tb_postagens` (
`id` BIGINT NOT NULL,
`titulo` VARCHAR(255) NOT NULL,
`texto` VARCHAR(255) NOT NULL,
`data` DATETIME(1) NULL,
`tb_temas_id` BIGINT NOT NULL,
`tb_usuario_id` BIGINT NOT NULL,
PRIMARY KEY (`id`),
INDEX `fk_tb_postagens_tb_temas_idx` (`tb_temas_id` ASC) VISIBLE,
INDEX `fk_tb_postagens_tb_usuario1_idx` (`tb_usuario_id` ASC) VISIBLE,
CONSTRAINT `fk_tb_postagens_tb_temas`
FOREIGN KEY (`tb_temas_id`)
REFERENCES `db_blogpessoal`.`tb_temas` (`id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_tb_postagens_tb_usuario1`
FOREIGN KEY (`tb_usuario_id`)
REFERENCES `db_blogpessoal`.`tb_usuario` (`id`)
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;