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

[AC-1900] Update Vault DB to support provider billing (#3875)

* Add Gateway columns to Provider table

* Add ProviderId column to Transaction table

* Create ProviderPlan table

* Matt's feedback

* Rui's feedback

* Fixed Gateway parameter on Provider
This commit is contained in:
Alex Morask
2024-03-21 11:15:49 -04:00
committed by GitHub
parent 43ee5a24ec
commit 9f7e05869e
44 changed files with 9139 additions and 45 deletions

View File

@ -18,7 +18,7 @@ namespace Bit.PostgresMigrations.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Npgsql:CollationDefinition:postgresIndetermanisticCollation", "en-u-ks-primary,en-u-ks-primary,icu,False")
.HasAnnotation("ProductVersion", "7.0.15")
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@ -282,6 +282,15 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<bool>("Enabled")
.HasColumnType("boolean");
b.Property<string>("GatewayCustomerId")
.HasColumnType("text");
b.Property<string>("GatewaySubscriptionId")
.HasColumnType("text");
b.Property<byte?>("GatewayType")
.HasColumnType("smallint");
b.Property<string>("Name")
.HasColumnType("text");
@ -678,6 +687,36 @@ namespace Bit.PostgresMigrations.Migrations
b.ToTable("WebAuthnCredential", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uuid");
b.Property<int?>("AllocatedSeats")
.HasColumnType("integer");
b.Property<byte>("PlanType")
.HasColumnType("smallint");
b.Property<Guid>("ProviderId")
.HasColumnType("uuid");
b.Property<int?>("PurchasedSeats")
.HasColumnType("integer");
b.Property<int?>("SeatMinimum")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("ProviderId");
b.HasIndex("Id", "PlanType")
.IsUnique();
b.ToTable("ProviderPlan", (string)null);
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Models.Collection", b =>
{
b.Property<Guid>("Id")
@ -1286,6 +1325,9 @@ namespace Bit.PostgresMigrations.Migrations
b.Property<byte?>("PaymentMethodType")
.HasColumnType("smallint");
b.Property<Guid?>("ProviderId")
.HasColumnType("uuid");
b.Property<bool?>("Refunded")
.HasColumnType("boolean");
@ -1302,6 +1344,8 @@ namespace Bit.PostgresMigrations.Migrations
b.HasIndex("OrganizationId");
b.HasIndex("ProviderId");
b.HasIndex("UserId")
.HasAnnotation("SqlServer:Clustered", false);
@ -2022,6 +2066,17 @@ namespace Bit.PostgresMigrations.Migrations
b.Navigation("User");
});
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.Billing.Models.ProviderPlan", 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.Models.Collection", b =>
{
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", "Organization")
@ -2217,12 +2272,18 @@ namespace Bit.PostgresMigrations.Migrations
.WithMany("Transactions")
.HasForeignKey("OrganizationId");
b.HasOne("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Provider.Provider", "Provider")
.WithMany()
.HasForeignKey("ProviderId");
b.HasOne("Bit.Infrastructure.EntityFramework.Models.User", "User")
.WithMany("Transactions")
.HasForeignKey("UserId");
b.Navigation("Organization");
b.Navigation("Provider");
b.Navigation("User");
});