after refactor cleanup
This commit is contained in:
227
DiunaBI.Infrastructure/Migrations/20230106095427_RenameModels.cs
Normal file
227
DiunaBI.Infrastructure/Migrations/20230106095427_RenameModels.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace DiunaBI.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RenameModels : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "DataRows");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "DataSets");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Layers",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Number = table.Column<int>(type: "int", nullable: false),
|
||||
Source = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
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_Layers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Layers_Users_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
table.ForeignKey(
|
||||
name: "FK_Layers_Users_ModifiedById",
|
||||
column: x => x.ModifiedById,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Records",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Code = 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),
|
||||
LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Records", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_Records_Layers_LayerId",
|
||||
column: x => x.LayerId,
|
||||
principalTable: "Layers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
table.ForeignKey(
|
||||
name: "FK_Records_Users_CreatedById",
|
||||
column: x => x.CreatedById,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
table.ForeignKey(
|
||||
name: "FK_Records_Users_ModifiedById",
|
||||
column: x => x.ModifiedById,
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Layers_CreatedById",
|
||||
table: "Layers",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Layers_ModifiedById",
|
||||
table: "Layers",
|
||||
column: "ModifiedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Records_CreatedById",
|
||||
table: "Records",
|
||||
column: "CreatedById");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Records_LayerId",
|
||||
table: "Records",
|
||||
column: "LayerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Records_ModifiedById",
|
||||
table: "Records",
|
||||
column: "ModifiedById");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Records");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Layers");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "DataSets",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
Number = table.Column<int>(type: "int", nullable: false),
|
||||
Source = table.Column<string>(type: "nvarchar(max)", 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),
|
||||
CreatedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ModifiedById = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Code = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DataSetId = table.Column<Guid>(type: "uniqueidentifier", 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),
|
||||
IsDeleted = table.Column<bool>(type: "bit", nullable: false),
|
||||
ModifiedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Value = table.Column<float>(type: "real", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DataRows", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_DataRows_DataSets_DataSetId",
|
||||
column: x => x.DataSetId,
|
||||
principalTable: "DataSets",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.NoAction);
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user