Switched to database scheme seperation from MoonCores SingleDb. Updated mooncore versions. Updating to correct Async naming
This commit is contained in:
@@ -0,0 +1,399 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Moonlight.ApiServer.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class RecreatedMigrationsForChangeOfSchema : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.EnsureSchema(
|
||||
name: "core");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ApiKeys",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Description = table.Column<string>(type: "text", nullable: false),
|
||||
Permissions = table.Column<string[]>(type: "text[]", nullable: false),
|
||||
ExpiresAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ApiKeys", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireCounter",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Value = table.Column<long>(type: "bigint", nullable: false),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireCounter", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireHash",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Field = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireHash", x => new { x.Key, x.Field });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireList",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Key = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Position = table.Column<int>(type: "integer", nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireList", x => new { x.Key, x.Position });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireLock",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
AcquiredAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireLock", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireServer",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
StartedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Heartbeat = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
WorkerCount = table.Column<int>(type: "integer", nullable: false),
|
||||
Queues = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireServer", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireSet",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Key = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
|
||||
Value = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Score = table.Column<double>(type: "double precision", nullable: false),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireSet", x => new { x.Key, x.Value });
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Themes",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
IsEnabled = table.Column<bool>(type: "boolean", nullable: false),
|
||||
Name = table.Column<string>(type: "text", nullable: false),
|
||||
Author = table.Column<string>(type: "text", nullable: false),
|
||||
Version = table.Column<string>(type: "text", nullable: false),
|
||||
UpdateUrl = table.Column<string>(type: "text", nullable: true),
|
||||
DonateUrl = table.Column<string>(type: "text", nullable: true),
|
||||
Content = table.Column<string>(type: "jsonb", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Themes", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Users",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "integer", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
Username = table.Column<string>(type: "text", nullable: false),
|
||||
Email = table.Column<string>(type: "text", nullable: false),
|
||||
Password = table.Column<string>(type: "text", nullable: false),
|
||||
TokenValidTimestamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
Permissions = table.Column<string[]>(type: "text[]", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Users", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireJob",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
StateId = table.Column<long>(type: "bigint", nullable: true),
|
||||
StateName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
|
||||
ExpireAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
InvocationData = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireJob", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireJobParameter",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
JobId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Value = table.Column<string>(type: "text", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireJobParameter", x => new { x.JobId, x.Name });
|
||||
table.ForeignKey(
|
||||
name: "FK_HangfireJobParameter_HangfireJob_JobId",
|
||||
column: x => x.JobId,
|
||||
principalSchema: "core",
|
||||
principalTable: "HangfireJob",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireQueuedJob",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
JobId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Queue = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
FetchedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireQueuedJob", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_HangfireQueuedJob_HangfireJob_JobId",
|
||||
column: x => x.JobId,
|
||||
principalSchema: "core",
|
||||
principalTable: "HangfireJob",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "HangfireState",
|
||||
schema: "core",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
JobId = table.Column<long>(type: "bigint", nullable: false),
|
||||
Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: false),
|
||||
Reason = table.Column<string>(type: "text", nullable: true),
|
||||
CreatedAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
|
||||
Data = table.Column<string>(type: "text", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_HangfireState", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_HangfireState_HangfireJob_JobId",
|
||||
column: x => x.JobId,
|
||||
principalSchema: "core",
|
||||
principalTable: "HangfireJob",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireCounter_ExpireAt",
|
||||
schema: "core",
|
||||
table: "HangfireCounter",
|
||||
column: "ExpireAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireCounter_Key_Value",
|
||||
schema: "core",
|
||||
table: "HangfireCounter",
|
||||
columns: new[] { "Key", "Value" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireHash_ExpireAt",
|
||||
schema: "core",
|
||||
table: "HangfireHash",
|
||||
column: "ExpireAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireJob_ExpireAt",
|
||||
schema: "core",
|
||||
table: "HangfireJob",
|
||||
column: "ExpireAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireJob_StateId",
|
||||
schema: "core",
|
||||
table: "HangfireJob",
|
||||
column: "StateId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireJob_StateName",
|
||||
schema: "core",
|
||||
table: "HangfireJob",
|
||||
column: "StateName");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireList_ExpireAt",
|
||||
schema: "core",
|
||||
table: "HangfireList",
|
||||
column: "ExpireAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireQueuedJob_JobId",
|
||||
schema: "core",
|
||||
table: "HangfireQueuedJob",
|
||||
column: "JobId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireQueuedJob_Queue_FetchedAt",
|
||||
schema: "core",
|
||||
table: "HangfireQueuedJob",
|
||||
columns: new[] { "Queue", "FetchedAt" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireServer_Heartbeat",
|
||||
schema: "core",
|
||||
table: "HangfireServer",
|
||||
column: "Heartbeat");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireSet_ExpireAt",
|
||||
schema: "core",
|
||||
table: "HangfireSet",
|
||||
column: "ExpireAt");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireSet_Key_Score",
|
||||
schema: "core",
|
||||
table: "HangfireSet",
|
||||
columns: new[] { "Key", "Score" });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_HangfireState_JobId",
|
||||
schema: "core",
|
||||
table: "HangfireState",
|
||||
column: "JobId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_HangfireJob_HangfireState_StateId",
|
||||
schema: "core",
|
||||
table: "HangfireJob",
|
||||
column: "StateId",
|
||||
principalSchema: "core",
|
||||
principalTable: "HangfireState",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_HangfireJob_HangfireState_StateId",
|
||||
schema: "core",
|
||||
table: "HangfireJob");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ApiKeys",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireCounter",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireHash",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireJobParameter",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireList",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireLock",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireQueuedJob",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireServer",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireSet",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Themes",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Users",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireState",
|
||||
schema: "core");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "HangfireJob",
|
||||
schema: "core");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user