1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-24 17:17:40 +01:00
bitwarden-server/util/SqliteMigrations/Migrations/20230113175436_Fix Navigation Properties.cs
Justin Baur c6e2db1ff5
Remove Unused Auto Properties (#2580)
* Correct Auto Navigation Property

* Add Needed Migration
2023-01-13 14:24:58 -05:00

75 lines
2.0 KiB
C#

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");
}
}