-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomandos-sql.txt
More file actions
57 lines (47 loc) · 1.52 KB
/
comandos-sql.txt
File metadata and controls
57 lines (47 loc) · 1.52 KB
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
create Table autor(
id uuid not null primary key,
nome varchar(100) not null,
data_nascimento date not null,
nacionalidade varchar (50) not null,
data_cadastro timestamp,
data_atualizacao timestamp,
id_usuario uuid
);
create table livro (
id uuid not null primary key,
isbn varchar(20) not null unique,
titulo varchar(450) not null,
data_publicacao date not null,
genero varchar(30) not null,
preco numeric(18,2),
data_cadastro timestamp,
data_atualizacao timestamp,
id_usuario uuid
id_autor uuid not null references autor(id),
constraint chk_genero check(genero in('FICCAO', 'FANTASIA', 'MISTERIO', 'ROMANCE', 'BIOGRAFIA', 'CIENCIA'))
);
create table usuario(
id uuid not null primary key,
login varchar(20) not null unique,
senha varchar(300) not null,
email varchar(150) notnull,
roles varchar[]
);
create table client (
id uuid not null primary key,
client_id varchar(150) not null,
client_secret varchar(400) not null,
redirect_uri varchar (200) not null,
scope varchar(50)
);
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
insert into usuario
(id, login, senha, email, roles)
values
( uuid_generate_v4(), 'gerente','$2a$12$Se/AgTx25qZjTKRM335cM.OAMXVuzyOZgIQJTIbpSvJjg4CUmatd2','gerente@gmail.com','{GERENTE}');
INSERT INTO client
(id, client_id, client_secret, redirect_uri, scope)
values
(uuid_generate_v4(), 'client-prod', '$2a$12$xQXkyMSTgB4.HA.Y.SC5E.5eLKgHJ18AIAxJe6e58GF0rSzPmcQ6m', 'http://localhost:8080/authorized', 'GERENTE');
select * from client;
select * from usuario;