using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CredentialManager.Migrations
{
///
public partial class AddProfileSchedules : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ProfileSchedules",
columns: table => new
{
Id = table.Column(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column(type: "TEXT", maxLength: 100, nullable: false),
Description = table.Column(type: "TEXT", maxLength: 500, nullable: true),
ProfileId = table.Column(type: "INTEGER", nullable: false),
ScheduleType = table.Column(type: "TEXT", maxLength: 50, nullable: false),
ExecuteOnce = table.Column(type: "TEXT", nullable: true),
DailyTime = table.Column(type: "TEXT", nullable: true),
WeeklyDays = table.Column(type: "TEXT", maxLength: 50, nullable: true),
MonthlyDay = table.Column(type: "INTEGER", nullable: true),
IsActive = table.Column(type: "INTEGER", nullable: false, defaultValue: true),
LastExecution = table.Column(type: "TEXT", nullable: true),
NextExecution = table.Column(type: "TEXT", nullable: true),
LastExecutionResult = table.Column(type: "TEXT", maxLength: 500, nullable: true),
LastExecutionSuccess = table.Column(type: "INTEGER", nullable: false),
ExecutionCount = table.Column(type: "INTEGER", nullable: false, defaultValue: 0),
CreatedBy = table.Column(type: "TEXT", maxLength: 100, nullable: true),
CreatedAt = table.Column(type: "TEXT", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
UpdatedAt = table.Column(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ProfileSchedules", x => x.Id);
table.ForeignKey(
name: "FK_ProfileSchedules_DataCouplerProfiles_ProfileId",
column: x => x.ProfileId,
principalTable: "DataCouplerProfiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
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_ProfileId",
table: "ProfileSchedules",
column: "ProfileId");
migrationBuilder.CreateIndex(
name: "IX_ProfileSchedules_ScheduleType",
table: "ProfileSchedules",
column: "ScheduleType");
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProfileSchedules");
}
}
}