Skip to content

Commit 2cbba1a

Browse files
committed
PR 39: Fixed bug in Attachment Export that milited output based on hard coded query.
- Fixed bug in Attachment Export that milited output based on hard coded query.
1 parent a10b7d1 commit 2cbba1a

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

TfsWitMigrator.Core/Configuration/EngineConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public static EngineConfiguration GetDefault()
8787
ec.Processors.Add(new LinkMigrationConfig() { Disabled = true });
8888
ec.Processors.Add(new WorkItemPostProcessingConfig() { Disabled = true });
8989
ec.Processors.Add(new WorkItemDeleteConfig() { Disabled = true });
90-
ec.Processors.Add(new AttachementExportMigrationConfig() { Disabled = true });
90+
ec.Processors.Add(new AttachementExportMigrationConfig() { Disabled = true, QueryBit = @"AND [System.AttachedFileCount] > 0" });
9191
ec.Processors.Add(new AttachementImportMigrationConfig() { Disabled = true });
9292
ec.Processors.Add(new TestVeriablesMigrationConfig() { Disabled = true });
9393
ec.Processors.Add(new TestConfigurationsMigrationConfig() { Disabled = true });

TfsWitMigrator.Core/Configuration/Processing/AttachementExportMigrationConfig.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace VSTS.DataBulkEditor.Engine.Configuration.Processing
99
public class AttachementExportMigrationConfig : ITfsProcessingConfig
1010
{
1111
public bool Disabled { get; set; }
12+
public string QueryBit { get; set; }
1213

1314
public Type Processor
1415
{

TfsWitMigrator.Core/Execution/MigrationContext/AttachementExportMigrationContext.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ namespace VSTS.DataBulkEditor.Engine
1111
{
1212
public class AttachementExportMigrationContext : AttachementMigrationContextBase
1313
{
14+
15+
AttachementExportMigrationConfig _config;
16+
1417
public override string Name
1518
{
1619
get
@@ -20,7 +23,7 @@ public override string Name
2023
}
2124
public AttachementExportMigrationContext(MigrationEngine me, AttachementExportMigrationConfig config) : base(me, config)
2225
{
23-
26+
this._config = config;
2427
}
2528

2629
internal override void InternalExecute()
@@ -34,7 +37,7 @@ internal override void InternalExecute()
3437
WorkItemStoreContext sourceStore = new WorkItemStoreContext(me.Source, WorkItemStoreFlags.None);
3538
TfsQueryContext tfsqc = new TfsQueryContext(sourceStore);
3639
tfsqc.AddParameter("TeamProject", me.Source.Name);
37-
tfsqc.Query = @"SELECT [System.Id] FROM WorkItems WHERE [System.TeamProject] = @TeamProject AND [System.AttachedFileCount] > 0 AND [Microsoft.VSTS.Common.ClosedDate] = '' ORDER BY [System.ChangedDate] desc ";
40+
tfsqc.Query = string.Format(@"SELECT [System.Id], [System.Tags] FROM WorkItems WHERE [System.TeamProject] = @TeamProject {0} ORDER BY [System.ChangedDate] desc", _config.QueryBit);
3841
WorkItemCollection sourceWIS = tfsqc.Execute();
3942

4043
WebClient webClient = new WebClient();

0 commit comments

Comments
 (0)