mirror of
https://github.com/bitwarden/server.git
synced 2026-02-07 17:33:11 +08:00
* Implement the detail Subscription Discount Database Infrastructure * Change string to string list * fix lint error * Create all missing database object definition files * Regenerate EF migrations with Designer files The previous migrations were missing .Designer.cs files. This commit: - Removes the incomplete migration files - Regenerates all three provider migrations (MySQL, Postgres, SQLite) with proper Designer files - Updates DatabaseContextModelSnapshot.cs for each provider 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix failing database * Resolve the lint warnings * Resolve the database failure * Fix the build Lint * resolve the dbops reviews * Add the default value --------- Co-authored-by: Claude <noreply@anthropic.com>
56 lines
2.5 KiB
C#
56 lines
2.5 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Bit.PostgresMigrations.Migrations;
|
|
|
|
/// <inheritdoc />
|
|
public partial class AddSubscriptionDiscountTable : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: "SubscriptionDiscount",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
StripeCouponId = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
|
|
StripeProductIds = table.Column<string>(type: "text", nullable: true),
|
|
PercentOff = table.Column<decimal>(type: "numeric(5,2)", nullable: true),
|
|
AmountOff = table.Column<long>(type: "bigint", nullable: true),
|
|
Currency = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: true),
|
|
Duration = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
|
|
DurationInMonths = table.Column<int>(type: "integer", nullable: true),
|
|
Name = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: true),
|
|
StartDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
EndDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
AudienceType = table.Column<int>(type: "integer", nullable: false, defaultValue: 0),
|
|
CreationDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
RevisionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SubscriptionDiscount", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SubscriptionDiscount_DateRange",
|
|
table: "SubscriptionDiscount",
|
|
columns: new[] { "StartDate", "EndDate" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_SubscriptionDiscount_StripeCouponId",
|
|
table: "SubscriptionDiscount",
|
|
column: "StripeCouponId",
|
|
unique: true);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "SubscriptionDiscount");
|
|
}
|
|
}
|