| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- namespace WePlatform.Migrations
- {
- using System;
- using System.Collections.Generic;
- using System.Data.Entity.Infrastructure.Annotations;
- using System.Data.Entity.Migrations;
-
- public partial class AddEmergencyPlan : DbMigration
- {
- public override void Up()
- {
- CreateTable(
- "dbo.WeLib_EmergencyPlanContents",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- PlanNo = c.String(maxLength: 128),
- PlanContent = c.String(),
- Version = c.String(),
- IsUse = c.Boolean(nullable: false),
- Remark = c.String(maxLength: 500),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.WeLib_EmergencyPlans", t => t.PlanNo)
- .Index(t => t.PlanNo)
- .Index(t => t.CreatorUserId);
-
- CreateTable(
- "dbo.WeLib_EmergencyPlans",
- c => new
- {
- Id = c.String(nullable: false, maxLength: 128),
- ParentNo = c.String(maxLength: 128),
- Name = c.String(maxLength: 50),
- Path = c.String(maxLength: 1000),
- Sort = c.Int(nullable: false),
- Description = c.String(maxLength: 500),
- Remark = c.String(maxLength: 500),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_EmergencyPlanInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .ForeignKey("dbo.WeLib_EmergencyPlans", t => t.ParentNo)
- .Index(t => t.ParentNo)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
-
- CreateTable(
- "dbo.WeLib_EmergencyResources",
- c => new
- {
- Id = c.String(nullable: false, maxLength: 128),
- Name = c.String(maxLength: 50),
- Quantity = c.Decimal(nullable: false, precision: 18, scale: 2),
- Type = c.Int(),
- Description = c.String(maxLength: 500),
- Remark = c.String(maxLength: 500),
- IsDeleted = c.Boolean(nullable: false),
- DeleterUserId = c.Long(),
- DeletionTime = c.DateTime(),
- LastModificationTime = c.DateTime(),
- LastModifierUserId = c.Long(),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- },
- annotations: new Dictionary<string, object>
- {
- { "DynamicFilter_EmergencyResourceInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.Sys_Users", t => t.DeleterUserId)
- .ForeignKey("dbo.Sys_Users", t => t.LastModifierUserId)
- .Index(t => t.IsDeleted)
- .Index(t => t.DeleterUserId)
- .Index(t => t.LastModifierUserId)
- .Index(t => t.CreatorUserId);
-
- CreateTable(
- "dbo.WeLib_KnowledgeRelatePlans",
- c => new
- {
- Id = c.Int(nullable: false, identity: true),
- KnowledgeNo = c.String(maxLength: 128),
- PlanNo = c.String(maxLength: 128),
- CreationTime = c.DateTime(nullable: false),
- CreatorUserId = c.Long(),
- })
- .PrimaryKey(t => t.Id)
- .ForeignKey("dbo.Sys_Users", t => t.CreatorUserId)
- .ForeignKey("dbo.WeLib_Knowledges", t => t.KnowledgeNo)
- .ForeignKey("dbo.WeLib_EmergencyPlans", t => t.PlanNo)
- .Index(t => t.KnowledgeNo)
- .Index(t => t.PlanNo)
- .Index(t => t.CreatorUserId);
-
- }
-
- public override void Down()
- {
- DropForeignKey("dbo.WeLib_KnowledgeRelatePlans", "PlanNo", "dbo.WeLib_EmergencyPlans");
- DropForeignKey("dbo.WeLib_KnowledgeRelatePlans", "KnowledgeNo", "dbo.WeLib_Knowledges");
- DropForeignKey("dbo.WeLib_KnowledgeRelatePlans", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyResources", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyResources", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyResources", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyPlanContents", "PlanNo", "dbo.WeLib_EmergencyPlans");
- DropForeignKey("dbo.WeLib_EmergencyPlans", "ParentNo", "dbo.WeLib_EmergencyPlans");
- DropForeignKey("dbo.WeLib_EmergencyPlans", "LastModifierUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyPlans", "DeleterUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyPlans", "CreatorUserId", "dbo.Sys_Users");
- DropForeignKey("dbo.WeLib_EmergencyPlanContents", "CreatorUserId", "dbo.Sys_Users");
- DropIndex("dbo.WeLib_KnowledgeRelatePlans", new[] { "CreatorUserId" });
- DropIndex("dbo.WeLib_KnowledgeRelatePlans", new[] { "PlanNo" });
- DropIndex("dbo.WeLib_KnowledgeRelatePlans", new[] { "KnowledgeNo" });
- DropIndex("dbo.WeLib_EmergencyResources", new[] { "CreatorUserId" });
- DropIndex("dbo.WeLib_EmergencyResources", new[] { "LastModifierUserId" });
- DropIndex("dbo.WeLib_EmergencyResources", new[] { "DeleterUserId" });
- DropIndex("dbo.WeLib_EmergencyResources", new[] { "IsDeleted" });
- DropIndex("dbo.WeLib_EmergencyPlans", new[] { "CreatorUserId" });
- DropIndex("dbo.WeLib_EmergencyPlans", new[] { "LastModifierUserId" });
- DropIndex("dbo.WeLib_EmergencyPlans", new[] { "DeleterUserId" });
- DropIndex("dbo.WeLib_EmergencyPlans", new[] { "IsDeleted" });
- DropIndex("dbo.WeLib_EmergencyPlans", new[] { "ParentNo" });
- DropIndex("dbo.WeLib_EmergencyPlanContents", new[] { "CreatorUserId" });
- DropIndex("dbo.WeLib_EmergencyPlanContents", new[] { "PlanNo" });
- DropTable("dbo.WeLib_KnowledgeRelatePlans");
- DropTable("dbo.WeLib_EmergencyResources",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_EmergencyResourceInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.WeLib_EmergencyPlans",
- removedAnnotations: new Dictionary<string, object>
- {
- { "DynamicFilter_EmergencyPlanInfo_SoftDelete", "EntityFramework.DynamicFilters.DynamicFilterDefinition" },
- });
- DropTable("dbo.WeLib_EmergencyPlanContents");
- }
- }
- }
|