19 package org.sleuthkit.autopsy.centralrepository.datamodel;
21 import java.sql.Connection;
22 import java.sql.SQLException;
23 import java.sql.Statement;
24 import org.
sleuthkit.datamodel.CaseDbSchemaVersionNumber;
38 if (dbSchemaVersion.compareTo(
new CaseDbSchemaVersionNumber(1, 4)) < 0) {
40 try (Statement statement = connection.createStatement();) {
54 statement.execute(String.format(
RdbmsCentralRepoFactory.getCreateAccountInstancesTableTemplate(selectedPlatform), instance_type_dbname, instance_type_dbname));
55 statement.execute(String.format(
RdbmsCentralRepoFactory.getAddCaseIdIndexTemplate(), instance_type_dbname, instance_type_dbname));
56 statement.execute(String.format(
RdbmsCentralRepoFactory.getAddDataSourceIdIndexTemplate(), instance_type_dbname, instance_type_dbname));
57 statement.execute(String.format(
RdbmsCentralRepoFactory.getAddValueIndexTemplate(), instance_type_dbname, instance_type_dbname));
58 statement.execute(String.format(
RdbmsCentralRepoFactory.getAddKnownStatusIndexTemplate(), instance_type_dbname, instance_type_dbname));
59 statement.execute(String.format(
RdbmsCentralRepoFactory.getAddObjectIdIndexTemplate(), instance_type_dbname, instance_type_dbname));
66 String sqlStr = String.format(getAlterArtifactInstancesAddAccountIdTemplate(selectedPlatform), instance_type_dbname);
67 statement.execute(sqlStr);
73 sqlStr = String.format(getAlterArtifactInstancesAddAccountIdConstraintTemplate(), instance_type_dbname);
74 statement.execute(sqlStr);
94 static String getAlterArtifactInstancesAddAccountIdTemplate(
CentralRepoPlatforms selectedPlatform) {
96 return "ALTER TABLE %s"
107 static String getAlterArtifactInstancesAddAccountIdConstraintTemplate() {
109 return "ALTER TABLE %s"
110 +
" ADD CONSTRAINT account_id_fk foreign key (account_id) references accounts(id)";
CentralRepoPlatforms getDbPlatform()
static final int EMAIL_TYPE_ID
static void insertCorrelationType(Connection conn, CorrelationAttributeInstance.Type correlationType)
void upgradeSchema(CaseDbSchemaVersionNumber dbSchemaVersion, Connection connection)
static final int ADDITIONAL_TYPES_BASE_ID
static List< CorrelationAttributeInstance.Type > getDefaultCorrelationTypes()
static CentralRepoDbChoice getSavedDbChoice()
static String correlationTypeToInstanceTableName(CorrelationAttributeInstance.Type type)
static final int PHONE_TYPE_ID