2018-10-07 19:07:30 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Migrations
|
|
|
|
|
{
|
|
|
|
|
public partial class StandardizePaths : Migration
|
|
|
|
|
{
|
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
2018-10-18 06:29:12 +00:00
|
|
|
|
string windowsStyle = @"\";
|
2018-10-07 19:07:30 +00:00
|
|
|
|
string standardized = "/";
|
|
|
|
|
|
|
|
|
|
// Escaping \ does not seem to be needed.
|
2018-10-18 06:29:12 +00:00
|
|
|
|
migrationBuilder.Sql($"UPDATE `BeatmapInfo` SET `Path` = REPLACE(`Path`, '{windowsStyle}', '{standardized}')");
|
|
|
|
|
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `AudioFile` = REPLACE(`AudioFile`, '{windowsStyle}', '{standardized}')");
|
|
|
|
|
migrationBuilder.Sql($"UPDATE `BeatmapMetadata` SET `BackgroundFile` = REPLACE(`BackgroundFile`, '{windowsStyle}', '{standardized}')");
|
|
|
|
|
migrationBuilder.Sql($"UPDATE `BeatmapSetFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')");
|
|
|
|
|
migrationBuilder.Sql($"UPDATE `SkinFileInfo` SET `Filename` = REPLACE(`Filename`, '{windowsStyle}', '{standardized}')");
|
2018-10-07 19:07:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|