Skip to content
This repository has been archived by the owner on Apr 8, 2023. It is now read-only.

Commit

Permalink
update migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminsampica committed Jul 7, 2022
1 parent b8324a1 commit 5b5025c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
// Convert Offer Matches to use state.
var sql = $@"UPDATE Players
SET State = 1
WHERE DATEADD(day, 3, {nameof(Player.EndOfFreeAgency)}) <= getdate()";
WHERE DATEADD(day, 3, {nameof(Player.EndOfFreeAgency)}) >= getdate()";

migrationBuilder.Sql(sql);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ protected override void Up(MigrationBuilder migrationBuilder)
// Convert Unsigned to use state.
var sql = $@"UPDATE Players
SET State = 2
WHERE DATEADD(day, 3, {nameof(Player.EndOfFreeAgency)}) >= getdate()";
WHERE {nameof(Player.EndOfFreeAgency)} IS NULL
AND {nameof(Player.YearContractExpires)} IS NULL
AND {nameof(Player.YearAcquired)} = 2022";

migrationBuilder.Sql(sql);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ public partial class AddPlayerStateRosteredToFreeAgent : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
// Data cleansing - this shouldn't be happening.
var sql2 = $@"UPDATE Players
SET Rostered = 0
WHERE EndOfFreeAgency IS NOT NULL";

migrationBuilder.Sql(sql2);

// Convert Signed to use state.
var sql = $@"UPDATE Players
SET State = 3
Expand Down

0 comments on commit 5b5025c

Please sign in to comment.