mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
939 B
32 lines
939 B
using Microsoft.EntityFrameworkCore.Migrations; |
|
|
|
namespace ErsatzTV.Infrastructure.Migrations |
|
{ |
|
public partial class MetadataSortTitle : Migration |
|
{ |
|
protected override void Up(MigrationBuilder migrationBuilder) |
|
{ |
|
migrationBuilder.AddColumn<string>( |
|
name: "Metadata_SortTitle", |
|
table: "MediaItems", |
|
type: "TEXT", |
|
nullable: true); |
|
|
|
migrationBuilder.Sql( |
|
@"UPDATE MediaItems |
|
SET Metadata_SortTitle = Metadata_Title"); |
|
|
|
migrationBuilder.Sql( |
|
@"UPDATE MediaItems |
|
SET Metadata_SortTitle = substr(Metadata_Title, 5) |
|
WHERE Metadata_Title LIKE 'the %'"); |
|
} |
|
|
|
protected override void Down(MigrationBuilder migrationBuilder) |
|
{ |
|
migrationBuilder.DropColumn( |
|
name: "Metadata_SortTitle", |
|
table: "MediaItems"); |
|
} |
|
} |
|
}
|
|
|