1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

[AC-1943] Add ProviderInvoiceItem table (#4163)

* Add ProviderInvoiceItem table

* Run dotnet format
This commit is contained in:
Alex Morask
2024-06-06 13:25:13 -04:00
committed by GitHub
parent fef34d845f
commit 725fc2eed3
28 changed files with 8765 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
/// <inheritdoc />
public partial class ProviderInvoiceItem : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ProviderInvoiceItem",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
ProviderId = table.Column<Guid>(type: "uuid", nullable: false),
InvoiceId = table.Column<string>(type: "text", nullable: true),
InvoiceNumber = table.Column<string>(type: "text", nullable: true),
ClientName = table.Column<string>(type: "text", nullable: true),
PlanName = table.Column<string>(type: "text", nullable: true),
AssignedSeats = table.Column<int>(type: "integer", nullable: false),
UsedSeats = table.Column<int>(type: "integer", nullable: false),
Total = table.Column<decimal>(type: "numeric", nullable: false),
Created = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProviderInvoiceItem", x => x.Id);
table.ForeignKey(
name: "FK_ProviderInvoiceItem_Provider_ProviderId",
column: x => x.ProviderId,
principalTable: "Provider",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ProviderInvoiceItem_Id_InvoiceId",
table: "ProviderInvoiceItem",
columns: new[] { "Id", "InvoiceId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ProviderInvoiceItem_ProviderId",
table: "ProviderInvoiceItem",
column: "ProviderId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProviderInvoiceItem");
}
}

View File

@ -687,6 +687,48 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("WebAuthnCredential", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderInvoiceItem", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<int>("AssignedSeats")
.HasColumnType("integer");
b.Property<string>("ClientName")
.HasColumnType("text");
b.Property<DateTime>("Created")
.HasColumnType("timestamp with time zone");
b.Property<string>("InvoiceId")
.HasColumnType("text");
b.Property<string>("InvoiceNumber")
.HasColumnType("text");
b.Property<string>("PlanName")
.HasColumnType("text");
b.Property<Guid>("ProviderId")
.HasColumnType("uuid");
b.Property<decimal>("Total")
.HasColumnType("numeric");
b.Property<int>("UsedSeats")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProviderId");
b.HasIndex("Id", "InvoiceId")
.IsUnique();
b.ToTable("ProviderInvoiceItem", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan", b =>
{
b.Property<Guid>("Id")
@ -2066,6 +2108,17 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderInvoiceItem", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Provider");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider", "Provider")