|
| 1 | +namespace AbpCompanyName.AbpProjectName.Migrations |
| 2 | +{ |
| 3 | + using System; |
| 4 | + using System.Collections.Generic; |
| 5 | + using System.Data.Entity.Infrastructure.Annotations; |
| 6 | + using System.Data.Entity.Migrations; |
| 7 | + |
| 8 | + public partial class Upgraded_To_ABP_5_13_0 : DbMigration |
| 9 | + { |
| 10 | + public override void Up() |
| 11 | + { |
| 12 | + DropForeignKey("dbo.AbpDynamicParameterValues", "DynamicParameterId", "dbo.AbpDynamicParameters"); |
| 13 | + DropForeignKey("dbo.AbpEntityDynamicParameters", "DynamicParameterId", "dbo.AbpDynamicParameters"); |
| 14 | + DropForeignKey("dbo.AbpEntityDynamicParameterValues", "EntityDynamicParameterId", "dbo.AbpEntityDynamicParameters"); |
| 15 | + DropIndex("dbo.AbpDynamicParameters", new[] { "ParameterName", "TenantId" }); |
| 16 | + DropIndex("dbo.AbpDynamicParameters", new[] { "TenantId" }); |
| 17 | + DropIndex("dbo.AbpDynamicParameterValues", new[] { "TenantId" }); |
| 18 | + DropIndex("dbo.AbpDynamicParameterValues", new[] { "DynamicParameterId" }); |
| 19 | + DropIndex("dbo.AbpEntityDynamicParameters", new[] { "EntityFullName", "DynamicParameterId", "TenantId" }); |
| 20 | + DropIndex("dbo.AbpEntityDynamicParameters", new[] { "TenantId" }); |
| 21 | + DropIndex("dbo.AbpEntityDynamicParameterValues", new[] { "EntityDynamicParameterId" }); |
| 22 | + DropIndex("dbo.AbpEntityDynamicParameterValues", new[] { "TenantId" }); |
| 23 | + CreateTable( |
| 24 | + "dbo.AbpDynamicEntityProperties", |
| 25 | + c => new |
| 26 | + { |
| 27 | + Id = c.Int(nullable: false, identity: true), |
| 28 | + EntityFullName = c.String(maxLength: 250), |
| 29 | + DynamicPropertyId = c.Int(nullable: false), |
| 30 | + TenantId = c.Int(), |
| 31 | + }, |
| 32 | + annotations: new Dictionary<string, object> |
| 33 | + { |
| 34 | + { "DynamicFilter_DynamicEntityProperty_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 35 | + }) |
| 36 | + .PrimaryKey(t => t.Id) |
| 37 | + .ForeignKey("dbo.AbpDynamicProperties", t => t.DynamicPropertyId, cascadeDelete: true) |
| 38 | + .Index(t => new { t.EntityFullName, t.DynamicPropertyId, t.TenantId }, unique: true) |
| 39 | + .Index(t => t.TenantId); |
| 40 | + |
| 41 | + CreateTable( |
| 42 | + "dbo.AbpDynamicProperties", |
| 43 | + c => new |
| 44 | + { |
| 45 | + Id = c.Int(nullable: false, identity: true), |
| 46 | + PropertyName = c.String(maxLength: 250), |
| 47 | + InputType = c.String(), |
| 48 | + Permission = c.String(), |
| 49 | + TenantId = c.Int(), |
| 50 | + }, |
| 51 | + annotations: new Dictionary<string, object> |
| 52 | + { |
| 53 | + { "DynamicFilter_DynamicProperty_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 54 | + }) |
| 55 | + .PrimaryKey(t => t.Id) |
| 56 | + .Index(t => new { t.PropertyName, t.TenantId }, unique: true) |
| 57 | + .Index(t => t.TenantId); |
| 58 | + |
| 59 | + CreateTable( |
| 60 | + "dbo.AbpDynamicPropertyValues", |
| 61 | + c => new |
| 62 | + { |
| 63 | + Id = c.Int(nullable: false, identity: true), |
| 64 | + Value = c.String(nullable: false), |
| 65 | + TenantId = c.Int(), |
| 66 | + DynamicPropertyId = c.Int(nullable: false), |
| 67 | + }, |
| 68 | + annotations: new Dictionary<string, object> |
| 69 | + { |
| 70 | + { "DynamicFilter_DynamicPropertyValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 71 | + }) |
| 72 | + .PrimaryKey(t => t.Id) |
| 73 | + .ForeignKey("dbo.AbpDynamicProperties", t => t.DynamicPropertyId, cascadeDelete: true) |
| 74 | + .Index(t => t.TenantId) |
| 75 | + .Index(t => t.DynamicPropertyId); |
| 76 | + |
| 77 | + CreateTable( |
| 78 | + "dbo.AbpDynamicEntityPropertyValues", |
| 79 | + c => new |
| 80 | + { |
| 81 | + Id = c.Int(nullable: false, identity: true), |
| 82 | + Value = c.String(nullable: false), |
| 83 | + EntityId = c.String(), |
| 84 | + DynamicEntityPropertyId = c.Int(nullable: false), |
| 85 | + TenantId = c.Int(), |
| 86 | + }, |
| 87 | + annotations: new Dictionary<string, object> |
| 88 | + { |
| 89 | + { "DynamicFilter_DynamicEntityPropertyValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 90 | + }) |
| 91 | + .PrimaryKey(t => t.Id) |
| 92 | + .ForeignKey("dbo.AbpDynamicEntityProperties", t => t.DynamicEntityPropertyId, cascadeDelete: true) |
| 93 | + .Index(t => t.DynamicEntityPropertyId) |
| 94 | + .Index(t => t.TenantId); |
| 95 | + |
| 96 | + DropTable("dbo.AbpDynamicParameters", |
| 97 | + removedAnnotations: new Dictionary<string, object> |
| 98 | + { |
| 99 | + { "DynamicFilter_DynamicParameter_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 100 | + }); |
| 101 | + DropTable("dbo.AbpDynamicParameterValues", |
| 102 | + removedAnnotations: new Dictionary<string, object> |
| 103 | + { |
| 104 | + { "DynamicFilter_DynamicParameterValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 105 | + }); |
| 106 | + DropTable("dbo.AbpEntityDynamicParameters", |
| 107 | + removedAnnotations: new Dictionary<string, object> |
| 108 | + { |
| 109 | + { "DynamicFilter_EntityDynamicParameter_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 110 | + }); |
| 111 | + DropTable("dbo.AbpEntityDynamicParameterValues", |
| 112 | + removedAnnotations: new Dictionary<string, object> |
| 113 | + { |
| 114 | + { "DynamicFilter_EntityDynamicParameterValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 115 | + }); |
| 116 | + } |
| 117 | + |
| 118 | + public override void Down() |
| 119 | + { |
| 120 | + CreateTable( |
| 121 | + "dbo.AbpEntityDynamicParameterValues", |
| 122 | + c => new |
| 123 | + { |
| 124 | + Id = c.Int(nullable: false, identity: true), |
| 125 | + Value = c.String(nullable: false), |
| 126 | + EntityId = c.String(), |
| 127 | + EntityDynamicParameterId = c.Int(nullable: false), |
| 128 | + TenantId = c.Int(), |
| 129 | + }, |
| 130 | + annotations: new Dictionary<string, object> |
| 131 | + { |
| 132 | + { "DynamicFilter_EntityDynamicParameterValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 133 | + }) |
| 134 | + .PrimaryKey(t => t.Id); |
| 135 | + |
| 136 | + CreateTable( |
| 137 | + "dbo.AbpEntityDynamicParameters", |
| 138 | + c => new |
| 139 | + { |
| 140 | + Id = c.Int(nullable: false, identity: true), |
| 141 | + EntityFullName = c.String(maxLength: 250), |
| 142 | + DynamicParameterId = c.Int(nullable: false), |
| 143 | + TenantId = c.Int(), |
| 144 | + }, |
| 145 | + annotations: new Dictionary<string, object> |
| 146 | + { |
| 147 | + { "DynamicFilter_EntityDynamicParameter_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 148 | + }) |
| 149 | + .PrimaryKey(t => t.Id); |
| 150 | + |
| 151 | + CreateTable( |
| 152 | + "dbo.AbpDynamicParameterValues", |
| 153 | + c => new |
| 154 | + { |
| 155 | + Id = c.Int(nullable: false, identity: true), |
| 156 | + Value = c.String(nullable: false), |
| 157 | + TenantId = c.Int(), |
| 158 | + DynamicParameterId = c.Int(nullable: false), |
| 159 | + }, |
| 160 | + annotations: new Dictionary<string, object> |
| 161 | + { |
| 162 | + { "DynamicFilter_DynamicParameterValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 163 | + }) |
| 164 | + .PrimaryKey(t => t.Id); |
| 165 | + |
| 166 | + CreateTable( |
| 167 | + "dbo.AbpDynamicParameters", |
| 168 | + c => new |
| 169 | + { |
| 170 | + Id = c.Int(nullable: false, identity: true), |
| 171 | + ParameterName = c.String(maxLength: 250), |
| 172 | + InputType = c.String(), |
| 173 | + Permission = c.String(), |
| 174 | + TenantId = c.Int(), |
| 175 | + }, |
| 176 | + annotations: new Dictionary<string, object> |
| 177 | + { |
| 178 | + { "DynamicFilter_DynamicParameter_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 179 | + }) |
| 180 | + .PrimaryKey(t => t.Id); |
| 181 | + |
| 182 | + DropForeignKey("dbo.AbpDynamicEntityPropertyValues", "DynamicEntityPropertyId", "dbo.AbpDynamicEntityProperties"); |
| 183 | + DropForeignKey("dbo.AbpDynamicEntityProperties", "DynamicPropertyId", "dbo.AbpDynamicProperties"); |
| 184 | + DropForeignKey("dbo.AbpDynamicPropertyValues", "DynamicPropertyId", "dbo.AbpDynamicProperties"); |
| 185 | + DropIndex("dbo.AbpDynamicEntityPropertyValues", new[] { "TenantId" }); |
| 186 | + DropIndex("dbo.AbpDynamicEntityPropertyValues", new[] { "DynamicEntityPropertyId" }); |
| 187 | + DropIndex("dbo.AbpDynamicPropertyValues", new[] { "DynamicPropertyId" }); |
| 188 | + DropIndex("dbo.AbpDynamicPropertyValues", new[] { "TenantId" }); |
| 189 | + DropIndex("dbo.AbpDynamicProperties", new[] { "TenantId" }); |
| 190 | + DropIndex("dbo.AbpDynamicProperties", new[] { "PropertyName", "TenantId" }); |
| 191 | + DropIndex("dbo.AbpDynamicEntityProperties", new[] { "TenantId" }); |
| 192 | + DropIndex("dbo.AbpDynamicEntityProperties", new[] { "EntityFullName", "DynamicPropertyId", "TenantId" }); |
| 193 | + DropTable("dbo.AbpDynamicEntityPropertyValues", |
| 194 | + removedAnnotations: new Dictionary<string, object> |
| 195 | + { |
| 196 | + { "DynamicFilter_DynamicEntityPropertyValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 197 | + }); |
| 198 | + DropTable("dbo.AbpDynamicPropertyValues", |
| 199 | + removedAnnotations: new Dictionary<string, object> |
| 200 | + { |
| 201 | + { "DynamicFilter_DynamicPropertyValue_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 202 | + }); |
| 203 | + DropTable("dbo.AbpDynamicProperties", |
| 204 | + removedAnnotations: new Dictionary<string, object> |
| 205 | + { |
| 206 | + { "DynamicFilter_DynamicProperty_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 207 | + }); |
| 208 | + DropTable("dbo.AbpDynamicEntityProperties", |
| 209 | + removedAnnotations: new Dictionary<string, object> |
| 210 | + { |
| 211 | + { "DynamicFilter_DynamicEntityProperty_MayHaveTenant", "EntityFramework.DynamicFilters.DynamicFilterDefinition" }, |
| 212 | + }); |
| 213 | + CreateIndex("dbo.AbpEntityDynamicParameterValues", "TenantId"); |
| 214 | + CreateIndex("dbo.AbpEntityDynamicParameterValues", "EntityDynamicParameterId"); |
| 215 | + CreateIndex("dbo.AbpEntityDynamicParameters", "TenantId"); |
| 216 | + CreateIndex("dbo.AbpEntityDynamicParameters", new[] { "EntityFullName", "DynamicParameterId", "TenantId" }, unique: true); |
| 217 | + CreateIndex("dbo.AbpDynamicParameterValues", "DynamicParameterId"); |
| 218 | + CreateIndex("dbo.AbpDynamicParameterValues", "TenantId"); |
| 219 | + CreateIndex("dbo.AbpDynamicParameters", "TenantId"); |
| 220 | + CreateIndex("dbo.AbpDynamicParameters", new[] { "ParameterName", "TenantId" }, unique: true); |
| 221 | + AddForeignKey("dbo.AbpEntityDynamicParameterValues", "EntityDynamicParameterId", "dbo.AbpEntityDynamicParameters", "Id", cascadeDelete: true); |
| 222 | + AddForeignKey("dbo.AbpEntityDynamicParameters", "DynamicParameterId", "dbo.AbpDynamicParameters", "Id", cascadeDelete: true); |
| 223 | + AddForeignKey("dbo.AbpDynamicParameterValues", "DynamicParameterId", "dbo.AbpDynamicParameters", "Id", cascadeDelete: true); |
| 224 | + } |
| 225 | + } |
| 226 | +} |
0 commit comments