Skip to content

Commit

Permalink
CB-5440. Refactor after review
Browse files Browse the repository at this point in the history
  • Loading branch information
DenisSinelnikov committed Sep 19, 2024
1 parent a4656a2 commit 19dd574
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.jkiss.dbeaver.model.sql.schema.SQLSchemaManager;
import org.jkiss.dbeaver.model.sql.schema.SQLSchemaVersionManager;
import org.jkiss.dbeaver.registry.storage.H2Migrator;
import org.jkiss.dbeaver.runtime.DBWorkbench;
import org.jkiss.dbeaver.utils.GeneralUtils;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;
Expand Down Expand Up @@ -326,7 +327,7 @@ public int getCurrentSchemaVersion(DBRProgressMonitor monitor, Connection connec
} catch (SQLException e) {
try {
Object legacyVersion = CommonUtils.toInt(JDBCUtils.executeQuery(connection,
normalizeTableNames("SELECT SCHEMA_VERSION FROM {table_prefix}CB_SERVER"))); // may be remove?
normalizeTableNames("SELECT SCHEMA_VERSION FROM {table_prefix}CB_SERVER")));
// Table CB_SERVER exist - this is a legacy schema
return LEGACY_SCHEMA_VERSION;
} catch (SQLException ex) {
Expand Down Expand Up @@ -533,4 +534,20 @@ public void shutdown() {
}
}
}

protected String getCurrentInstanceId() throws IOException {
// 16 chars - workspace ID
String workspaceId = DBWorkbench.getPlatform().getWorkspace().getWorkspaceId();
if (workspaceId.length() > 16) {
workspaceId = workspaceId.substring(0, 16);
}

StringBuilder id = new StringBuilder(36);
id.append("000000000000"); // there was mac address, but it generates dynamically when docker is used
id.append(":").append(workspaceId).append(":");
while (id.length() < 36) {
id.append("X");
}
return id.toString();
}
}

0 comments on commit 19dd574

Please sign in to comment.