-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.sql
More file actions
28 lines (26 loc) · 784 Bytes
/
init.sql
File metadata and controls
28 lines (26 loc) · 784 Bytes
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
-- Criar extensão para UUID
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Criar tabela de partidas
CREATE TABLE partida (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
quadra INT,
codigo VARCHAR(50) NOT NULL,
pagamento BOOLEAN,
ativa BOOLEAN,
data_inicio TIMESTAMP NOT NULL,
data_fim TIMESTAMP,
created_at TIMESTAMP DEFAULT current_timestamp
);
-- Criar tabela de vídeos das partidas
CREATE TABLE partida_videos (
id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
partida_id UUID NOT NULL,
path VARCHAR(255) NOT NULL,
thumbnail TEXT,
pagamento BOOLEAN,
created_at TIMESTAMP DEFAULT current_timestamp,
CONSTRAINT fk_partida
FOREIGN KEY (partida_id)
REFERENCES partida (id)
ON DELETE CASCADE
);