Files
DiunaBI/DiunaBI.Infrastructure/Migrations/20221211210507_DataSetsAndDataRows.cs

122 lines
5.5 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace DiunaBI.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class DataSetsAndDataRows : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DataSets",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Number = table.Column<string>(type: "nvarchar(max)", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DataSets", x => x.Id);
table.ForeignKey(
name: "FK_DataSets_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
table.ForeignKey(
name: "FK_DataSets_Users_ModifiedById",
column: x => x.ModifiedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateTable(
name: "DataRows",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
MPK = table.Column<string>(type: "nvarchar(max)", nullable: false),
Value = table.Column<float>(type: "real", nullable: false),
Desc1 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc2 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc3 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc4 = table.Column<string>(type: "nvarchar(max)", nullable: true),
Desc5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DataSetId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DataRows", x => x.Id);
table.ForeignKey(
name: "FK_DataRows_DataSets_DataSetId",
column: x => x.DataSetId,
principalTable: "DataSets",
principalColumn: "Id");
table.ForeignKey(
name: "FK_DataRows_Users_CreatedById",
column: x => x.CreatedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
table.ForeignKey(
name: "FK_DataRows_Users_ModifiedById",
column: x => x.ModifiedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateIndex(
name: "IX_DataRows_CreatedById",
table: "DataRows",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_DataRows_DataSetId",
table: "DataRows",
column: "DataSetId");
migrationBuilder.CreateIndex(
name: "IX_DataRows_ModifiedById",
table: "DataRows",
column: "ModifiedById");
migrationBuilder.CreateIndex(
name: "IX_DataSets_CreatedById",
table: "DataSets",
column: "CreatedById");
migrationBuilder.CreateIndex(
name: "IX_DataSets_ModifiedById",
table: "DataSets",
column: "ModifiedById");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DataRows");
migrationBuilder.DropTable(
name: "DataSets");
}
}
}