using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.PostgresMigrations.Migrations;
///
public partial class AddSubscriptionDiscountTable : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SubscriptionDiscount",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
StripeCouponId = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
StripeProductIds = table.Column(type: "text", nullable: true),
PercentOff = table.Column(type: "numeric(5,2)", nullable: true),
AmountOff = table.Column(type: "bigint", nullable: true),
Currency = table.Column(type: "character varying(10)", maxLength: 10, nullable: true),
Duration = table.Column(type: "character varying(20)", maxLength: 20, nullable: false),
DurationInMonths = table.Column(type: "integer", nullable: true),
Name = table.Column(type: "character varying(100)", maxLength: 100, nullable: true),
StartDate = table.Column(type: "timestamp with time zone", nullable: false),
EndDate = table.Column(type: "timestamp with time zone", nullable: false),
AudienceType = table.Column(type: "integer", nullable: false, defaultValue: 0),
CreationDate = table.Column(type: "timestamp with time zone", nullable: false),
RevisionDate = table.Column(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);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SubscriptionDiscount");
}
}