-
Notifications
You must be signed in to change notification settings - Fork 528
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #314 from DbUp/enh-scriptNameComparer
Replace IScriptSorter with IComparer<string>
- Loading branch information
Showing
9 changed files
with
60 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
using System.Collections.Generic; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using DbUp.Support; | ||
|
||
namespace DbUp.Engine.Filters | ||
{ | ||
public class DefaultScriptFilter : IScriptFilter | ||
{ | ||
public IEnumerable<SqlScript> Filter(IEnumerable<SqlScript> sorted, HashSet<string> executedScriptNames) | ||
=> sorted.Where(s => !executedScriptNames.Contains(s.Name)); | ||
public IEnumerable<SqlScript> Filter(IEnumerable<SqlScript> sorted, HashSet<string> executedScriptNames, ScriptNameComparer comparer) | ||
=> sorted.Where(s => !executedScriptNames.Contains(s.Name, comparer)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
using System.Collections.Generic; | ||
using DbUp.Engine.Filters; | ||
using DbUp.Support; | ||
|
||
namespace DbUp.Engine | ||
{ | ||
public interface IScriptFilter | ||
{ | ||
IEnumerable<SqlScript> Filter(IEnumerable<SqlScript> sorted, HashSet<string> executedScriptNames); | ||
IEnumerable<SqlScript> Filter(IEnumerable<SqlScript> sorted, HashSet<string> executedScriptNames, ScriptNameComparer comparer); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
namespace DbUp.Support | ||
{ | ||
public class ScriptNameComparer : IComparer<string>, IEqualityComparer<string> | ||
{ | ||
private readonly IComparer<string> comparer; | ||
|
||
public ScriptNameComparer(IComparer<string> comparer) | ||
{ | ||
this.comparer = comparer; | ||
} | ||
|
||
public int Compare(string x, string y) => comparer.Compare(x, y); | ||
|
||
public bool Equals(string x, string y) => comparer.Compare(x, y) == 0; | ||
|
||
public int GetHashCode(string obj) => obj.GetHashCode(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters