-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
realizando a implementação do flyway no projeto
- Loading branch information
1 parent
6c3f290
commit fbc9dbd
Showing
6 changed files
with
66 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
VideoLocadora/src/main/resources/db.migration/V1__customer_address.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CREATE TABLE address | ||
( | ||
id BIGINT AUTO_INCREMENT NOT NULL, | ||
street VARCHAR(255) NOT NULL COMMENT 'Rua', | ||
number INT NULL COMMENT 'Número', | ||
city VARCHAR(255) NOT NULL COMMENT 'Cidade', | ||
state VARCHAR(255) NOT NULL COMMENT 'Estado', | ||
country VARCHAR(255) NOt NULL COMMENT 'País', | ||
zip_code VARCHAR(255) NOT NULL COMMENT 'CEP', | ||
is_active BIT(1) NOT NULL COMMENT 'Endereço ativo', | ||
is_primary_address BIT(1) NOT NULL COMMENT 'Endereço principal', | ||
customer_id BIGINT NOT NULL COMMENT 'Id do cliente', | ||
CONSTRAINT pk_address PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE customer | ||
( | ||
id BIGINT AUTO_INCREMENT NOT NULL, | ||
name VARCHAR(255) NULL COMMENT 'Nome', | ||
cpf VARCHAR(255) NULL COMMENT 'CPF', | ||
email VARCHAR(255) NULL COMMENT 'Email', | ||
delay_devolution BIT(1) NULL COMMENT 'Tem atraso alguma devolução', | ||
CONSTRAINT pk_customer PRIMARY KEY (id) | ||
); | ||
|
||
ALTER TABLE address ADD CONSTRAINT FK_ADDRESS_ON_CUSTOMER FOREIGN KEY (customer_id) REFERENCES customer (id); |
12 changes: 12 additions & 0 deletions
12
VideoLocadora/src/main/resources/db.migration/V2__insert_customers.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Inserções para a tabela customer | ||
INSERT INTO customer (name, cpf, email, delay_devolution) VALUES | ||
('Ana Silva', '12345678901', 'ana.silva@email.com', 0), | ||
('Bruno Oliveira', '98765432109', 'bruno.oliveira@email.com', 1), | ||
('Carla Souza', '45678901234', 'carla.souza@email.com', 0), | ||
('Daniel Pereira', '65432109876', 'daniel.pereira@email.com', 1), | ||
('Elisa Santos', '78901234567', 'elisa.santos@email.com', 0), | ||
('Fernando Lima', '01234567890', 'fernando.lima@email.com', 1), | ||
('Gabriela Rocha', '34567890123', 'gabriela.rocha@email.com', 0), | ||
('Henrique Costa', '21098765432', 'henrique.costa@email.com', 1), | ||
('Isabela Gomes', '56789012345', 'isabela.gomes@email.com', 0), | ||
('João Rodrigues', '89012345678', 'joao.rodrigues@email.com', 1); |
12 changes: 12 additions & 0 deletions
12
VideoLocadora/src/main/resources/db.migration/V3__insert_addresses.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Inserções para a tabela address | ||
INSERT INTO address (street, number, city, state, country, zip_code, is_active, is_primary_address, customer_id) VALUES | ||
('Rua A', 123, 'São Paulo', 'SP', 'Brasil', '01000000', 1, 1, 1), | ||
('Avenida B', 456, 'Rio de Janeiro', 'RJ', 'Brasil', '20000000', 1, 1, 2), | ||
('Rua C', 789, 'Belo Horizonte', 'MG', 'Brasil', '30000000', 1, 1, 3), | ||
('Avenida D', 101, 'Porto Alegre', 'RS', 'Brasil', '90000000', 1, 1, 4), | ||
('Rua E', 202, 'Salvador', 'BA', 'Brasil', '40000000', 1, 1, 5), | ||
('Avenida F', 303, 'Recife', 'PE', 'Brasil', '50000000', 1, 1, 6), | ||
('Rua G', 404, 'Curitiba', 'PR', 'Brasil', '80000000', 1, 1, 7), | ||
('Avenida H', 505, 'Brasília', 'DF', 'Brasil', '70000000', 1, 1, 8), | ||
('Rua I', 606, 'Fortaleza', 'CE', 'Brasil', '60000000', 1, 1, 9), | ||
('Avenida J', 707, 'Manaus', 'AM', 'Brasil', '69000000', 1, 1, 10); |