Skip to content

Commit

Permalink
rm another semver check
Browse files Browse the repository at this point in the history
  • Loading branch information
pmconne committed Jan 7, 2025
1 parent 445245a commit a1a1890
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions packages/transformer/src/IModelTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import {
} from "@itwin/core-bentley";
import * as ECSchemaMetaData from "@itwin/ecschema-metadata";
import { Point3d, Transform } from "@itwin/core-geometry";
import * as coreBackendPkgJson from "@itwin/core-backend/package.json";
import {
BriefcaseManager,
ChangedECInstance,
Expand Down Expand Up @@ -397,9 +396,6 @@ export class IModelTransformer extends IModelExportHandler {
"targetScopeElementId" | "danglingReferencesBehavior"
>;

/** @see hasDefinitionContainerDeletionFeature */
private _hasDefinitionContainerDeletionFeature?: boolean;

/**
* A private variable meant to be set by tests which have an outdated way of setting up transforms. In all synchronizations today we expect to find an ESA in the branch db which describes the master -> branch relationship.
* The exception to this is the first transform aka the provenance initializing transform which requires that the master imodel and the branch imodel are identical at the time of provenance initialization.
Expand Down Expand Up @@ -905,20 +901,6 @@ export class IModelTransformer extends IModelExportHandler {
private _cachedSynchronizationVersion: ChangesetIndexAndId | undefined =
undefined;

/**
* As of itwinjs 4.6.0, definitionContainers are now deleted as if they were DefinitionPartitions as opposed to Definitions.
* This variable being true will be used to special case the deletion of DefinitionContainers the same way DefinitionPartitions are deleted.
*/
protected get hasDefinitionContainerDeletionFeature(): boolean {
if (this._hasDefinitionContainerDeletionFeature === undefined) {
this._hasDefinitionContainerDeletionFeature = Semver.satisfies(
coreBackendPkgJson.version,
"^4.6.0"
);
}
return this._hasDefinitionContainerDeletionFeature;
}

/**
* We cache the synchronization version to avoid querying the target scoping ESA multiple times.
* If the target scoping ESA is ever updated we need to clear any potentially cached sync version otherwise we will get stale values.
Expand Down Expand Up @@ -1973,9 +1955,7 @@ export class IModelTransformer extends IModelExportHandler {

if (!Id64.isValidId64(targetModelId)) return;

let sql: string;
if (this.hasDefinitionContainerDeletionFeature) {
sql = `
const sql = `
SELECT 1
FROM bis.DefinitionPartition
WHERE ECInstanceId=:targetModelId
Expand All @@ -1984,13 +1964,6 @@ export class IModelTransformer extends IModelExportHandler {
FROM bis.DefinitionContainer
WHERE ECInstanceId=:targetModelId
`;
} else {
sql = `
SELECT 1
FROM bis.DefinitionPartition
WHERE ECInstanceId=:targetModelId
`;
}

if (this.exporter.sourceDbChanges?.element.deleteIds.has(sourceModelId)) {
const isDefinitionPartition = this.targetDb.withPreparedStatement(
Expand Down

0 comments on commit a1a1890

Please sign in to comment.