65 lines
2.7 KiB
C#
65 lines
2.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace OnProfNext.Server.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddBookingsConfiguration : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "Bookings",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
OrderId = table.Column<int>(type: "int", nullable: false),
|
|
UserId = table.Column<int>(type: "int", nullable: false),
|
|
Date = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Hours = table.Column<decimal>(type: "decimal(5,2)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
|
|
MandantId = table.Column<int>(type: "int", nullable: false),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false, defaultValueSql: "GETUTCDATE()"),
|
|
UpdatedAt = table.Column<DateTime>(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");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "Bookings");
|
|
}
|
|
}
|
|
}
|