mirror of
https://github.com/bitwarden/server.git
synced 2026-02-04 02:05:30 -06:00
62 lines
2.8 KiB
C#
62 lines
2.8 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace Bit.MySqlMigrations.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: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
StripeCouponId = table.Column<string>(type: "varchar(50)", maxLength: 50, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
StripeProductIds = table.Column<string>(type: "longtext", nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PercentOff = table.Column<decimal>(type: "decimal(65,30)", nullable: true),
|
|
AmountOff = table.Column<long>(type: "bigint", nullable: true),
|
|
Currency = table.Column<string>(type: "varchar(10)", maxLength: 10, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Duration = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: false)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DurationInMonths = table.Column<int>(type: "int", nullable: true),
|
|
Name = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true)
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
StartDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
EndDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
AudienceType = table.Column<int>(type: "int", nullable: false),
|
|
CreationDate = table.Column<DateTime>(type: "datetime(6)", nullable: false),
|
|
RevisionDate = table.Column<DateTime>(type: "datetime(6)", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_SubscriptionDiscount", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
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");
|
|
}
|
|
}
|