SHA256
- Added new entity "StayEntry" to log stays of guests. - Added pages for StayEntry management (List and creation). - New DataList for PaymentMethods. - Other general changes and improvements.
76 lines
3.6 KiB
C#
76 lines
3.6 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
|
|
#nullable disable
|
|
|
|
namespace Somnia.GuestLog.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddTable_StayEntry : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "StayEntry",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
DateIn = table.Column<DateTime>(type: "timestamp(0) with time zone", nullable: false),
|
|
DateOut = table.Column<DateTime>(type: "timestamp(0) with time zone", nullable: false),
|
|
RoomCount = table.Column<int>(type: "integer", nullable: false),
|
|
RoomNumber = table.Column<string>(type: "character varying(32)", maxLength: 32, nullable: true),
|
|
PaymentMethod = table.Column<string>(type: "character varying(5)", maxLength: 5, nullable: false),
|
|
CreateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_StayEntry", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "GuestDocumentStayEntry",
|
|
columns: table => new
|
|
{
|
|
StayEntryId = table.Column<long>(type: "bigint", nullable: false),
|
|
GuestDocumentsDocumentType = table.Column<string>(type: "character varying(8)", nullable: false),
|
|
GuestDocumentsDocumentNum = table.Column<string>(type: "character varying(64)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_GuestDocumentStayEntry", x => new { x.StayEntryId, x.GuestDocumentsDocumentType, x.GuestDocumentsDocumentNum });
|
|
table.ForeignKey(
|
|
name: "FK_GuestDocumentStayEntry_GuestDocument_GuestDocumentsDocument~",
|
|
columns: x => new { x.GuestDocumentsDocumentType, x.GuestDocumentsDocumentNum },
|
|
principalTable: "GuestDocument",
|
|
principalColumns: new[] { "DocumentType", "DocumentNum" },
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_GuestDocumentStayEntry_StayEntry_StayEntryId",
|
|
column: x => x.StayEntryId,
|
|
principalTable: "StayEntry",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_GuestDocumentStayEntry_GuestDocumentsDocumentType_GuestDocu~",
|
|
table: "GuestDocumentStayEntry",
|
|
columns: new[] { "GuestDocumentsDocumentType", "GuestDocumentsDocumentNum" });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "GuestDocumentStayEntry");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "StayEntry");
|
|
}
|
|
}
|
|
}
|