Liquibase-Scripts and database migration possible with explicit (non-superuser) DB-User
This commit is contained in:
parent
aee8a29896
commit
7e0f4d0267
@ -763,15 +763,13 @@ $$;
|
||||
|
||||
do $$
|
||||
begin
|
||||
if '${HSADMINNG_POSTGRES_ADMIN_USERNAME}'='admin' then
|
||||
if '${ADMIN_USER}'='admin' then
|
||||
create role admin;
|
||||
grant all privileges on all tables in schema public to admin;
|
||||
end if;
|
||||
|
||||
if '${HSADMINNG_POSTGRES_RESTRICTED_USERNAME}'='restricted' then
|
||||
create role restricted;
|
||||
grant all privileges on all tables in schema public to restricted;
|
||||
end if;
|
||||
-- grant all privileges on all tables in schema public to ${HSADMINNG_POSTGRES_RESTRICTED_USERNAME};
|
||||
end $$
|
||||
--//
|
||||
|
||||
|
@ -54,10 +54,27 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* There is some test data in Java resources to verify the data conversion.
|
||||
* For a real import a main method will be added later
|
||||
* which reads CSV files from the file system.
|
||||
*
|
||||
* When run on a Hostsharing database, it needs the following settings (hsh99_... just examples):
|
||||
*
|
||||
* CREATE USER hsh99_admin WITH PASSWORD 'password';
|
||||
* GRANT ALL ON SCHEMA public TO hsh99_admin;
|
||||
*
|
||||
* CREATE USER hsh99_restricted WITH PASSWORD 'password';
|
||||
* GRANT ALL PRIVILEGES ON ALL TALBES IN SCHEMA hsh99_hsadminng to hsh99_restricted
|
||||
*
|
||||
* CREATE EXTENSION "uuid-ossp";
|
||||
*
|
||||
* And the environment variables ADMIN_USER and RESTRICTED_USER have to be set to the actual users.
|
||||
* TODO: password
|
||||
*/
|
||||
|
||||
@Disabled
|
||||
@DataJpaTest(properties = "spring.datasource.url=jdbc:postgresql://localhost:5432/postgres")
|
||||
// @Disabled
|
||||
@DataJpaTest(properties = {
|
||||
"spring.profiles.active=migration",
|
||||
"spring.datasource.url=jdbc:postgresql://localhost:5432/postgres",
|
||||
"spring.datasource.username=hsh99_admin",
|
||||
"spring.datasource.password=password"
|
||||
})
|
||||
@Import({ Context.class, JpaAttempt.class })
|
||||
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
|
||||
public class ImportOfficeTables extends ContextBasedTest {
|
||||
|
Loading…
Reference in New Issue
Block a user