-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoswebSQL.sql
81 lines (69 loc) · 2.74 KB
/
PoswebSQL.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
79
80
81
-- MySQL Script generated by MySQL Workbench
-- Sun Jun 4 21:27:49 2017
-- 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='TRADITIONAL,ALLOW_INVALID_DATES';
-- -----------------------------------------------------
-- Schema mydb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema posweb
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema posweb
-- -----------------------------------------------------
CREATE SCHEMA IF NOT EXISTS `posweb` DEFAULT CHARACTER SET utf8 ;
USE `posweb` ;
-- -----------------------------------------------------
-- Table `posweb`.`contato`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `posweb`.`contato` (
`contact_id` INT(11) NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) NOT NULL,
`idade` INT(11) NOT NULL,
`nome` VARCHAR(255) NOT NULL,
`sobrenome` VARCHAR(255) NOT NULL,
`telefone` VARCHAR(255) NOT NULL,
PRIMARY KEY (`contact_id`),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = MyISAM
AUTO_INCREMENT = 5
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `posweb`.`user`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `posweb`.`user` (
`user_id` INT(11) NOT NULL AUTO_INCREMENT,
`email` VARCHAR(255) NOT NULL,
`nome` VARCHAR(255) NOT NULL,
`senha` VARCHAR(255) NOT NULL,
`ativo` TINYINT(1) NOT NULL DEFAULT 1,
PRIMARY KEY (`user_id`),
UNIQUE INDEX `email_UNIQUE` (`email` ASC))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `posweb`.`roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `posweb`.`roles` (
`role_id` INT(11) NOT NULL AUTO_INCREMENT,
`type` VARCHAR(5) NOT NULL,
PRIMARY KEY (`role_id`))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;
-- -----------------------------------------------------
-- Table `posweb`.`user_has_roles`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `posweb`.`user_has_roles` (
`user_id` INT(11) NOT NULL,
`role_id` INT(11) NOT NULL,
PRIMARY KEY (`user_id`, `role_id`),
INDEX `fk_tb_usuario_has_user_profile_user_profile1_idx` (`role_id` ASC),
INDEX `fk_tb_usuario_has_user_profile_tb_usuario_idx` (`user_id` ASC))
ENGINE = MyISAM
DEFAULT CHARACTER SET = utf8;
SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;