1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Use manual migration

This commit is contained in:
Dean Herbert 2019-06-06 13:33:30 +09:00
parent 8607f3b765
commit 02283380c4

View File

@ -6,25 +6,34 @@ namespace osu.Game.Migrations
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "SkinInfoID",
table: "Settings",
nullable: true);
migrationBuilder.Sql(@"create table Settings_dg_tmp
(
ID INTEGER not null
constraint PK_Settings
primary key autoincrement,
Key TEXT not null,
RulesetID INTEGER,
Value TEXT,
Variant INTEGER,
SkinInfoID int
constraint Settings_SkinInfo_ID_fk
references SkinInfo
on delete restrict
);
migrationBuilder.CreateIndex(
name: "IX_Settings_SkinInfoID",
table: "Settings",
column: "SkinInfoID");
insert into Settings_dg_tmp(ID, Key, RulesetID, Value, Variant) select ID, Key, RulesetID, Value, Variant from Settings;
// unsupported by sqlite
drop table Settings;
// migrationBuilder.AddForeignKey(
// name: "FK_Settings_SkinInfo_SkinInfoID",
// table: "Settings",
// column: "SkinInfoID",
// principalTable: "SkinInfo",
// principalColumn: "ID",
// onDelete: ReferentialAction.Restrict);
alter table Settings_dg_tmp rename to Settings;
create index IX_Settings_RulesetID_Variant
on Settings (RulesetID, Variant);
create index Settings_SkinInfoID_index
on Settings (SkinInfoID);
");
}
protected override void Down(MigrationBuilder migrationBuilder)