mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-12 21:30:29 +05:30
Register postgres driver.
This commit is contained in:
parent
71403e93af
commit
d81bb969c7
@ -1,24 +1,17 @@
|
||||
package me.kavin.piped.utils;
|
||||
|
||||
import liquibase.Contexts;
|
||||
import liquibase.Liquibase;
|
||||
import liquibase.Scope;
|
||||
import liquibase.command.CommandScope;
|
||||
import liquibase.command.core.UpdateCommandStep;
|
||||
import liquibase.command.core.helpers.ChangeExecListenerCommandStep;
|
||||
import liquibase.command.core.helpers.DatabaseChangelogCommandStep;
|
||||
import liquibase.command.core.helpers.DbUrlConnectionCommandStep;
|
||||
import liquibase.database.Database;
|
||||
import liquibase.database.DatabaseFactory;
|
||||
import liquibase.database.jvm.JdbcConnection;
|
||||
import liquibase.exception.LiquibaseException;
|
||||
import liquibase.resource.ClassLoaderResourceAccessor;
|
||||
import me.kavin.piped.consts.Constants;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -30,6 +23,9 @@ public class LiquibaseHelper {
|
||||
String username = Constants.hibernateProperties.get("hibernate.connection.username");
|
||||
String password = Constants.hibernateProperties.get("hibernate.connection.password");
|
||||
|
||||
// ensure postgres driver is loaded
|
||||
DriverManager.registerDriver(new org.postgresql.Driver());
|
||||
|
||||
Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(new JdbcConnection(DriverManager.getConnection(url, username, password)));
|
||||
|
||||
try (Liquibase liquibase = new Liquibase("changelog/db.changelog-master.xml", new ClassLoaderResourceAccessor(), database)) {
|
||||
|
Loading…
Reference in New Issue
Block a user