add flyway migration tool
This commit is contained in:
10
pom.xml
10
pom.xml
@@ -90,6 +90,16 @@
|
|||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Database Migration Tools -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flywaydb</groupId>
|
||||||
|
<artifactId>flyway-database-postgresql</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ spring.datasource.url=${POSTGRES_URL}
|
|||||||
spring.datasource.username=${POSTGRES_USER}
|
spring.datasource.username=${POSTGRES_USER}
|
||||||
spring.datasource.password=${POSTGRES_PASSWORD}
|
spring.datasource.password=${POSTGRES_PASSWORD}
|
||||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||||
spring.jpa.hibernate.ddl-auto=update
|
spring.jpa.hibernate.ddl-auto=validate
|
||||||
spring.jpa.show-sql=false
|
spring.jpa.show-sql=false
|
||||||
spring.sql.init.mode=always
|
|
||||||
spring.sql.init.schema-locations=classpath:db/schema.sql
|
spring.flyway.enabled=true
|
||||||
|
spring.flyway.locations=classpath:db/migrations
|
||||||
|
spring.flyway.baseline-on-migrate=true
|
||||||
|
spring.flyway.baseline-version=1
|
||||||
|
|
||||||
## Security
|
## Security
|
||||||
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
|
spring.security.oauth2.client.registration.google.client-id=${GOOGLE_CLIENT_ID}
|
||||||
|
|||||||
@@ -1,7 +1,4 @@
|
|||||||
-- DROP TABLE IF EXISTS streams;
|
-- Users Table
|
||||||
-- DROP TABLE IF EXISTS clips;
|
|
||||||
-- DROP TABLE IF EXISTS users;
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS users (
|
CREATE TABLE IF NOT EXISTS users (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
google_id VARCHAR(64),
|
google_id VARCHAR(64),
|
||||||
@@ -14,6 +11,8 @@ CREATE TABLE IF NOT EXISTS users (
|
|||||||
stream_key VARCHAR(64) NOT NULL UNIQUE
|
stream_key VARCHAR(64) NOT NULL UNIQUE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- Streams Table
|
||||||
CREATE TABLE IF NOT EXISTS streams (
|
CREATE TABLE IF NOT EXISTS streams (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
user_id BIGINT,
|
user_id BIGINT,
|
||||||
@@ -24,6 +23,7 @@ CREATE TABLE IF NOT EXISTS streams (
|
|||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Clips Table
|
||||||
CREATE TABLE IF NOT EXISTS clips (
|
CREATE TABLE IF NOT EXISTS clips (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
@@ -40,6 +40,7 @@ CREATE TABLE IF NOT EXISTS clips (
|
|||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- VoDs Table
|
||||||
CREATE TABLE IF NOT EXISTS vods (
|
CREATE TABLE IF NOT EXISTS vods (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
@@ -56,6 +57,7 @@ CREATE TABLE IF NOT EXISTS vods (
|
|||||||
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
-- Markers Table
|
||||||
CREATE TABLE IF NOT EXISTS markers (
|
CREATE TABLE IF NOT EXISTS markers (
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
user_id BIGINT NOT NULL,
|
user_id BIGINT NOT NULL,
|
||||||
Reference in New Issue
Block a user