Removed hangfire. Added TickerQ
This commit is contained in:
@@ -0,0 +1,169 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.ApiServer.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddedTickerQ : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "ticker");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CronTickers",
|
||||
schema: "ticker",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Expression = table.Column<string>(type: "text", nullable: true),
|
||||
Request = table.Column<byte[]>(type: "bytea", nullable: true),
|
||||
Retries = table.Column<int>(type: "integer", nullable: false),
|
||||
RetryIntervals = table.Column<int[]>(type: "integer[]", nullable: true),
|
||||
Function = table.Column<string>(type: "text", nullable: true),
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
InitIdentifier = table.Column<string>(type: "text", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CronTickers", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "TimeTickers",
|
||||
schema: "ticker",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
LockHolder = table.Column<string>(type: "text", nullable: true),
|
||||
Request = table.Column<byte[]>(type: "bytea", nullable: true),
|
||||
ExecutionTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
LockedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
ExecutedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Exception = table.Column<string>(type: "text", nullable: true),
|
||||
ElapsedTime = table.Column<long>(type: "bigint", nullable: false),
|
||||
Retries = table.Column<int>(type: "integer", nullable: false),
|
||||
RetryCount = table.Column<int>(type: "integer", nullable: false),
|
||||
RetryIntervals = table.Column<int[]>(type: "integer[]", nullable: true),
|
||||
BatchParent = table.Column<Guid>(type: "uuid", nullable: true),
|
||||
BatchRunCondition = table.Column<int>(type: "integer", nullable: true),
|
||||
Function = table.Column<string>(type: "text", nullable: true),
|
||||
Description = table.Column<string>(type: "text", nullable: true),
|
||||
InitIdentifier = table.Column<string>(type: "text", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
UpdatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TimeTickers", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TimeTickers_TimeTickers_BatchParent",
|
||||
column: x => x.BatchParent,
|
||||
principalSchema: "ticker",
|
||||
principalTable: "TimeTickers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CronTickerOccurrences",
|
||||
schema: "ticker",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
Status = table.Column<int>(type: "integer", nullable: false),
|
||||
LockHolder = table.Column<string>(type: "text", nullable: true),
|
||||
ExecutionTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
CronTickerId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
LockedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
ExecutedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
Exception = table.Column<string>(type: "text", nullable: true),
|
||||
ElapsedTime = table.Column<long>(type: "bigint", nullable: false),
|
||||
RetryCount = table.Column<int>(type: "integer", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CronTickerOccurrences", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CronTickerOccurrences_CronTickers_CronTickerId",
|
||||
column: x => x.CronTickerId,
|
||||
principalSchema: "ticker",
|
||||
principalTable: "CronTickers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CronTickerOccurrence_CronTickerId",
|
||||
schema: "ticker",
|
||||
table: "CronTickerOccurrences",
|
||||
column: "CronTickerId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CronTickerOccurrence_ExecutionTime",
|
||||
schema: "ticker",
|
||||
table: "CronTickerOccurrences",
|
||||
column: "ExecutionTime");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CronTickerOccurrence_Status_ExecutionTime",
|
||||
schema: "ticker",
|
||||
table: "CronTickerOccurrences",
|
||||
columns: new[] { "Status", "ExecutionTime" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "UQ_CronTickerId_ExecutionTime",
|
||||
schema: "ticker",
|
||||
table: "CronTickerOccurrences",
|
||||
columns: new[] { "CronTickerId", "ExecutionTime" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CronTickers_Expression",
|
||||
schema: "ticker",
|
||||
table: "CronTickers",
|
||||
column: "Expression");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeTicker_ExecutionTime",
|
||||
schema: "ticker",
|
||||
table: "TimeTickers",
|
||||
column: "ExecutionTime");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeTicker_Status_ExecutionTime",
|
||||
schema: "ticker",
|
||||
table: "TimeTickers",
|
||||
columns: new[] { "Status", "ExecutionTime" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeTickers_BatchParent",
|
||||
schema: "ticker",
|
||||
table: "TimeTickers",
|
||||
column: "BatchParent");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CronTickerOccurrences",
|
||||
schema: "ticker");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "TimeTickers",
|
||||
schema: "ticker");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "CronTickers",
|
||||
schema: "ticker");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user