using Microsoft.EntityFrameworkCore.Migrations; namespace Single_Page_Anwendung.Migrations { public partial class InitialCreate : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Kategorien", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(maxLength: 100, nullable: true), Beschreibung = table.Column(maxLength: 255, nullable: true) }, constraints: table => { table.PrimaryKey("PK_Kategorien", x => x.Id); }); migrationBuilder.CreateTable( name: "Speisen", columns: table => new { Id = table.Column(nullable: false) .Annotation("SqlServer:Identity", "1, 1"), Name = table.Column(maxLength: 100, nullable: false), Beschreibung = table.Column(maxLength: 255, nullable: true), Preis = table.Column(nullable: false), KategorieId = table.Column(nullable: false) }, constraints: table => { table.PrimaryKey("PK_Speisen", x => x.Id); table.ForeignKey( name: "FK_Speisen_Kategorien_KategorieId", column: x => x.KategorieId, principalTable: "Kategorien", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_Speisen_KategorieId", table: "Speisen", column: "KategorieId"); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Speisen"); migrationBuilder.DropTable( name: "Kategorien"); } } }