demo20230512/Migrations/202212140103470_addTableEmployeeCommuting.cs

43 lines
1.8 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 addTableEmployeeCommuting : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.LCARiskAssmtSurveyForm_EmployeeCommuting",
c => new
{
Id = c.Int(nullable: false, identity: true),
Guid = c.Guid(nullable: false, defaultValueSql:"newid()"),
LCAID = c.Int(nullable: false),
Commuting = c.Int(nullable: false),
TotalEmployees = c.Int(nullable: false),
WorkingDays = c.Int(nullable: false),
AverageMovingDistance = c.Decimal(nullable: false, precision: 24, scale: 12),
PersonDayKm = c.Decimal(nullable: false, precision: 24, scale: 12),
KgCO2e = c.Decimal(nullable: false, precision: 24, scale: 12),
Comment = c.String(),
CreatedBy = c.String(),
CreatedDate = c.DateTime(nullable:false, defaultValueSql:"getdate()"),
ModifiedBy = c.String(),
ModifiedDate = c.DateTime(nullable: false, defaultValueSql: "getdate()"),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.LCAs", t => t.LCAID, cascadeDelete: true)
.Index(t => t.LCAID);
}
public override void Down()
{
DropForeignKey("dbo.LCARiskAssmtSurveyForm_EmployeeCommuting", "LCAID", "dbo.LCAs");
DropIndex("dbo.LCARiskAssmtSurveyForm_EmployeeCommuting", new[] { "LCAID" });
DropTable("dbo.LCARiskAssmtSurveyForm_EmployeeCommuting");
}
}
}