|
| 1 | +namespace NuGetGallery.Migrations |
| 2 | +{ |
| 3 | + using System; |
| 4 | + using System.Data.Entity.Migrations; |
| 5 | + |
| 6 | + public partial class AddPackageRename : DbMigration |
| 7 | + { |
| 8 | + public override void Up() |
| 9 | + { |
| 10 | + CreateTable( |
| 11 | + "dbo.PackageRenames", |
| 12 | + c => new |
| 13 | + { |
| 14 | + Key = c.Int(nullable: false, identity: true), |
| 15 | + FromPackageRegistrationKey = c.Int(nullable: false), |
| 16 | + ToPackageRegistrationKey = c.Int(nullable: false), |
| 17 | + TransferPopularity = c.Boolean(nullable: false), |
| 18 | + UpdatedOn = c.DateTime(nullable: false, defaultValueSql: "GETUTCDATE()"), |
| 19 | + }) |
| 20 | + .PrimaryKey(t => t.Key) |
| 21 | + .ForeignKey("dbo.PackageRegistrations", t => t.FromPackageRegistrationKey, cascadeDelete: true) |
| 22 | + .ForeignKey("dbo.PackageRegistrations", t => t.ToPackageRegistrationKey) |
| 23 | + .Index(t => new { t.FromPackageRegistrationKey, t.ToPackageRegistrationKey }, unique: true) |
| 24 | + .Index(t => t.TransferPopularity); |
| 25 | + |
| 26 | + AddColumn("dbo.PackageRegistrations", "RenamedMessage", c => c.String()); |
| 27 | + } |
| 28 | + |
| 29 | + public override void Down() |
| 30 | + { |
| 31 | + DropForeignKey("dbo.PackageRenames", "ToPackageRegistrationKey", "dbo.PackageRegistrations"); |
| 32 | + DropForeignKey("dbo.PackageRenames", "FromPackageRegistrationKey", "dbo.PackageRegistrations"); |
| 33 | + DropIndex("dbo.PackageRenames", new[] { "TransferPopularity" }); |
| 34 | + DropIndex("dbo.PackageRenames", new[] { "FromPackageRegistrationKey", "ToPackageRegistrationKey" }); |
| 35 | + DropColumn("dbo.PackageRegistrations", "RenamedMessage"); |
| 36 | + DropTable("dbo.PackageRenames"); |
| 37 | + } |
| 38 | + } |
| 39 | +} |
0 commit comments