demo20230512/Migrations/202209140703487_addLCARiskAssmtSurveyForm_MaterialTransport.cs

54 lines
2.7 KiB
C#
Raw Normal View History

2023-05-12 10:20:28 +08:00
namespace Weee.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class addLCARiskAssmtSurveyForm_MaterialTransport : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.LCARiskAssmtSurveyForm_MaterialTransport",
c => new
{
ID = c.Int(nullable: false, identity: true),
LCAID = c.Int(nullable: false),
RiskAssmtMaterialID = c.Int(),
TransportDate = c.DateTime(nullable: false),
JourneyNO = c.String(),
StartLocation = c.String(),
EndLocation = c.String(),
TransportDistance = c.Decimal(nullable: false, precision: 24, scale: 12),
TransportQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
TransportWeight = c.Decimal(nullable: false, precision: 24, scale: 12),
Scalar = c.Decimal(nullable: false, precision: 24, scale: 12),
KgCO2e = c.Decimal(nullable: false, precision: 24, scale: 12),
DQI = c.Int(nullable: false),
Description = c.String(),
ParameterID = c.Int(),
ModifiedBy = c.String(),
ModifiedDate = c.DateTime(),
})
.PrimaryKey(t => t.ID)
.ForeignKey("dbo.LCAs", t => t.LCAID)//, cascadeDelete: true)
.ForeignKey("dbo.NonYearlyParameters", t => t.ParameterID)
.ForeignKey("dbo.LCARiskAssmtSurveyForm_MaterialC3Emission", t => t.RiskAssmtMaterialID)
.Index(t => t.LCAID)
.Index(t => t.RiskAssmtMaterialID)
.Index(t => t.ParameterID);
}
public override void Down()
{
DropForeignKey("dbo.LCARiskAssmtSurveyForm_MaterialTransport", "RiskAssmtMaterialID", "dbo.LCARiskAssmtSurveyForm_MaterialC3Emission");
DropForeignKey("dbo.LCARiskAssmtSurveyForm_MaterialTransport", "ParameterID", "dbo.NonYearlyParameters");
DropForeignKey("dbo.LCARiskAssmtSurveyForm_MaterialTransport", "LCAID", "dbo.LCAs");
DropIndex("dbo.LCARiskAssmtSurveyForm_MaterialTransport", new[] { "ParameterID" });
DropIndex("dbo.LCARiskAssmtSurveyForm_MaterialTransport", new[] { "RiskAssmtMaterialID" });
DropIndex("dbo.LCARiskAssmtSurveyForm_MaterialTransport", new[] { "LCAID" });
DropTable("dbo.LCARiskAssmtSurveyForm_MaterialTransport");
}
}
}