mirror of https://github.com/ErsatzTV/ErsatzTV.git
Browse Source
* fix: always randomize start points for all collections the first time they are used * fixespull/2950/head
21 changed files with 14155 additions and 44 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@ |
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.MySql.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_CollectionEnumeratorState_Started : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "ScheduleItemsEnumeratorState", |
||||||
|
type: "tinyint(1)", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "FillGroupEnumeratorState", |
||||||
|
type: "tinyint(1)", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "CollectionEnumeratorState", |
||||||
|
type: "tinyint(1)", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
// treat all existing enumerators as started so upgrades never yank an in-progress
|
||||||
|
// enumerator to a random start point; only enumerators created after this get a random start
|
||||||
|
migrationBuilder.Sql("UPDATE `ScheduleItemsEnumeratorState` SET `Started` = 1"); |
||||||
|
migrationBuilder.Sql("UPDATE `FillGroupEnumeratorState` SET `Started` = 1"); |
||||||
|
migrationBuilder.Sql("UPDATE `CollectionEnumeratorState` SET `Started` = 1"); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "ScheduleItemsEnumeratorState"); |
||||||
|
|
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "FillGroupEnumeratorState"); |
||||||
|
|
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "CollectionEnumeratorState"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,57 @@ |
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||||
|
|
||||||
|
#nullable disable |
||||||
|
|
||||||
|
namespace ErsatzTV.Infrastructure.Sqlite.Migrations |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Add_CollectionEnumeratorState_Started : Migration |
||||||
|
{ |
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "ScheduleItemsEnumeratorState", |
||||||
|
type: "INTEGER", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "FillGroupEnumeratorState", |
||||||
|
type: "INTEGER", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
migrationBuilder.AddColumn<bool>( |
||||||
|
name: "Started", |
||||||
|
table: "CollectionEnumeratorState", |
||||||
|
type: "INTEGER", |
||||||
|
nullable: false, |
||||||
|
defaultValue: false); |
||||||
|
|
||||||
|
// treat all existing enumerators as started so upgrades never yank an in-progress
|
||||||
|
// enumerator to a random start point; only enumerators created after this get a random start
|
||||||
|
migrationBuilder.Sql("""UPDATE "ScheduleItemsEnumeratorState" SET "Started" = 1"""); |
||||||
|
migrationBuilder.Sql("""UPDATE "FillGroupEnumeratorState" SET "Started" = 1"""); |
||||||
|
migrationBuilder.Sql("""UPDATE "CollectionEnumeratorState" SET "Started" = 1"""); |
||||||
|
} |
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||||
|
{ |
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "ScheduleItemsEnumeratorState"); |
||||||
|
|
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "FillGroupEnumeratorState"); |
||||||
|
|
||||||
|
migrationBuilder.DropColumn( |
||||||
|
name: "Started", |
||||||
|
table: "CollectionEnumeratorState"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
Loading…
Reference in new issue