Skip to content

Commit

Permalink
move cantSnapshot to seed
Browse files Browse the repository at this point in the history
ref #200
ref #201
  • Loading branch information
collinbarrett committed Aug 16, 2018
1 parent d694d0c commit 79afd53
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion FilterLists.sln
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilterLists.Agent", "src\Fi
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{A4BB2C81-5232-4162-B410-704D123D2C01}"
ProjectSection(SolutionItems) = preProject
scripts\sql\cantSnapshot.sql = scripts\sql\cantSnapshot.sql
scripts\sql\createDb.sql = scripts\sql\createDb.sql
scripts\sql\snapshotTimeAnalysis.sql = scripts\sql\snapshotTimeAnalysis.sql
EndProjectSection
Expand Down
5 changes: 0 additions & 5 deletions scripts/sql/cantSnapshot.sql

This file was deleted.

10 changes: 10 additions & 0 deletions src/FilterLists.Data/Seed/Extensions/SeedFilterListsDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static void SeedOrUpdate(this FilterListsDbContext dbContext, string data
dbContext.InsertOnDuplicateKeyUpdate<Fork>(dataPath);
dbContext.InsertOnDuplicateKeyUpdate<Merge>(dataPath);
dbContext.InsertOnDuplicateKeyUpdate<SoftwareSyntax>(dataPath);
SetCantSnapshot(dbContext);
}

private static void InsertOnDuplicateKeyUpdate<TEntity>(this DbContext dbContext, string dataPath)
Expand Down Expand Up @@ -104,5 +105,14 @@ private static string GetUpdateUnchangedColumnHack(IEnumerable<IProperty> proper
var firstId = properties.First(x => x.IsPrimaryKey()).Name;
return firstId + " = VALUES(" + firstId + ")";
}

//TODO: https://github.com/collinbarrett/FilterLists/issues/200
//TODO: https://github.com/collinbarrett/FilterLists/issues/201
private static void SetCantSnapshot(DbContext dbContext)
{
const string rawSqlString = "UPDATE filterlists SET CantSnapshot = 1 WHERE id IN(48, 149, 173, 185, 186, 187, 188, 189, 352)";
dbContext.Database.ExecuteSqlCommand(rawSqlString);
dbContext.SaveChanges();
}
}
}

0 comments on commit 79afd53

Please sign in to comment.