using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace DiunaBI.Infrastructure.Migrations { /// public partial class DataSetsAndDataRows : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DataSets", columns: table => new { Id = table.Column(type: "uniqueidentifier", nullable: false), Number = table.Column(type: "nvarchar(max)", nullable: false), Name = table.Column(type: "nvarchar(max)", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), ModifiedAt = table.Column(type: "datetime2", nullable: false), IsDeleted = table.Column(type: "bit", nullable: false), CreatedById = table.Column(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column(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(type: "uniqueidentifier", nullable: false), MPK = table.Column(type: "nvarchar(max)", nullable: false), Value = table.Column(type: "real", nullable: false), Desc1 = table.Column(type: "nvarchar(max)", nullable: true), Desc2 = table.Column(type: "nvarchar(max)", nullable: true), Desc3 = table.Column(type: "nvarchar(max)", nullable: true), Desc4 = table.Column(type: "nvarchar(max)", nullable: true), Desc5 = table.Column(type: "nvarchar(max)", nullable: true), CreatedAt = table.Column(type: "datetime2", nullable: false), ModifiedAt = table.Column(type: "datetime2", nullable: false), IsDeleted = table.Column(type: "bit", nullable: false), CreatedById = table.Column(type: "uniqueidentifier", nullable: false), ModifiedById = table.Column(type: "uniqueidentifier", nullable: false), DataSetId = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DataRows"); migrationBuilder.DropTable( name: "DataSets"); } } }