using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.SeaHavenIndustries.Migrations { /// public partial class AddVendorAndDispatch : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Vendors", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CompanyName = table.Column(type: "nvarchar(max)", nullable: true), ContactName = table.Column(type: "nvarchar(max)", nullable: true), Email = table.Column(type: "nvarchar(max)", nullable: true), Phone = table.Column(type: "nvarchar(max)", nullable: true), Address = table.Column(type: "nvarchar(max)", nullable: true), City = table.Column(type: "nvarchar(max)", nullable: true), State = table.Column(type: "nvarchar(max)", nullable: true), Zip = table.Column(type: "nvarchar(max)", nullable: true), TradeSpecialties = table.Column(type: "nvarchar(max)", nullable: true), IsActive = table.Column(type: "bit", nullable: false), IsDeleted = table.Column(type: "bit", nullable: true), createdby = table.Column(type: "nvarchar(max)", nullable: true), DeleterUserId = table.Column(type: "nvarchar(max)", nullable: true), DeletionTime = table.Column(type: "datetime2", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierUserId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Vendors", x => x.Id); }); migrationBuilder.CreateTable( name: "Dispatches", columns: table => new { Id = table.Column(type: "int", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WorkOrderId = table.Column(type: "int", nullable: false), VendorId = table.Column(type: "int", nullable: false), PONumber = table.Column(type: "nvarchar(max)", nullable: true), NTEAmount = table.Column(type: "decimal(18,2)", nullable: true), Description = table.Column(type: "nvarchar(max)", nullable: true), Status = table.Column(type: "nvarchar(max)", nullable: true), DispatchedAt = table.Column(type: "datetime2", nullable: true), EmailSent = table.Column(type: "bit", nullable: false), ReplyToAddress = table.Column(type: "nvarchar(max)", nullable: true), IsDeleted = table.Column(type: "bit", nullable: true), createdby = table.Column(type: "nvarchar(max)", nullable: true), DeleterUserId = table.Column(type: "nvarchar(max)", nullable: true), DeletionTime = table.Column(type: "datetime2", nullable: true), CreatedDate = table.Column(type: "datetime2", nullable: true), LastModificationTime = table.Column(type: "datetime2", nullable: true), LastModifierUserId = table.Column(type: "int", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Dispatches", x => x.Id); table.ForeignKey( name: "FK_Dispatches_Vendors_VendorId", column: x => x.VendorId, principalTable: "Vendors", principalColumn: "Id", onDelete: ReferentialAction.Restrict); table.ForeignKey( name: "FK_Dispatches_workOrders_WorkOrderId", column: x => x.WorkOrderId, principalTable: "workOrders", principalColumn: "Id", onDelete: ReferentialAction.Restrict); }); migrationBuilder.CreateIndex( name: "IX_Dispatches_VendorId", table: "Dispatches", column: "VendorId"); migrationBuilder.CreateIndex( name: "IX_Dispatches_WorkOrderId", table: "Dispatches", column: "WorkOrderId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Dispatches"); migrationBuilder.DropTable( name: "Vendors"); } } }