using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CredentialManager.Migrations
{
///
public partial class AddProfileSchedule : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_ProfileSchedules_IsActive",
table: "ProfileSchedules");
migrationBuilder.DropIndex(
name: "IX_ProfileSchedules_Name",
table: "ProfileSchedules");
migrationBuilder.DropIndex(
name: "IX_ProfileSchedules_NextExecution",
table: "ProfileSchedules");
migrationBuilder.DropIndex(
name: "IX_ProfileSchedules_ScheduleType",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "LastExecutionResult",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "WeeklyDays",
table: "ProfileSchedules");
migrationBuilder.RenameColumn(
name: "NextExecution",
table: "ProfileSchedules",
newName: "ScheduledDateTime");
migrationBuilder.RenameColumn(
name: "MonthlyDay",
table: "ProfileSchedules",
newName: "LastExecutionRecordCount");
migrationBuilder.RenameColumn(
name: "LastExecutionSuccess",
table: "ProfileSchedules",
newName: "IsEnabled");
migrationBuilder.RenameColumn(
name: "LastExecution",
table: "ProfileSchedules",
newName: "NextExecutionTime");
migrationBuilder.RenameColumn(
name: "ExecuteOnce",
table: "ProfileSchedules",
newName: "LastExecutionTime");
migrationBuilder.AlterColumn(
name: "IsActive",
table: "ProfileSchedules",
type: "INTEGER",
nullable: false,
oldClrType: typeof(bool),
oldType: "INTEGER",
oldDefaultValue: true);
migrationBuilder.AlterColumn(
name: "ExecutionCount",
table: "ProfileSchedules",
type: "INTEGER",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER",
oldDefaultValue: 0);
migrationBuilder.AlterColumn(
name: "CreatedAt",
table: "ProfileSchedules",
type: "TEXT",
nullable: false,
oldClrType: typeof(DateTime),
oldType: "TEXT",
oldDefaultValueSql: "CURRENT_TIMESTAMP");
migrationBuilder.AddColumn(
name: "DayOfMonth",
table: "ProfileSchedules",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn(
name: "DayOfWeek",
table: "ProfileSchedules",
type: "INTEGER",
nullable: true);
migrationBuilder.AddColumn(
name: "LastExecutionMessage",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 1000,
nullable: true);
migrationBuilder.AddColumn(
name: "LastExecutionStatus",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 20,
nullable: false,
defaultValue: "");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "DayOfMonth",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "DayOfWeek",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "LastExecutionMessage",
table: "ProfileSchedules");
migrationBuilder.DropColumn(
name: "LastExecutionStatus",
table: "ProfileSchedules");
migrationBuilder.RenameColumn(
name: "ScheduledDateTime",
table: "ProfileSchedules",
newName: "NextExecution");
migrationBuilder.RenameColumn(
name: "NextExecutionTime",
table: "ProfileSchedules",
newName: "LastExecution");
migrationBuilder.RenameColumn(
name: "LastExecutionTime",
table: "ProfileSchedules",
newName: "ExecuteOnce");
migrationBuilder.RenameColumn(
name: "LastExecutionRecordCount",
table: "ProfileSchedules",
newName: "MonthlyDay");
migrationBuilder.RenameColumn(
name: "IsEnabled",
table: "ProfileSchedules",
newName: "LastExecutionSuccess");
migrationBuilder.AlterColumn(
name: "IsActive",
table: "ProfileSchedules",
type: "INTEGER",
nullable: false,
defaultValue: true,
oldClrType: typeof(bool),
oldType: "INTEGER");
migrationBuilder.AlterColumn(
name: "ExecutionCount",
table: "ProfileSchedules",
type: "INTEGER",
nullable: false,
defaultValue: 0,
oldClrType: typeof(int),
oldType: "INTEGER");
migrationBuilder.AlterColumn(
name: "CreatedAt",
table: "ProfileSchedules",
type: "TEXT",
nullable: false,
defaultValueSql: "CURRENT_TIMESTAMP",
oldClrType: typeof(DateTime),
oldType: "TEXT");
migrationBuilder.AddColumn(
name: "LastExecutionResult",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 500,
nullable: true);
migrationBuilder.AddColumn(
name: "WeeklyDays",
table: "ProfileSchedules",
type: "TEXT",
maxLength: 50,
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_IsActive",
table: "ProfileSchedules",
column: "IsActive");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_Name",
table: "ProfileSchedules",
column: "Name",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_NextExecution",
table: "ProfileSchedules",
column: "NextExecution");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_ScheduleType",
table: "ProfileSchedules",
column: "ScheduleType");
}
}
}