-
Notifications
You must be signed in to change notification settings - Fork 645
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Schema for organization membership requests (#5204)
- Loading branch information
1 parent
39d8a40
commit fdd75b9
Showing
16 changed files
with
348 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// 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. | ||
|
||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public class MembershipRequest | ||
{ | ||
public int OrganizationKey { get; set; } | ||
|
||
public virtual Organization Organization { get; set; } | ||
|
||
public int NewMemberKey { get; set; } | ||
|
||
public virtual User NewMember { get; set; } | ||
|
||
public bool IsAdmin { get; set; } | ||
|
||
[Required] | ||
public string ConfirmationToken { get; set; } | ||
|
||
public DateTime RequestDate { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/NuGetGallery.Core/Entities/OrganizationMigrationRequest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// 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. | ||
|
||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
|
||
namespace NuGetGallery | ||
{ | ||
public class OrganizationMigrationRequest | ||
{ | ||
public int NewOrganizationKey { get; set; } | ||
|
||
public virtual User NewOrganization { get; set; } | ||
|
||
public int AdminUserKey { get; set; } | ||
|
||
public virtual User AdminUser { get; set; } | ||
|
||
[Required] | ||
public string ConfirmationToken { get; set; } | ||
|
||
public DateTime RequestDate { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/NuGetGallery/Migrations/201712211850074_MembershipRequests.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
src/NuGetGallery/Migrations/201712211850074_MembershipRequests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
namespace NuGetGallery.Migrations | ||
{ | ||
using System; | ||
using System.Data.Entity.Migrations; | ||
|
||
public partial class MembershipRequests : DbMigration | ||
{ | ||
public override void Up() | ||
{ | ||
CreateTable( | ||
"dbo.OrganizationMigrationRequests", | ||
c => new | ||
{ | ||
NewOrganizationKey = c.Int(nullable: false), | ||
AdminUserKey = c.Int(nullable: false), | ||
ConfirmationToken = c.String(nullable: false), | ||
RequestDate = c.DateTime(nullable: false), | ||
}) | ||
.PrimaryKey(t => t.NewOrganizationKey) | ||
.ForeignKey("dbo.Users", t => t.AdminUserKey, cascadeDelete: true) | ||
.ForeignKey("dbo.Users", t => t.NewOrganizationKey) | ||
.Index(t => t.NewOrganizationKey) | ||
.Index(t => t.AdminUserKey); | ||
|
||
CreateTable( | ||
"dbo.MembershipRequests", | ||
c => new | ||
{ | ||
OrganizationKey = c.Int(nullable: false), | ||
NewMemberKey = c.Int(nullable: false), | ||
IsAdmin = c.Boolean(nullable: false), | ||
ConfirmationToken = c.String(nullable: false), | ||
RequestDate = c.DateTime(nullable: false), | ||
}) | ||
.PrimaryKey(t => new { t.OrganizationKey, t.NewMemberKey }) | ||
.ForeignKey("dbo.Organizations", t => t.OrganizationKey) | ||
.ForeignKey("dbo.Users", t => t.NewMemberKey) | ||
.Index(t => t.OrganizationKey) | ||
.Index(t => t.NewMemberKey); | ||
|
||
AddColumn("dbo.Credentials", "TenantId", c => c.String(maxLength: 256)); | ||
} | ||
|
||
public override void Down() | ||
{ | ||
DropForeignKey("dbo.MembershipRequests", "NewMemberKey", "dbo.Users"); | ||
DropForeignKey("dbo.MembershipRequests", "OrganizationKey", "dbo.Organizations"); | ||
DropForeignKey("dbo.OrganizationMigrationRequests", "NewOrganizationKey", "dbo.Users"); | ||
DropForeignKey("dbo.OrganizationMigrationRequests", "AdminUserKey", "dbo.Users"); | ||
DropIndex("dbo.MembershipRequests", new[] { "NewMemberKey" }); | ||
DropIndex("dbo.MembershipRequests", new[] { "OrganizationKey" }); | ||
DropIndex("dbo.OrganizationMigrationRequests", new[] { "AdminUserKey" }); | ||
DropIndex("dbo.OrganizationMigrationRequests", new[] { "NewOrganizationKey" }); | ||
DropColumn("dbo.Credentials", "TenantId"); | ||
DropTable("dbo.MembershipRequests"); | ||
DropTable("dbo.OrganizationMigrationRequests"); | ||
} | ||
} | ||
} |
Oops, something went wrong.