Add block to turn on UUID plugin.

main
KKlochko 2 years ago
parent 86b9c11104
commit 31f210e489

@ -0,0 +1,19 @@
package space.kklochko.jdbc_hospital_example.db.repositories.blocks;
import space.kklochko.jdbc_hospital_example.db.factories.DataBaseConnection;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
public class TurnOnUUIDPlugin {
public boolean create(DataBaseConnection db) {
try (Connection connection = db.connect()) {
Statement statement = connection.createStatement();
statement.execute("CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";");
return true;
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
Loading…
Cancel
Save