105 lines
3.7 KiB
C#
105 lines
3.7 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ManagerService.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddStatsHistoryToSubscriptionPlan : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AddColumn<bool>(
|
|
name: "HasAdvancedStats",
|
|
table: "SubscriptionPlans",
|
|
type: "boolean",
|
|
nullable: false,
|
|
defaultValue: false);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "StatsHistoryDays",
|
|
table: "SubscriptionPlans",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0);
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "AppVersion",
|
|
table: "Devices",
|
|
type: "text",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "LastSeen",
|
|
table: "Devices",
|
|
type: "timestamp with time zone",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "AuditLogs",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<string>(type: "text", nullable: false),
|
|
EntityType = table.Column<string>(type: "text", nullable: true),
|
|
EntityId = table.Column<string>(type: "text", nullable: true),
|
|
Action = table.Column<string>(type: "text", nullable: true),
|
|
UserId = table.Column<string>(type: "text", nullable: true),
|
|
InstanceId = table.Column<string>(type: "text", nullable: true),
|
|
Timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
|
OldValues = table.Column<string>(type: "text", nullable: true),
|
|
NewValues = table.Column<string>(type: "text", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_AuditLogs", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-premium",
|
|
columns: new[] { "HasAdvancedStats", "StatsHistoryDays" },
|
|
values: new object[] { false, 30 });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-standard",
|
|
columns: new[] { "HasAdvancedStats", "StatsHistoryDays" },
|
|
values: new object[] { false, 30 });
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "SubscriptionPlans",
|
|
keyColumn: "Id",
|
|
keyValue: "plan-starter",
|
|
columns: new[] { "HasAdvancedStats", "StatsHistoryDays" },
|
|
values: new object[] { false, 30 });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "AuditLogs");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "HasAdvancedStats",
|
|
table: "SubscriptionPlans");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "StatsHistoryDays",
|
|
table: "SubscriptionPlans");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AppVersion",
|
|
table: "Devices");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LastSeen",
|
|
table: "Devices");
|
|
}
|
|
}
|
|
}
|