using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; namespace ReallifeGamemode.Database.Migrations { public partial class Ammunations : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "WeaponCategories", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), Category = table.Column(nullable: true) }, constraints: table => { table.PrimaryKey("PK_WeaponCategories", x => x.Id); }); migrationBuilder.CreateTable( name: "Weapons", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), WeaponModel = table.Column(nullable: true), CategoryId = table.Column(nullable: false), SlotID = table.Column(nullable: false), Ammo = table.Column(nullable: false), Price = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Weapons", x => x.Id); table.ForeignKey( name: "FK_Weapons_WeaponCategories_CategoryId", column: x => x.CategoryId, principalTable: "WeaponCategories", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "UserWeapons", columns: table => new { Id = table.Column(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), UserId = table.Column(nullable: false), WeaponId = table.Column(nullable: false), Ammo = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_UserWeapons", x => x.Id); table.ForeignKey( name: "FK_UserWeapons_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_UserWeapons_Weapons_WeaponId", column: x => x.WeaponId, principalTable: "Weapons", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_UserWeapons_UserId", table: "UserWeapons", column: "UserId"); migrationBuilder.CreateIndex( name: "IX_UserWeapons_WeaponId", table: "UserWeapons", column: "WeaponId"); migrationBuilder.CreateIndex( name: "IX_Weapons_CategoryId", table: "Weapons", column: "CategoryId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "UserWeapons"); migrationBuilder.DropTable( name: "Weapons"); migrationBuilder.DropTable( name: "WeaponCategories"); } } }