session-companion/SessionCompanion/SessionCompanion.Database/Migrations/20201213175031_Username column rename.cs

252 lines
12 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
namespace SessionCompanion.Database.Migrations
{
public partial class Usernamecolumnrename : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "Nickname",
table: "Users",
newName: "Username");
migrationBuilder.CreateTable(
name: "Charismas",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
Deception = table.Column<int>(type: "int", nullable: false),
CanDeception = table.Column<bool>(type: "bit", nullable: false),
Intimidation = table.Column<int>(type: "int", nullable: false),
CanIntimidation = table.Column<bool>(type: "bit", nullable: false),
Performance = table.Column<int>(type: "int", nullable: false),
CanPerformance = table.Column<bool>(type: "bit", nullable: false),
Persuasion = table.Column<int>(type: "int", nullable: false),
CanPersuasion = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Charismas", x => x.Id);
table.ForeignKey(
name: "FK_Charismas_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Constitutions",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Constitutions", x => x.Id);
table.ForeignKey(
name: "FK_Constitutions_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Dexterities",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
Acrobatics = table.Column<int>(type: "int", nullable: false),
CanAcrobatics = table.Column<bool>(type: "bit", nullable: false),
SleightOfHand = table.Column<int>(type: "int", nullable: false),
CanSleightOfHand = table.Column<bool>(type: "bit", nullable: false),
Stealth = table.Column<int>(type: "int", nullable: false),
CanStealth = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Dexterities", x => x.Id);
table.ForeignKey(
name: "FK_Dexterities_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Intelligences",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
Arcana = table.Column<int>(type: "int", nullable: false),
CanArcana = table.Column<bool>(type: "bit", nullable: false),
History = table.Column<int>(type: "int", nullable: false),
CanHistory = table.Column<bool>(type: "bit", nullable: false),
Investigation = table.Column<int>(type: "int", nullable: false),
CanInvestigation = table.Column<bool>(type: "bit", nullable: false),
Nature = table.Column<int>(type: "int", nullable: false),
CanNature = table.Column<bool>(type: "bit", nullable: false),
Religion = table.Column<int>(type: "int", nullable: false),
CanReligion = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Intelligences", x => x.Id);
table.ForeignKey(
name: "FK_Intelligences_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Strengths",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
Athletics = table.Column<int>(type: "int", nullable: false),
CanAthletics = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Strengths", x => x.Id);
table.ForeignKey(
name: "FK_Strengths_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "Wisdoms",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CharacterId = table.Column<int>(type: "int", nullable: false),
Value = table.Column<int>(type: "int", nullable: false),
Modification = table.Column<int>(type: "int", nullable: false),
SavingThrows = table.Column<int>(type: "int", nullable: false),
CanSaveThrows = table.Column<bool>(type: "bit", nullable: false),
AnimalHandling = table.Column<int>(type: "int", nullable: false),
CanAnimalHandling = table.Column<bool>(type: "bit", nullable: false),
Insight = table.Column<int>(type: "int", nullable: false),
CanInsight = table.Column<bool>(type: "bit", nullable: false),
Medicine = table.Column<int>(type: "int", nullable: false),
CanMedicine = table.Column<bool>(type: "bit", nullable: false),
Perception = table.Column<int>(type: "int", nullable: false),
CanPerception = table.Column<bool>(type: "bit", nullable: false),
Survival = table.Column<int>(type: "int", nullable: false),
CanSurvival = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Wisdoms", x => x.Id);
table.ForeignKey(
name: "FK_Wisdoms_Characters_CharacterId",
column: x => x.CharacterId,
principalTable: "Characters",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Charismas_CharacterId",
table: "Charismas",
column: "CharacterId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Constitutions_CharacterId",
table: "Constitutions",
column: "CharacterId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Dexterities_CharacterId",
table: "Dexterities",
column: "CharacterId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Intelligences_CharacterId",
table: "Intelligences",
column: "CharacterId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Strengths_CharacterId",
table: "Strengths",
column: "CharacterId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Wisdoms_CharacterId",
table: "Wisdoms",
column: "CharacterId",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Charismas");
migrationBuilder.DropTable(
name: "Constitutions");
migrationBuilder.DropTable(
name: "Dexterities");
migrationBuilder.DropTable(
name: "Intelligences");
migrationBuilder.DropTable(
name: "Strengths");
migrationBuilder.DropTable(
name: "Wisdoms");
migrationBuilder.RenameColumn(
name: "Username",
table: "Users",
newName: "Nickname");
}
}
}