using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace IsleBot.Migrations { /// public partial class Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Players", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), UserName = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Players", x => x.Id); }); migrationBuilder.CreateTable( name: "Cards", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Name = table.Column(type: "TEXT", nullable: false), Attack = table.Column(type: "INTEGER", nullable: false), Defense = table.Column(type: "INTEGER", nullable: false), MaxHealth = table.Column(type: "INTEGER", nullable: false), CurrentHealth = table.Column(type: "INTEGER", nullable: false), OwnerId = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Cards", x => x.Id); table.ForeignKey( name: "FK_Cards_Players_OwnerId", column: x => x.OwnerId, principalTable: "Players", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "Matches", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), PlayerAId = table.Column(type: "INTEGER", nullable: false), PlayerACardId = table.Column(type: "INTEGER", nullable: false), PlayerBId = table.Column(type: "INTEGER", nullable: false), PlayerBCardId = table.Column(type: "INTEGER", nullable: false), PlayedTurns = table.Column(type: "INTEGER", nullable: false), Status = table.Column(type: "INTEGER", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Matches", x => x.Id); table.ForeignKey( name: "FK_Matches_Cards_PlayerACardId", column: x => x.PlayerACardId, principalTable: "Cards", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Matches_Cards_PlayerBCardId", column: x => x.PlayerBCardId, principalTable: "Cards", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Matches_Players_PlayerAId", column: x => x.PlayerAId, principalTable: "Players", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Matches_Players_PlayerBId", column: x => x.PlayerBId, principalTable: "Players", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Cards_OwnerId", table: "Cards", column: "OwnerId"); migrationBuilder.CreateIndex( name: "IX_Matches_PlayerACardId", table: "Matches", column: "PlayerACardId"); migrationBuilder.CreateIndex( name: "IX_Matches_PlayerAId", table: "Matches", column: "PlayerAId"); migrationBuilder.CreateIndex( name: "IX_Matches_PlayerBCardId", table: "Matches", column: "PlayerBCardId"); migrationBuilder.CreateIndex( name: "IX_Matches_PlayerBId", table: "Matches", column: "PlayerBId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Matches"); migrationBuilder.DropTable( name: "Cards"); migrationBuilder.DropTable( name: "Players"); } } }