Class SQLDatabaseMigrator
java.lang.Object
org.sgrewritten.stargate.migration.SQLDatabaseMigrator
Helps with running sql database migrations by reading sql files.
- Can read multiple queries in the same file
- Can parse already defined stargate SQL statements and run them (in the same file)
-
Constructor Summary
ConstructorDescriptionSQLDatabaseMigrator
(@NotNull SQLDatabaseAPI database, @NotNull TableNameConfiguration nameConfiguration, @NotNull String sqlFilesPath, boolean interServerEnabled) -
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
Run multiple SQL scripts in specified directory (constructor)
-
Constructor Details
-
SQLDatabaseMigrator
public SQLDatabaseMigrator(@NotNull @NotNull SQLDatabaseAPI database, @NotNull @NotNull TableNameConfiguration nameConfiguration, @NotNull @NotNull String sqlFilesPath, boolean interServerEnabled) - Parameters:
database
-A database api able to provide sql statements
nameConfiguration
-SQL table name config
sqlFilesPath
-The internal resource path to the SQL files to run
interServerEnabled
-Whether inter server portals are enabled
-
-
Method Details
-
run
Run multiple SQL scripts in specified directory (constructor)- Throws:
SQLException
-Any sql exception
IOException
-if unable to read the internal file
-