Skip to content

Commit

Permalink
Added new migration with all entities and no legacy entities
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-goldman-ssw committed Oct 22, 2024
1 parent ae8dc8a commit 2dd854d
Show file tree
Hide file tree
Showing 3 changed files with 472 additions and 0 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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");
}
}
}
Loading

0 comments on commit 2dd854d

Please sign in to comment.