mirror of
https://github.com/bitwarden/server.git
synced 2024-11-22 12:15:36 +01:00
Remove Unused Auto Properties (#2580)
* Correct Auto Navigation Property * Add Needed Migration
This commit is contained in:
parent
504395a4e1
commit
c6e2db1ff5
@ -7,6 +7,7 @@ public class OrganizationUser : Core.Entities.OrganizationUser
|
||||
public virtual Organization Organization { get; set; }
|
||||
public virtual User User { get; set; }
|
||||
public virtual ICollection<CollectionUser> CollectionUsers { get; set; }
|
||||
public virtual ICollection<GroupUser> GroupUsers { get; set; }
|
||||
}
|
||||
|
||||
public class OrganizationUserMapperProfile : Profile
|
||||
|
@ -6,8 +6,6 @@ public class User : Core.Entities.User
|
||||
{
|
||||
public virtual ICollection<Cipher> Ciphers { get; set; }
|
||||
public virtual ICollection<Folder> Folders { get; set; }
|
||||
public virtual ICollection<CollectionUser> CollectionUsers { get; set; }
|
||||
public virtual ICollection<GroupUser> GroupUsers { get; set; }
|
||||
public virtual ICollection<OrganizationUser> OrganizationUsers { get; set; }
|
||||
public virtual ICollection<SsoUser> SsoUsers { get; set; }
|
||||
public virtual ICollection<Transaction> Transactions { get; set; }
|
||||
|
2098
util/MySqlMigrations/Migrations/20230113175447_Fix Navigation Properties.Designer.cs
generated
Normal file
2098
util/MySqlMigrations/Migrations/20230113175447_Fix Navigation Properties.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,76 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.MySqlMigrations.Migrations;
|
||||
|
||||
public partial class FixNavigationProperties : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "GroupUser",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers",
|
||||
type: "char(36)",
|
||||
nullable: true,
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
@ -280,15 +280,10 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<bool>("ReadOnly")
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("CollectionId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("CollectionUsers");
|
||||
});
|
||||
|
||||
@ -546,15 +541,10 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
b.Property<Guid>("OrganizationUserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.HasKey("GroupId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("GroupUser", (string)null);
|
||||
});
|
||||
|
||||
@ -1676,10 +1666,6 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("CollectionUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Collection");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -1744,15 +1730,11 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
|
||||
.WithMany()
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("OrganizationUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Group");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -2083,6 +2065,8 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
|
||||
{
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
@ -2098,12 +2082,8 @@ namespace Bit.MySqlMigrations.Migrations
|
||||
{
|
||||
b.Navigation("Ciphers");
|
||||
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("Folders");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
|
||||
b.Navigation("OrganizationUsers");
|
||||
|
||||
b.Navigation("SsoUsers");
|
||||
|
2109
util/PostgresMigrations/Migrations/20230113175441_Fix Navigation Properties.Designer.cs
generated
Normal file
2109
util/PostgresMigrations/Migrations/20230113175441_Fix Navigation Properties.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,74 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.PostgresMigrations.Migrations;
|
||||
|
||||
public partial class FixNavigationProperties : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "GroupUser",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers",
|
||||
type: "uuid",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
@ -284,15 +284,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<bool>("ReadOnly")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("CollectionId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("CollectionUsers");
|
||||
});
|
||||
|
||||
@ -550,15 +545,10 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
b.Property<Guid>("OrganizationUserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("GroupId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("GroupUser", (string)null);
|
||||
});
|
||||
|
||||
@ -1687,10 +1677,6 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("CollectionUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Collection");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -1755,15 +1741,11 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
|
||||
.WithMany()
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("OrganizationUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Group");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -2094,6 +2076,8 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
|
||||
{
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
@ -2109,12 +2093,8 @@ namespace Bit.PostgresMigrations.Migrations
|
||||
{
|
||||
b.Navigation("Ciphers");
|
||||
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("Folders");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
|
||||
b.Navigation("OrganizationUsers");
|
||||
|
||||
b.Navigation("SsoUsers");
|
||||
|
2096
util/SqliteMigrations/Migrations/20230113175436_Fix Navigation Properties.Designer.cs
generated
Normal file
2096
util/SqliteMigrations/Migrations/20230113175436_Fix Navigation Properties.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,74 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Bit.SqliteMigrations.Migrations;
|
||||
|
||||
public partial class FixNavigationProperties : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "GroupUser");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "GroupUser",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "UserId",
|
||||
table: "CollectionUsers",
|
||||
type: "TEXT",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_GroupUser_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CollectionUsers_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CollectionUsers_User_UserId",
|
||||
table: "CollectionUsers",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_GroupUser_User_UserId",
|
||||
table: "GroupUser",
|
||||
column: "UserId",
|
||||
principalTable: "User",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
@ -278,15 +278,10 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
b.Property<bool>("ReadOnly")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("CollectionId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("CollectionUsers");
|
||||
});
|
||||
|
||||
@ -544,15 +539,10 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
b.Property<Guid>("OrganizationUserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<Guid?>("UserId")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("GroupId", "OrganizationUserId");
|
||||
|
||||
b.HasIndex("OrganizationUserId");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("GroupUser", (string)null);
|
||||
});
|
||||
|
||||
@ -1674,10 +1664,6 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("CollectionUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Collection");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -1742,15 +1728,11 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", "OrganizationUser")
|
||||
.WithMany()
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("OrganizationUserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", null)
|
||||
.WithMany("GroupUsers")
|
||||
.HasForeignKey("UserId");
|
||||
|
||||
b.Navigation("Group");
|
||||
|
||||
b.Navigation("OrganizationUser");
|
||||
@ -2081,6 +2063,8 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.OrganizationUser", b =>
|
||||
{
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Project", b =>
|
||||
@ -2096,12 +2080,8 @@ namespace Bit.SqliteMigrations.Migrations
|
||||
{
|
||||
b.Navigation("Ciphers");
|
||||
|
||||
b.Navigation("CollectionUsers");
|
||||
|
||||
b.Navigation("Folders");
|
||||
|
||||
b.Navigation("GroupUsers");
|
||||
|
||||
b.Navigation("OrganizationUsers");
|
||||
|
||||
b.Navigation("SsoUsers");
|
||||
|
Loading…
Reference in New Issue
Block a user