Class SchemaEvolution
- java.lang.Object
-
- com.tagtraum.beatunes.library.schemaevolution.SchemaEvolution
-
- Direct Known Subclasses:
SchemaEvolution1_2,SchemaEvolution10_11,SchemaEvolution11_12,SchemaEvolution12_13,SchemaEvolution13_14,SchemaEvolution14_15,SchemaEvolution15_16,SchemaEvolution16_17,SchemaEvolution17_18,SchemaEvolution18_19,SchemaEvolution19_20,SchemaEvolution2_3,SchemaEvolution20_21,SchemaEvolution21_22,SchemaEvolution22_23,SchemaEvolution23_24,SchemaEvolution24_25,SchemaEvolution25_26,SchemaEvolution26_27,SchemaEvolution27_28,SchemaEvolution28_29,SchemaEvolution29_30,SchemaEvolution3_4,SchemaEvolution30_31,SchemaEvolution31_32,SchemaEvolution32_33,SchemaEvolution4_5,SchemaEvolution5_6,SchemaEvolution6_7,SchemaEvolution7_8,SchemaEvolution8_9,SchemaEvolution9_10
public abstract class SchemaEvolution extends Object
Abstract SchemaEvolution. Subclasses must be namedcom.tagtraum.beatunes.library.SchemaEvolutionX_Y(Y=X+1) to be recognized automatically.- Author:
- Hendrik Schreiber
-
-
Constructor Summary
Constructors Constructor Description SchemaEvolution()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancolumnExists(Connection connection, String tableName, String columnName)protected voiddropColumnIfExists(Statement statement, String table, String... columns)protected voiddropIndexIfExists(Statement statement, String index)protected ResultSetexecuteQuery(Statement statement, String sql)protected voidexecuteStatement(Statement statement, String sql)protected voidexecuteStatementIfColumnDoesNotExist(Connection connection, Statement statement, String table, String column, String alterTableStatement)protected intexecuteUpdate(PreparedStatement preparedStatement)protected intexecuteUpdate(Statement statement, String sql)intgetFromVersion()StringgetFromVersionString()HibernateMediaLibrary<?>getLibrary()intgetToVersion()StringgetToVersionString()abstract voidmigrate(Connection connection)voidsetLibrary(HibernateMediaLibrary<?> library)protected voidupdateSchemaVersion(Connection connection)protected voidupdateSchemaVersion(Connection connection, int version)
-
-
-
Method Detail
-
getLibrary
public HibernateMediaLibrary<?> getLibrary()
-
setLibrary
public void setLibrary(HibernateMediaLibrary<?> library)
-
migrate
public abstract void migrate(Connection connection) throws SQLException
- Throws:
SQLException
-
getFromVersionString
public String getFromVersionString()
-
getToVersionString
public String getToVersionString()
-
getFromVersion
public final int getFromVersion()
-
getToVersion
public final int getToVersion()
-
updateSchemaVersion
protected void updateSchemaVersion(Connection connection) throws SQLException
- Throws:
SQLException
-
updateSchemaVersion
protected void updateSchemaVersion(Connection connection, int version) throws SQLException
- Throws:
SQLException
-
columnExists
protected boolean columnExists(Connection connection, String tableName, String columnName) throws SQLException
- Throws:
SQLException
-
executeStatementIfColumnDoesNotExist
protected void executeStatementIfColumnDoesNotExist(Connection connection, Statement statement, String table, String column, String alterTableStatement) throws SQLException
- Throws:
SQLException
-
executeStatement
protected void executeStatement(Statement statement, String sql) throws SQLException
- Throws:
SQLException
-
executeQuery
protected ResultSet executeQuery(Statement statement, String sql) throws SQLException
- Throws:
SQLException
-
executeUpdate
protected int executeUpdate(PreparedStatement preparedStatement) throws SQLException
- Throws:
SQLException
-
executeUpdate
protected int executeUpdate(Statement statement, String sql) throws SQLException
- Throws:
SQLException
-
dropColumnIfExists
protected void dropColumnIfExists(Statement statement, String table, String... columns) throws SQLException
- Throws:
SQLException
-
dropIndexIfExists
protected void dropIndexIfExists(Statement statement, String index) throws SQLException
- Throws:
SQLException
-
-