using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace OnProfNext.Server.Migrations { /// public partial class AddBookingsConfiguration : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Bookings", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), OrderId = table.Column(type: "int", nullable: false), UserId = table.Column(type: "int", nullable: false), Date = table.Column(type: "datetime2", nullable: false), Hours = table.Column(type: "decimal(5,2)", nullable: false), Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), MandantId = table.Column(type: "int", nullable: false), CreatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"), UpdatedAt = table.Column(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()") }, constraints: table => { table.PrimaryKey("PK_Bookings", x => x.Id); table.ForeignKey( name: "FK_Bookings_Orders_OrderId", column: x => x.OrderId, principalTable: "Orders", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_Bookings_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Bookings_OrderId", table: "Bookings", column: "OrderId"); migrationBuilder.CreateIndex( name: "IX_Bookings_UserId", table: "Bookings", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Bookings"); } } }