osu/osu.Game/Migrations/20171019041408_InitialCreat...

314 lines
14 KiB
C#
Raw Normal View History

2017-10-17 09:26:28 +00:00
using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
2017-10-09 21:17:12 +00:00
namespace osu.Game.Migrations
{
2017-10-17 09:26:28 +00:00
public partial class InitialCreate : Migration
2017-10-09 21:17:12 +00:00
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
2017-10-19 05:05:11 +00:00
name: "BeatmapDifficulty",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
2017-10-19 05:05:11 +00:00
ApproachRate = table.Column<float>(type: "REAL", nullable: false),
CircleSize = table.Column<float>(type: "REAL", nullable: false),
DrainRate = table.Column<float>(type: "REAL", nullable: false),
OverallDifficulty = table.Column<float>(type: "REAL", nullable: false),
SliderMultiplier = table.Column<float>(type: "REAL", nullable: false),
SliderTickRate = table.Column<float>(type: "REAL", nullable: false)
},
constraints: table =>
{
2017-10-19 05:05:11 +00:00
table.PrimaryKey("PK_BeatmapDifficulty", x => x.ID);
});
migrationBuilder.CreateTable(
name: "BeatmapMetadata",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Artist = table.Column<string>(type: "TEXT", nullable: true),
ArtistUnicode = table.Column<string>(type: "TEXT", nullable: true),
AudioFile = table.Column<string>(type: "TEXT", nullable: true),
Author = table.Column<string>(type: "TEXT", nullable: true),
BackgroundFile = table.Column<string>(type: "TEXT", nullable: true),
PreviewTime = table.Column<int>(type: "INTEGER", nullable: false),
Source = table.Column<string>(type: "TEXT", nullable: true),
Tags = table.Column<string>(type: "TEXT", nullable: true),
Title = table.Column<string>(type: "TEXT", nullable: true),
TitleUnicode = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BeatmapMetadata", x => x.ID);
2017-10-09 21:17:12 +00:00
});
migrationBuilder.CreateTable(
name: "FileInfo",
columns: table => new
{
2017-10-14 05:28:25 +00:00
ID = table.Column<int>(type: "INTEGER", nullable: false)
2017-10-09 21:17:12 +00:00
.Annotation("Sqlite:Autoincrement", true),
Hash = table.Column<string>(type: "TEXT", nullable: true),
ReferenceCount = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
2017-10-14 05:28:25 +00:00
table.PrimaryKey("PK_FileInfo", x => x.ID);
2017-10-09 21:17:12 +00:00
});
migrationBuilder.CreateTable(
name: "KeyBinding",
columns: table => new
{
2017-10-14 05:28:25 +00:00
ID = table.Column<int>(type: "INTEGER", nullable: false)
2017-10-09 21:17:12 +00:00
.Annotation("Sqlite:Autoincrement", true),
Action = table.Column<int>(type: "INTEGER", nullable: false),
Keys = table.Column<string>(type: "TEXT", nullable: true),
2017-10-14 05:28:25 +00:00
RulesetID = table.Column<int>(type: "INTEGER", nullable: true),
2017-10-09 21:17:12 +00:00
Variant = table.Column<int>(type: "INTEGER", nullable: true)
},
constraints: table =>
{
2017-10-14 05:28:25 +00:00
table.PrimaryKey("PK_KeyBinding", x => x.ID);
2017-10-09 21:17:12 +00:00
});
migrationBuilder.CreateTable(
name: "RulesetInfo",
columns: table => new
{
2017-10-14 05:28:25 +00:00
ID = table.Column<int>(type: "INTEGER", nullable: false)
2017-10-09 21:17:12 +00:00
.Annotation("Sqlite:Autoincrement", true),
Available = table.Column<bool>(type: "INTEGER", nullable: false),
InstantiationInfo = table.Column<string>(type: "TEXT", nullable: true),
Name = table.Column<string>(type: "TEXT", nullable: true)
},
constraints: table =>
{
2017-10-14 05:28:25 +00:00
table.PrimaryKey("PK_RulesetInfo", x => x.ID);
2017-10-09 21:17:12 +00:00
});
migrationBuilder.CreateTable(
2017-10-19 05:05:11 +00:00
name: "BeatmapSetInfo",
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
2017-10-19 05:05:11 +00:00
DeletePending = table.Column<bool>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
OnlineBeatmapSetID = table.Column<int>(type: "INTEGER", nullable: true),
Protected = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
2017-10-19 05:05:11 +00:00
table.PrimaryKey("PK_BeatmapSetInfo", x => x.ID);
2017-10-17 09:26:28 +00:00
table.ForeignKey(
2017-10-19 05:05:11 +00:00
name: "FK_BeatmapSetInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
2017-10-17 09:26:28 +00:00
principalColumn: "ID",
2017-10-19 05:05:11 +00:00
onDelete: ReferentialAction.Restrict);
2017-10-09 21:17:12 +00:00
});
migrationBuilder.CreateTable(
name: "BeatmapInfo",
columns: table => new
{
2017-10-14 05:28:25 +00:00
ID = table.Column<int>(type: "INTEGER", nullable: false)
2017-10-09 21:17:12 +00:00
.Annotation("Sqlite:Autoincrement", true),
AudioLeadIn = table.Column<int>(type: "INTEGER", nullable: false),
2017-10-14 05:28:25 +00:00
BaseDifficultyID = table.Column<int>(type: "INTEGER", nullable: false),
2017-10-09 21:17:12 +00:00
BeatDivisor = table.Column<int>(type: "INTEGER", nullable: false),
2017-10-14 05:28:25 +00:00
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
2017-10-09 21:17:12 +00:00
Countdown = table.Column<bool>(type: "INTEGER", nullable: false),
DistanceSpacing = table.Column<double>(type: "REAL", nullable: false),
GridSize = table.Column<int>(type: "INTEGER", nullable: false),
Hash = table.Column<string>(type: "TEXT", nullable: true),
Hidden = table.Column<bool>(type: "INTEGER", nullable: false),
LetterboxInBreaks = table.Column<bool>(type: "INTEGER", nullable: false),
MD5Hash = table.Column<string>(type: "TEXT", nullable: true),
2017-10-19 05:05:11 +00:00
MetadataID = table.Column<int>(type: "INTEGER", nullable: true),
OnlineBeatmapID = table.Column<int>(type: "INTEGER", nullable: true),
2017-10-09 21:17:12 +00:00
Path = table.Column<string>(type: "TEXT", nullable: true),
2017-10-14 05:28:25 +00:00
RulesetID = table.Column<int>(type: "INTEGER", nullable: false),
2017-10-09 21:17:12 +00:00
SpecialStyle = table.Column<bool>(type: "INTEGER", nullable: false),
StackLeniency = table.Column<float>(type: "REAL", nullable: false),
StarDifficulty = table.Column<double>(type: "REAL", nullable: false),
StoredBookmarks = table.Column<string>(type: "TEXT", nullable: true),
TimelineZoom = table.Column<double>(type: "REAL", nullable: false),
Version = table.Column<string>(type: "TEXT", nullable: true),
WidescreenStoryboard = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
2017-10-14 05:28:25 +00:00
table.PrimaryKey("PK_BeatmapInfo", x => x.ID);
2017-10-19 05:05:11 +00:00
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapDifficulty_BaseDifficultyID",
column: x => x.BaseDifficultyID,
principalTable: "BeatmapDifficulty",
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
2017-10-09 21:17:12 +00:00
table.ForeignKey(
2017-10-14 05:28:25 +00:00
name: "FK_BeatmapInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
principalColumn: "ID",
2017-10-09 21:17:12 +00:00
onDelete: ReferentialAction.Cascade);
2017-10-19 05:05:11 +00:00
table.ForeignKey(
name: "FK_BeatmapInfo_BeatmapMetadata_MetadataID",
column: x => x.MetadataID,
principalTable: "BeatmapMetadata",
principalColumn: "ID",
onDelete: ReferentialAction.Restrict);
2017-10-09 21:17:12 +00:00
table.ForeignKey(
2017-10-14 05:28:25 +00:00
name: "FK_BeatmapInfo_RulesetInfo_RulesetID",
column: x => x.RulesetID,
2017-10-09 21:17:12 +00:00
principalTable: "RulesetInfo",
2017-10-14 05:28:25 +00:00
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
2017-10-19 05:05:11 +00:00
name: "BeatmapSetFileInfo",
2017-10-17 09:26:28 +00:00
columns: table => new
{
ID = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
2017-10-19 05:05:11 +00:00
BeatmapSetInfoID = table.Column<int>(type: "INTEGER", nullable: false),
FileInfoID = table.Column<int>(type: "INTEGER", nullable: false),
Filename = table.Column<string>(type: "TEXT", nullable: false)
2017-10-17 09:26:28 +00:00
},
constraints: table =>
{
2017-10-19 05:05:11 +00:00
table.PrimaryKey("PK_BeatmapSetFileInfo", x => x.ID);
table.ForeignKey(
2017-10-19 05:05:11 +00:00
name: "FK_BeatmapSetFileInfo_BeatmapSetInfo_BeatmapSetInfoID",
column: x => x.BeatmapSetInfoID,
principalTable: "BeatmapSetInfo",
2017-10-17 09:26:28 +00:00
principalColumn: "ID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
2017-10-19 05:05:11 +00:00
name: "FK_BeatmapSetFileInfo_FileInfo_FileInfoID",
column: x => x.FileInfoID,
principalTable: "FileInfo",
2017-10-14 05:28:25 +00:00
principalColumn: "ID",
2017-10-09 21:17:12 +00:00
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
2017-10-19 05:05:11 +00:00
name: "IX_BeatmapInfo_BaseDifficultyID",
table: "BeatmapInfo",
column: "BaseDifficultyID");
2017-10-09 21:17:12 +00:00
migrationBuilder.CreateIndex(
2017-10-17 09:26:28 +00:00
name: "IX_BeatmapInfo_BeatmapSetInfoID",
table: "BeatmapInfo",
2017-10-17 09:26:28 +00:00
column: "BeatmapSetInfoID");
2017-10-17 10:59:22 +00:00
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_Hash",
table: "BeatmapInfo",
column: "Hash");
2017-10-09 21:17:12 +00:00
migrationBuilder.CreateIndex(
name: "IX_BeatmapInfo_MD5Hash",
table: "BeatmapInfo",
column: "MD5Hash");
migrationBuilder.CreateIndex(
2017-10-19 05:05:11 +00:00
name: "IX_BeatmapInfo_MetadataID",
2017-10-09 21:17:12 +00:00
table: "BeatmapInfo",
2017-10-19 05:05:11 +00:00
column: "MetadataID");
2017-10-09 21:17:12 +00:00
2017-10-17 09:26:28 +00:00
migrationBuilder.CreateIndex(
2017-10-19 05:05:11 +00:00
name: "IX_BeatmapInfo_RulesetID",
table: "BeatmapInfo",
column: "RulesetID");
2017-10-17 09:26:28 +00:00
2017-10-09 21:17:12 +00:00
migrationBuilder.CreateIndex(
2017-10-14 05:28:25 +00:00
name: "IX_BeatmapSetFileInfo_BeatmapSetInfoID",
2017-10-09 21:17:12 +00:00
table: "BeatmapSetFileInfo",
2017-10-14 05:28:25 +00:00
column: "BeatmapSetInfoID");
2017-10-09 21:17:12 +00:00
migrationBuilder.CreateIndex(
2017-10-14 05:28:25 +00:00
name: "IX_BeatmapSetFileInfo_FileInfoID",
2017-10-09 21:17:12 +00:00
table: "BeatmapSetFileInfo",
2017-10-14 05:28:25 +00:00
column: "FileInfoID");
2017-10-09 21:17:12 +00:00
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_DeletePending",
table: "BeatmapSetInfo",
column: "DeletePending");
migrationBuilder.CreateIndex(
2017-10-17 10:59:22 +00:00
name: "IX_BeatmapSetInfo_Hash",
table: "BeatmapSetInfo",
column: "Hash");
2017-10-19 05:05:11 +00:00
migrationBuilder.CreateIndex(
name: "IX_BeatmapSetInfo_MetadataID",
table: "BeatmapSetInfo",
column: "MetadataID");
2017-10-17 10:59:22 +00:00
migrationBuilder.CreateIndex(
2017-10-09 21:17:12 +00:00
name: "IX_FileInfo_Hash",
table: "FileInfo",
column: "Hash",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_FileInfo_ReferenceCount",
table: "FileInfo",
column: "ReferenceCount");
migrationBuilder.CreateIndex(
name: "IX_KeyBinding_Action",
table: "KeyBinding",
column: "Action");
migrationBuilder.CreateIndex(
name: "IX_KeyBinding_Variant",
table: "KeyBinding",
column: "Variant");
migrationBuilder.CreateIndex(
name: "IX_RulesetInfo_Available",
table: "RulesetInfo",
column: "Available");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
2017-10-19 05:05:11 +00:00
name: "BeatmapInfo");
2017-10-09 21:17:12 +00:00
migrationBuilder.DropTable(
name: "BeatmapSetFileInfo");
migrationBuilder.DropTable(
name: "KeyBinding");
migrationBuilder.DropTable(
2017-10-19 05:05:11 +00:00
name: "BeatmapDifficulty");
2017-10-09 21:17:12 +00:00
migrationBuilder.DropTable(
2017-10-19 05:05:11 +00:00
name: "RulesetInfo");
2017-10-09 21:17:12 +00:00
migrationBuilder.DropTable(
name: "BeatmapSetInfo");
2017-10-09 21:17:12 +00:00
migrationBuilder.DropTable(
2017-10-19 05:05:11 +00:00
name: "FileInfo");
migrationBuilder.DropTable(
name: "BeatmapMetadata");
2017-10-09 21:17:12 +00:00
}
}
}