-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new migration with all entities and no legacy entities
- Loading branch information
1 parent
ae8dc8a
commit 2dd854d
Showing
3 changed files
with
472 additions
and
0 deletions.
There are no files selected for viewing
185 changes: 185 additions & 0 deletions
185
src/Infrastructure/Persistence/Migrations/20241022032926_AddHeroesAndTeams.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
105 changes: 105 additions & 0 deletions
105
src/Infrastructure/Persistence/Migrations/20241022032926_AddHeroesAndTeams.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace SSW.CleanArchitecture.Infrastructure.Persistence.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class AddHeroesAndTeams : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Teams", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
TotalPowerLevel = table.Column<int>(type: "int", nullable: false), | ||
Status = table.Column<int>(type: "int", nullable: false), | ||
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false), | ||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true), | ||
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), | ||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Teams", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Heroes", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
Alias = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
PowerLevel = table.Column<int>(type: "int", nullable: false), | ||
TeamId = table.Column<Guid>(type: "uniqueidentifier", nullable: true), | ||
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false), | ||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true), | ||
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), | ||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true), | ||
Powers = table.Column<string>(type: "nvarchar(max)", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Heroes", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Heroes_Teams_TeamId", | ||
column: x => x.TeamId, | ||
principalTable: "Teams", | ||
principalColumn: "Id"); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Mission", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Description = table.Column<string>(type: "nvarchar(max)", nullable: false), | ||
Status = table.Column<int>(type: "int", nullable: false), | ||
TeamId = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
CreatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: false), | ||
CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true), | ||
UpdatedAt = table.Column<DateTimeOffset>(type: "datetimeoffset", nullable: true), | ||
UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Mission", x => x.Id); | ||
table.ForeignKey( | ||
name: "FK_Mission_Teams_TeamId", | ||
column: x => x.TeamId, | ||
principalTable: "Teams", | ||
principalColumn: "Id", | ||
onDelete: ReferentialAction.Cascade); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Heroes_TeamId", | ||
table: "Heroes", | ||
column: "TeamId"); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Mission_TeamId", | ||
table: "Mission", | ||
column: "TeamId"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Heroes"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Mission"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Teams"); | ||
} | ||
} | ||
} |
Oops, something went wrong.