Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] DB migrations fail silently if a DB user lacks DDL permissions #117

Open
pilosus opened this issue May 25, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@pilosus
Copy link
Owner

pilosus commented May 25, 2024

Describe the bug

When database user lacks DDL permissions to create table, migration fails silently.

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Postgres data base with a non-super-user account
  2. Run app in --mode migrate
  3. See the migrate script logs (connection established, exit status 1, no exceptions thrown):
May 25 11:01:44 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 11:01:44,345 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [STDOU>
May 25 11:01:44 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 11:01:44,345 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@199bc830 - End of configuration.
May 25 11:01:44 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 11:01:44,346 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@4d8286c4 - Registering current configuration a>
May 25 11:01:44 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 11:01:44,350 |-INFO in ch.qos.logback.classic.util.ContextInitializer@150ede8b - ch.qos.logback.classic.util.Default>
May 25 11:01:47 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 2024-05-25 11:01:47,849 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
May 25 11:01:48 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 2024-05-25 11:01:48,771 [main] INFO  com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection org.postgre>
May 25 11:01:48 ubuntu-s-1vcpu-1gb-fra1-01 java[22255]: 2024-05-25 11:01:48,776 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
May 25 11:01:49 ubuntu-s-1vcpu-1gb-fra1-01 systemd[1]: dienstplan-migrate.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ An ExecStart= process belonging to unit dienstplan-migrate.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.

Expected behavior

Clear error message is shown to a user if a DB user lacks permission to run migrations properly.

*Application setup

  • App version: 1.1.109
  • Java version: OpenJDK build 17.0.11+9-Ubuntu-1
  • Database version: PostgreSQL 16.2

Additional context

Application loglevel doesn't affect the behaviour, it's the same for INFO and DEBUG levels

@pilosus pilosus added the bug Something isn't working label May 25, 2024
@pilosus pilosus changed the title [BUG] [BUG] DB migrations fail silently if a DB user lacks DDL permissions May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant