-
Notifications
You must be signed in to change notification settings - Fork 0
/
studio_fer_tolentino_data.sql
193 lines (167 loc) · 7.24 KB
/
studio_fer_tolentino_data.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
-- MySQL Script generated by MySQL Workbench
-- Tue Jun 13 12:01:39 2023
-- 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 studio_fer_tolentino
-- -----------------------------------------------------
-- -----------------------------------------------------
-- Schema studio_fer_tolentino
-- -----------------------------------------------------
/* CREATE SCHEMA IF NOT EXISTS `studio_fer_tolentino` DEFAULT CHARACTER SET utf8 ;
USE `studio_fer_tolentino` ; */
-- -----------------------------------------------------
-- Table `groups`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `groups` (
`id` mediumint(8) UNSIGNED NOT NULL,
`name` varchar(20) NOT NULL,
`description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- -----------------------------------------------------
-- Table DATA `groups`
-- -----------------------------------------------------
INSERT INTO `groups` (`id`, `name`, `description`) VALUES
(1, 'admin', 'Administrator');
-- -----------------------------------------------------
-- Table `login_attempts`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `login_attempts` (
`id` int(11) UNSIGNED NOT NULL,
`ip_address` varchar(45) NOT NULL,
`login` varchar(100) NOT NULL,
`time` int(11) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- -----------------------------------------------------
-- Table `users`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) UNSIGNED NOT NULL,
`ip_address` varchar(45) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(254) NOT NULL,
`activation_selector` varchar(255) DEFAULT NULL,
`activation_code` varchar(255) DEFAULT NULL,
`forgotten_password_selector` varchar(255) DEFAULT NULL,
`forgotten_password_code` varchar(255) DEFAULT NULL,
`forgotten_password_time` int(11) UNSIGNED DEFAULT NULL,
`remember_selector` varchar(255) DEFAULT NULL,
`remember_code` varchar(255) DEFAULT NULL,
`created_on` int(11) UNSIGNED NOT NULL,
`last_login` int(11) UNSIGNED DEFAULT NULL,
`active` tinyint(1) UNSIGNED DEFAULT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`company` varchar(100) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- -----------------------------------------------------
-- Table DATA `users`
-- -----------------------------------------------------
INSERT INTO `users` (`id`, `ip_address`, `username`, `password`, `email`, `activation_selector`, `activation_code`, `forgotten_password_selector`, `forgotten_password_code`, `forgotten_password_time`, `remember_selector`, `remember_code`, `created_on`, `last_login`, `active`, `first_name`, `last_name`, `company`, `phone`) VALUES
(1, '::1', 'Cassiano22', '$2y$10$e1Wj3agwPPXiKFVIpGXKnuu2uhf.NUe1WJH/h.NLF4LUW3zIANWQa', '[email protected]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1640691954, 1686659334, 1, 'Cassiano', 'Tolentino Russo', NULL, NULL);
-- -----------------------------------------------------
-- Table `users_groups`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `users_groups` (
`id` int(11) UNSIGNED NOT NULL,
`user_id` int(11) UNSIGNED NOT NULL,
`group_id` mediumint(8) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- -----------------------------------------------------
-- Table `servicos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `servicos` (
`servico_id` INT NOT NULL AUTO_INCREMENT,
`servico_nome` VARCHAR(255) NOT NULL,
`servico_valor` VARCHAR(10) NOT NULL,
`servico_ativo` INT(1) NOT NULL,
`servico_descricao` TEXT NULL,
PRIMARY KEY (`servico_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `produtos`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `produtos` (
`produto_id` INT NOT NULL AUTO_INCREMENT,
`produto_nome` VARCHAR(255) NOT NULL,
`produto_valor` VARCHAR(10) NOT NULL,
`produto_ativo` INT(1) NOT NULL,
`produto_descricao` TEXT NULL,
PRIMARY KEY (`produto_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `clientes`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `clientes` (
`cliente_id` INT NOT NULL AUTO_INCREMENT,
`cliente_nome` VARCHAR(255) NOT NULL,
`cliente_telefone` VARCHAR(20) NOT NULL,
`cliente_email` VARCHAR(255) NULL,
`cliente_aniversario` DATE NOT NULL,
`cliente_ativo` INT(1) NOT NULL,
`cliente_informacao` TEXT NULL,
PRIMARY KEY (`cliente_id`))
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `caixa`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `caixa` (
`caixa_id` INT NOT NULL AUTO_INCREMENT,
`caixa_valor` VARCHAR(255) NOT NULL,
`caixa_data` DATETIME NOT NULL,
`caixa_status` INT(1) NOT NULL,
`servicos_servico_id` INT NULL,
`produtos_produto_id` INT NULL,
`clientes_cliente_id` INT NULL,
PRIMARY KEY (`caixa_id`),
INDEX `fk_caixa_servicos_idx` (`servicos_servico_id` ASC),
INDEX `fk_caixa_produtos1_idx` (`produtos_produto_id` ASC),
INDEX `fk_caixa_clientes1_idx` (`clientes_cliente_id` ASC),
CONSTRAINT `fk_caixa_servicos`
FOREIGN KEY (`servicos_servico_id`)
REFERENCES `servicos` (`servico_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_caixa_produtos1`
FOREIGN KEY (`produtos_produto_id`)
REFERENCES `produtos` (`produto_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_caixa_clientes1`
FOREIGN KEY (`clientes_cliente_id`)
REFERENCES `clientes` (`cliente_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION)
ENGINE = InnoDB;
-- -----------------------------------------------------
-- Table `agenda`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS `agenda` (
`agenda_id` INT NOT NULL AUTO_INCREMENT,
`agenda_data` DATE NOT NULL,
`agenda_horario_inicial` TIME NOT NULL,
`agenda_horario_final` TIME NOT NULL,
`clientes_cliente_id` INT NULL,
`servicos_servico_id` INT NULL,
INDEX `fk_agenda_clientes1_idx` (`clientes_cliente_id` ASC) ,
INDEX `fk_agenda_servicos1_idx` (`servicos_servico_id` ASC) ,
PRIMARY KEY (`agenda_id`),
CONSTRAINT `fk_agenda_clientes1`
FOREIGN KEY (`clientes_cliente_id`)
REFERENCES `clientes` (`cliente_id`)
ON DELETE NO ACTION
ON UPDATE NO ACTION,
CONSTRAINT `fk_agenda_servicos1`
FOREIGN KEY (`servicos_servico_id`)
REFERENCES `servicos` (`servico_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;