1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

[Provider] Add support for events (#1447)

This commit is contained in:
Oscar Hinton
2021-07-15 16:37:27 +02:00
committed by GitHub
parent 8ac2dc50af
commit f6ebb20847
74 changed files with 4007 additions and 635 deletions

View File

@ -0,0 +1,76 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Bit.PostgresMigrations.Migrations
{
public partial class RemoveProviderOrganizationProviderUser : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProviderOrganizationProviderUser");
migrationBuilder.AddColumn<Guid>(
name: "ProviderId",
table: "Event",
type: "uuid",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ProviderUserId",
table: "Event",
type: "uuid",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "ProviderId",
table: "Event");
migrationBuilder.DropColumn(
name: "ProviderUserId",
table: "Event");
migrationBuilder.CreateTable(
name: "ProviderOrganizationProviderUser",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Permissions = table.Column<string>(type: "text", nullable: true),
ProviderOrganizationId = table.Column<Guid>(type: "uuid", nullable: false),
ProviderUserId = table.Column<Guid>(type: "uuid", nullable: false),
RevisionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
Type = table.Column<byte>(type: "smallint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderOrganizationProviderUser", x => x.Id);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderOrganization_Provi~",
column: x => x.ProviderOrganizationId,
principalTable: "ProviderOrganization",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_ProviderOrganizationProviderUser_ProviderUser_ProviderUserId",
column: x => x.ProviderUserId,
principalTable: "ProviderUser",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderOrganizationId",
table: "ProviderOrganizationProviderUser",
column: "ProviderOrganizationId");
migrationBuilder.CreateIndex(
name: "IX_ProviderOrganizationProviderUser_ProviderUserId",
table: "ProviderOrganizationProviderUser",
column: "ProviderUserId");
}
}
}

View File

@ -278,6 +278,12 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<Guid?>("PolicyId")
.HasColumnType("uuid");
b.Property<Guid?>("ProviderId")
.HasColumnType("uuid");
b.Property<Guid?>("ProviderUserId")
.HasColumnType("uuid");
b.Property<int>("Type")
.HasColumnType("integer");
@ -737,38 +743,6 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("ProviderOrganization");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganizationProviderUser", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<DateTime>("CreationDate")
.HasColumnType("timestamp without time zone");
b.Property<string>("Permissions")
.HasColumnType("text");
b.Property<Guid>("ProviderOrganizationId")
.HasColumnType("uuid");
b.Property<Guid>("ProviderUserId")
.HasColumnType("uuid");
b.Property<DateTime>("RevisionDate")
.HasColumnType("timestamp without time zone");
b.Property<byte>("Type")
.HasColumnType("smallint");
b.HasKey("Id");
b.HasIndex("ProviderOrganizationId");
b.HasIndex("ProviderUserId");
b.ToTable("ProviderOrganizationProviderUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
{
b.Property<Guid>("Id")
@ -1362,25 +1336,6 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("Provider");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderOrganizationProviderUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Provider.ProviderOrganization", "ProviderOrganization")
.WithMany()
.HasForeignKey("ProviderOrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Bit.Core.Models.EntityFramework.Provider.ProviderUser", "ProviderUser")
.WithMany()
.HasForeignKey("ProviderUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ProviderOrganization");
b.Navigation("ProviderUser");
});
modelBuilder.Entity("Bit.Core.Models.EntityFramework.Provider.ProviderUser", b =>
{
b.HasOne("Bit.Core.Models.EntityFramework.Provider.Provider", "Provider")