326 lines
18 KiB
C#
326 lines
18 KiB
C#
namespace Weee.Migrations
|
|
{
|
|
using System;
|
|
using System.Data.Entity.Migrations;
|
|
|
|
public partial class add_riskAssmt_tables : DbMigration
|
|
{
|
|
public override void Up()
|
|
{
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_AssmtFactor",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
FactorName = c.String(),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_AssmtFactorScore",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
FactorId = c.Int(nullable: false),
|
|
OptionDescription = c.String(),
|
|
OptionScore = c.Int(nullable: false),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCARiskAssmtSurveyForm_AssmtFactor", t => t.FactorId, cascadeDelete: true)
|
|
.Index(t => t.FactorId);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_IntlTravel",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
Traveller = c.String(),
|
|
TravelDate = c.DateTime(nullable: false),
|
|
AirportFrom = c.String(),
|
|
AirportTo = c.String(),
|
|
AirportClass = c.String(),
|
|
KgCo2 = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_ItemDelivery",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
MaterialNo = c.String(),
|
|
ModelName = c.String(),
|
|
Fab = c.String(),
|
|
DeliveryAmount = c.Int(nullable: false),
|
|
TotalWeightKg = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TotalWeightT = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
DeliveryAddr = c.String(),
|
|
TransportLand = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportSea = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportLand3 = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportTkmland = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportTkmsea = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportTkmland3 = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TotalTkmland = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportLandCo2e = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransportSeaCo2e = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TradeCondition = c.String(),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_ItemPurchase",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
MaterialNo = c.String(),
|
|
ElementNo = c.String(),
|
|
ElementName = c.String(),
|
|
ElementWeight = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
ElementWeightUnit = c.String(),
|
|
PurchaseAmount = c.Int(nullable: false),
|
|
ActivityIntensity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
VendorName = c.String(),
|
|
ShippingAddr = c.String(),
|
|
ShippingLongitude = c.Single(),
|
|
ShippingLatitude = c.Single(),
|
|
ShippingAmt = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
ShippingDistance = c.Single(nullable: false),
|
|
ShippingDistanceUnit = c.String(),
|
|
TKM = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TradeCondition = c.String(),
|
|
Url = c.String(),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_LifecycleAssmt",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
Phase = c.String(),
|
|
Item = c.String(),
|
|
ActivityIntensity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
KgCO2e = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Unit = c.String(),
|
|
EmissionKg = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
EmissionT = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Percentage = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Instruction = c.String(),
|
|
Scenario = c.String(),
|
|
UncertaintyAnalysis = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_MaterialC3Emission",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
MaterialName = c.String(),
|
|
AnnualPurchaseAmount = c.Int(nullable: false),
|
|
MaterialSpec = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
MaterialSpecUnit = c.String(),
|
|
TransferredMaterialSpec = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
TransferredMaterialSpecUnit = c.String(),
|
|
ActivityIntensity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
ActivityIntensityUnit = c.String(),
|
|
KgCO2e = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Unit = c.String(),
|
|
Emission = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_PowerConsumption",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
ModelType = c.String(),
|
|
AppSystemType = c.String(),
|
|
Scenario = c.String(),
|
|
Spec = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
MinSpec = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
PowerUsage = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
PowerLoss = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
WorkingHour = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
PowerUsagePerHour = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
PowerLossPerYear = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_SignificanceAssmt",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_WasteMaterial",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
LCAID = c.Int(nullable: false),
|
|
MaterialName = c.String(),
|
|
Unit = c.String(),
|
|
JanQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
FebQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
MarQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
AprQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
MayQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
JunQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
JulQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
AugQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
SeptQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
OctQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
NovQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
DecQuantity = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID);
|
|
|
|
CreateTable(
|
|
"dbo.LCARiskAssmtSurveyForm_WaterUsages",
|
|
c => new
|
|
{
|
|
ID = c.Int(nullable: false, identity: true),
|
|
ReferenceFileLink = c.String(),
|
|
Index = c.Int(nullable: false),
|
|
Scalar = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
KgCO2e = c.Decimal(nullable: false, precision: 24, scale: 12),
|
|
Area = c.String(),
|
|
Year = c.String(),
|
|
ReferenceLink = c.String(),
|
|
LCAID = c.Int(nullable: false),
|
|
ParameterID = c.Int(),
|
|
Comment = c.String(),
|
|
CreatedBy = c.String(),
|
|
CreatedDate = c.DateTime(),
|
|
ModifiedBy = c.String(),
|
|
ModifiedDate = c.DateTime(),
|
|
})
|
|
.PrimaryKey(t => t.ID)
|
|
.ForeignKey("dbo.YearlyParameters", t => t.ParameterID)
|
|
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
|
|
.Index(t => t.LCAID)
|
|
.Index(t => t.ParameterID);
|
|
|
|
}
|
|
|
|
public override void Down()
|
|
{
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_WaterUsages", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_WaterUsages", "ParameterID", "dbo.YearlyParameters");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_WasteMaterial", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_SignificanceAssmt", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_PowerConsumption", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_MaterialC3Emission", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_LifecycleAssmt", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_ItemPurchase", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_ItemDelivery", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_IntlTravel", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_AssmtFactor", "LCAID", "dbo.LCAs");
|
|
DropForeignKey("dbo.LCARiskAssmtSurveyForm_AssmtFactorScore", "FactorId", "dbo.LCARiskAssmtSurveyForm_AssmtFactor");
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_WaterUsages", new[] { "ParameterID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_WaterUsages", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_WasteMaterial", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_SignificanceAssmt", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_PowerConsumption", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_MaterialC3Emission", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_LifecycleAssmt", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_ItemPurchase", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_ItemDelivery", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_IntlTravel", new[] { "LCAID" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_AssmtFactorScore", new[] { "FactorId" });
|
|
DropIndex("dbo.LCARiskAssmtSurveyForm_AssmtFactor", new[] { "LCAID" });
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_WaterUsages");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_WasteMaterial");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_SignificanceAssmt");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_PowerConsumption");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_MaterialC3Emission");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_LifecycleAssmt");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_ItemPurchase");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_ItemDelivery");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_IntlTravel");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_AssmtFactorScore");
|
|
DropTable("dbo.LCARiskAssmtSurveyForm_AssmtFactor");
|
|
}
|
|
}
|
|
}
|