From 4cf91146dbfce7d9b702e42f14a925bbdfce06ba Mon Sep 17 00:00:00 2001 From: neviyn Date: Fri, 30 Apr 2021 00:49:47 +0100 Subject: [PATCH] Added auto population of authorization roles --- src/main/resources/application.properties | 2 +- src/main/resources/data.sql | 2 ++ src/test/resources/application.properties | 5 ++--- 3 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/data.sql diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ac9feb4..a2a60e6 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -spring.jpa.hibernate.ddl-auto=none +spring.jpa.hibernate.ddl-auto=validate spring.datasource.initialization-mode=always spring.jpa.properties.hibernate.default_schema=booru images.types=jpg,png,gif \ No newline at end of file diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000..0d94ffd --- /dev/null +++ b/src/main/resources/data.sql @@ -0,0 +1,2 @@ +INSERT INTO booru.role (id, name) VALUES (1, 'ADMIN') ON CONFLICT DO NOTHING ; +INSERT INTO booru.role (id, name) VALUES (2, 'USER') ON CONFLICT DO NOTHING ; \ No newline at end of file diff --git a/src/test/resources/application.properties b/src/test/resources/application.properties index 97d3152..8876b0f 100644 --- a/src/test/resources/application.properties +++ b/src/test/resources/application.properties @@ -1,6 +1,5 @@ -spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.url=jdbc:h2:mem:testdb;MODE=PostgreSQL;INIT=CREATE SCHEMA IF NOT EXISTS booru spring.datasource.driverClassName=org.h2.Driver -spring.flyway.enabled=false spring.jpa.hibernate.ddl-auto=update -spring.jpa.properties.hibernate.default_schema= +spring.jpa.properties.hibernate.default_schema=booru images.directory=./images \ No newline at end of file