Размер видео: 1280 X 720853 X 480640 X 360
Показать панель управления
Автовоспроизведение
Автоповтор
1. Create Springboot app2. Add required maven dependencies3. Configure datasource and flyway4. Create SQL scriptpom.xml------- org.flywaydb flyway-core org.springframework.boot spring-boot-starter-jdbc org.postgresql postgresql 42.3.9 application.properties----------------------spring.datasource.driverClassName = org.postgresql.Driverspring.datasource.url = jdbc:postgresql://localhost:5432/test_dbspring.datasource.username = rootspring.datasource.password = rootspring.datasource.schema = USERSERVICEspring.datasource.max-active = 15spring.datasource.max-idle = 10spring.datasource.max-wait = 8000flyway.url = jdbc:postgresql://localhost:5432/test_dbflyway.schemas = USERSERVICEflyway.user = rootflyway.password = rootflyway.locations=filesystem:db/migration V1_0__create_employee_schema.sql--------------------------------CREATE TABLE IF NOT EXISTS employee ( id int NOT NULL, name varchar(20), email varchar(50), date_of_birth timestamp);INSERT INTO public.employee(id, "name", email, date_of_birth)VALUES(0, 'ricky', 'ricky@gmail.com', '1990-06-14');INSERT INTO public.employee(id, "name", email, date_of_birth)VALUES(1, 'aga', 'aga@gmail.com', '1995-06-14');
1. Create Springboot app
2. Add required maven dependencies
3. Configure datasource and flyway
4. Create SQL script
pom.xml
-------
org.flywaydb
flyway-core
org.springframework.boot
spring-boot-starter-jdbc
org.postgresql
postgresql
42.3.9
application.properties
----------------------
spring.datasource.driverClassName = org.postgresql.Driver
spring.datasource.url = jdbc:postgresql://localhost:5432/test_db
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.schema = USERSERVICE
spring.datasource.max-active = 15
spring.datasource.max-idle = 10
spring.datasource.max-wait = 8000
flyway.url = jdbc:postgresql://localhost:5432/test_db
flyway.schemas = USERSERVICE
flyway.user = root
flyway.password = root
flyway.locations=filesystem:db/migration
V1_0__create_employee_schema.sql
--------------------------------
CREATE TABLE IF NOT EXISTS employee (
id int NOT NULL,
name varchar(20),
email varchar(50),
date_of_birth timestamp
);
INSERT INTO public.employee
(id, "name", email, date_of_birth)
VALUES(0, 'ricky', 'ricky@gmail.com', '1990-06-14');
INSERT INTO public.employee
(id, "name", email, date_of_birth)
VALUES(1, 'aga', 'aga@gmail.com', '1995-06-14');