Class DBSchema
- java.lang.Object
-
- jetbrains.buildServer.serverSide.db.DBSchema
-
public final class DBSchema extends Object
Database schema creator.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DB_VERSIONING_STARTED_VERSION
The version when the DB_Version table was created and DB version saved in DB.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
clearAllMetadataInDatabase(DBFunctions dbf)
static void
createInitialData(DBFunctions dbf, GuidGenerator guidGenerator)
static void
createSchema(DBFunctions dbf, GuidGenerator guidGenerator, boolean withData)
static void
createSchemaTablesAndIndices(DBFunctions dbf, SchemaDef schema)
static String[]
generatePerSessionScript(DBFunctions dbf)
static int
getCurrentVersion()
static Date
getLastConverterDate(DBFunctions dbf)
static SchemaDef
getSchema()
static boolean
guessSchemaBelongsToTeamcity(Set<String> tables)
Analyzes schema tables and guesses whether the schema belongs to TeamCity or not.static boolean
hasIncompatibleSchemaChanges(DBFunctions dbf, int sinceVersion)
Returns true if since specified version there was at least one converter which made an incompatible schma changestatic int
loadDatabaseMetadataVersion(DBFunctions dbf)
static int
loadDatabaseVersion(DBFunctions dbf)
Load the "data format" version from database.static String[]
loadMetadataFileFromDatabase(DBFunctions dbf, String fileName)
static Collection<String>
loadMetadataFileNamesFromDatabase(DBFunctions dbf)
static void
populateWithInitialData(DBFunctions dbf, GuidGenerator guidGenerator)
static void
storeCurrentMetadataIntoDatabase(DBFunctions dbf)
static void
writeDatabaseVersion(DBFunctions dbf, int newVersionNr, Date timestamp)
static void
writeDatabaseVersion(DBFunctions dbf, int newVersionNr, Date timestamp, boolean incompatibleChange)
-
-
-
Field Detail
-
DB_VERSIONING_STARTED_VERSION
public static final int DB_VERSIONING_STARTED_VERSION
The version when the DB_Version table was created and DB version saved in DB.- See Also:
- Constant Field Values
-
-
Method Detail
-
getCurrentVersion
public static int getCurrentVersion()
-
hasIncompatibleSchemaChanges
public static boolean hasIncompatibleSchemaChanges(@NotNull DBFunctions dbf, int sinceVersion)
Returns true if since specified version there was at least one converter which made an incompatible schma change- Parameters:
sinceVersion
- - since version (excluding)- Returns:
- see above
-
getSchema
@NotNull public static SchemaDef getSchema()
-
createSchemaTablesAndIndices
public static void createSchemaTablesAndIndices(DBFunctions dbf, @NotNull SchemaDef schema)
-
populateWithInitialData
public static void populateWithInitialData(@NotNull DBFunctions dbf, @NotNull GuidGenerator guidGenerator)
-
createSchema
public static void createSchema(@NotNull DBFunctions dbf, @NotNull GuidGenerator guidGenerator, boolean withData)
-
createInitialData
public static void createInitialData(@NotNull DBFunctions dbf, @NotNull GuidGenerator guidGenerator) throws DBException
- Throws:
DBException
-
loadDatabaseVersion
public static int loadDatabaseVersion(@NotNull DBFunctions dbf)
Load the "data format" version from database.- Parameters:
dbf
-- Returns:
- the "data format" version, or 0 if not determined.
-
getLastConverterDate
@Nullable public static Date getLastConverterDate(@NotNull DBFunctions dbf)
- Parameters:
dbf
-- Returns:
- date of the last applied converter.
- Since:
- 2019.2
-
writeDatabaseVersion
public static void writeDatabaseVersion(@NotNull DBFunctions dbf, int newVersionNr, @Nullable Date timestamp)
-
writeDatabaseVersion
public static void writeDatabaseVersion(@NotNull DBFunctions dbf, int newVersionNr, @Nullable Date timestamp, boolean incompatibleChange)
-
loadDatabaseMetadataVersion
public static int loadDatabaseMetadataVersion(@NotNull DBFunctions dbf)
-
storeCurrentMetadataIntoDatabase
public static void storeCurrentMetadataIntoDatabase(@NotNull DBFunctions dbf)
-
loadMetadataFileNamesFromDatabase
public static Collection<String> loadMetadataFileNamesFromDatabase(@NotNull DBFunctions dbf)
-
loadMetadataFileFromDatabase
public static String[] loadMetadataFileFromDatabase(@NotNull DBFunctions dbf, String fileName)
-
clearAllMetadataInDatabase
public static void clearAllMetadataInDatabase(@NotNull DBFunctions dbf)
-
guessSchemaBelongsToTeamcity
public static boolean guessSchemaBelongsToTeamcity(Set<String> tables)
Analyzes schema tables and guesses whether the schema belongs to TeamCity or not. Should support TeamCity schemas since version 3.0.- Parameters:
tables
- names of schema tables, in lower case.- Returns:
- belongs to TeamCity.
-
generatePerSessionScript
@NotNull public static String[] generatePerSessionScript(@NotNull DBFunctions dbf)
-
-