Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SecurityPolicies migration fix #3869

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/NuGetGallery.Core/Entities/UserSecurityPolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public UserSecurityPolicy(string name)
/// Type name for the policy handler that provides policy behavior.
/// </summary>
[Required]
[MaxLength(256)]
public string Name { get; set; }

/// <summary>
Expand Down
30 changes: 17 additions & 13 deletions src/NuGetGallery/Migrations/201704211454424_SecurityPolicies.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,32 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

namespace NuGetGallery.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class SecurityPolicies : DbMigration
{
public override void Up()
{
CreateTable("UserSecurityPolicies", c => new
{
Key = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 256),
UserKey = c.Int(nullable: false),
Value = c.String(nullable: true, maxLength: 256)
})
.PrimaryKey(t => t.Key)
.ForeignKey("Users", t => t.UserKey);
CreateTable(
"dbo.UserSecurityPolicies",
c => new
{
Key = c.Int(nullable: false, identity: true),
UserKey = c.Int(nullable: false),
Name = c.String(nullable: false, maxLength: 256),
Value = c.String(),
})
.PrimaryKey(t => t.Key)
.ForeignKey("dbo.Users", t => t.UserKey, cascadeDelete: true)
.Index(t => t.UserKey);

}

public override void Down()
{
DropTable("UserSecurityPolicies");
DropForeignKey("dbo.UserSecurityPolicies", "UserKey", "dbo.Users");
DropIndex("dbo.UserSecurityPolicies", new[] { "UserKey" });
DropTable("dbo.UserSecurityPolicies");
}
}
}
Loading