120 lines
3.7 KiB
C#
120 lines
3.7 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ManagerService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddQuotaFieldsToInstance : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "HasStats",
|
|
table: "SubscriptionPlans",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "AiRequestsPerMonth",
|
|
table: "Instances",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "HasAdvancedStats",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "HasStats",
|
|
table: "Instances",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "StatsHistoryDays",
|
|
table: "Instances",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<long>(
|
|
name: "StorageQuotaBytes",
|
|
table: "Instances",
|
|
type: "bigint",
|
|
nullable: false,
|
|
defaultValue: 0L);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-premium",
|
|
columns: new[] { "AiRequestsPerMonth", "HasStats" },
|
|
values: new object[] { 2000, true });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-standard",
|
|
columns: new[] { "AiRequestsPerMonth", "HasStats" },
|
|
values: new object[] { 500, true });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-starter",
|
|
column: "HasStats",
|
|
value: false);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "HasStats",
|
|
table: "SubscriptionPlans");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AiRequestsPerMonth",
|
|
table: "Instances");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "HasAdvancedStats",
|
|
table: "Instances");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "HasStats",
|
|
table: "Instances");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "StatsHistoryDays",
|
|
table: "Instances");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "StorageQuotaBytes",
|
|
table: "Instances");
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-premium",
|
|
column: "AiRequestsPerMonth",
|
|
value: 500);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-standard",
|
|
column: "AiRequestsPerMonth",
|
|
value: 100);
|
|
}
|
|
}
|
|
}
|