mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 00:50:45 +01:00
FINALLY figure out the cascading delete issue
This commit is contained in:
@@ -257,17 +257,25 @@ namespace Tgstation.Server.Host.Database
|
||||
|
||||
modelBuilder.Entity<InstanceUser>().HasIndex(x => new { x.UserId, x.InstanceId }).IsUnique();
|
||||
|
||||
modelBuilder.Entity<TestMerge>().HasMany(x => x.RevisonInformations).WithOne(x => x.TestMerge).OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
var revInfo = modelBuilder.Entity<RevisionInformation>();
|
||||
revInfo.HasMany(x => x.CompileJobs).WithOne(x => x.RevisionInformation).OnDelete(DeleteBehavior.Cascade);
|
||||
revInfo.HasMany(x => x.ActiveTestMerges).WithOne(x => x.RevisionInformation).OnDelete(DeleteBehavior.Cascade);
|
||||
revInfo.HasOne(x => x.PrimaryTestMerge).WithOne(x => x.PrimaryRevisionInformation).OnDelete(DeleteBehavior.Restrict);
|
||||
revInfo.HasOne(x => x.PrimaryTestMerge).WithOne(x => x.PrimaryRevisionInformation).OnDelete(DeleteBehavior.Cascade);
|
||||
revInfo.HasIndex(x => new { x.InstanceId, x.CommitSha }).IsUnique();
|
||||
|
||||
modelBuilder.Entity<CompileJob>().HasIndex(x => x.DirectoryName);
|
||||
// IMPORTANT: When an instance is deleted (detached) it cascades into the maze of revinfo/testmerge/ritm/compilejob/job/ri relations
|
||||
// This maze starts at revInfo and jobs
|
||||
// jobs takes care of deleting compile jobs and ris
|
||||
// rev info takes care of the rest
|
||||
// Break the link here so the db doesn't shit itself complaining about cascading deletes
|
||||
// EF will handle making the right query to destroy everything
|
||||
revInfo.HasMany(x => x.CompileJobs).WithOne(x => x.RevisionInformation).OnDelete(DeleteBehavior.ClientNoAction);
|
||||
|
||||
modelBuilder.Entity<Job>().HasOne<CompileJob>().WithOne(x => x.Job).OnDelete(DeleteBehavior.Restrict);
|
||||
// Also break the link between ritm and testmerge so it doesn't cycle in a triangle with rev info
|
||||
modelBuilder.Entity<TestMerge>().HasMany(x => x.RevisonInformations).WithOne(x => x.TestMerge).OnDelete(DeleteBehavior.ClientNoAction);
|
||||
|
||||
var compileJob = modelBuilder.Entity<CompileJob>();
|
||||
compileJob.HasIndex(x => x.DirectoryName);
|
||||
compileJob.HasOne(x => x.Job).WithOne().OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
var chatChannel = modelBuilder.Entity<ChatChannel>();
|
||||
chatChannel.HasIndex(x => new { x.ChatSettingsId, x.IrcChannel }).IsUnique();
|
||||
@@ -305,7 +313,7 @@ namespace Tgstation.Server.Host.Database
|
||||
if (wasEmpty || (await Database.GetPendingMigrationsAsync(cancellationToken).ConfigureAwait(false)).Any())
|
||||
{
|
||||
Logger.LogInformation("Migrating database...");
|
||||
await Database.MigrateAsync(cancellationToken).ConfigureAwait(false);
|
||||
await Database.EnsureCreatedAsync(cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
Logger.LogDebug("No migrations to apply.");
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the <see cref="Api.Models.Internal.Job.ErrorCode"/> column for SQLite.
|
||||
/// </summary>
|
||||
public partial class SLAddJobErrorCodes : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.AddColumn<uint>(
|
||||
name: "ErrorCode",
|
||||
table: "Jobs",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ErrorCode",
|
||||
table: "Jobs");
|
||||
}
|
||||
}
|
||||
}
|
||||
Generated
+830
@@ -0,0 +1,830 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(SqlServerDatabaseContext))]
|
||||
[Migration("20200427173852_MSFixCascadingDelete")]
|
||||
partial class MSFixCascadingDelete
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("ChannelLimit")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("ConnectionString")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("Enabled")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(100)")
|
||||
.HasMaxLength(100);
|
||||
|
||||
b.Property<int>("Provider")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("ReconnectionInterval")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId", "Name")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("ChatBots");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<long>("ChatSettingsId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal?>("DiscordChannelId")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<string>("IrcChannel")
|
||||
.HasColumnType("nvarchar(100)")
|
||||
.HasMaxLength(100);
|
||||
|
||||
b.Property<bool?>("IsAdminChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("IsUpdatesChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("IsWatchdogChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Tag")
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ChatSettingsId", "DiscordChannelId")
|
||||
.IsUnique()
|
||||
.HasFilter("[DiscordChannelId] IS NOT NULL");
|
||||
|
||||
b.HasIndex("ChatSettingsId", "IrcChannel")
|
||||
.IsUnique()
|
||||
.HasFilter("[IrcChannel] IS NOT NULL");
|
||||
|
||||
b.ToTable("ChatChannels");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("ByondVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int?>("DMApiMajorVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DMApiMinorVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DMApiPatchVersion")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("DirectoryName")
|
||||
.IsRequired()
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("DmeName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long>("JobId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("MinimumSecurityLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Output")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long>("RevisionInformationId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("DirectoryName");
|
||||
|
||||
b.HasIndex("JobId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("RevisionInformationId");
|
||||
|
||||
b.ToTable("CompileJobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool?>("AllowWebClient")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("AutoStart")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("PrimaryPort")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("ProcessId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SecondaryPort")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SecurityLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool?>("SoftRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("SoftShutdown")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long>("StartupTimeout")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DreamDaemonSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<int>("ApiValidationPort")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ApiValidationSecurityLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ProjectName")
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("DreamMakerSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<long>("AutoUpdateInterval")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("ChatBotLimit")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ConfigurationType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("Online")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Path")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Instances");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("ByondRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal>("ChatBotRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal>("ConfigurationRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal>("DreamDaemonRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal>("DreamMakerRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<decimal>("InstanceUserRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal>("RepositoryRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<long?>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId");
|
||||
|
||||
b.HasIndex("UserId", "InstanceId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("InstanceUsers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal?>("CancelRight")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<decimal?>("CancelRightsType")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<bool?>("Cancelled")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long?>("CancelledById")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long?>("ErrorCode")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ExceptionDetails")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("StartedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<long>("StartedById")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("StoppedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CancelledById");
|
||||
|
||||
b.HasIndex("InstanceId");
|
||||
|
||||
b.HasIndex("StartedById");
|
||||
|
||||
b.ToTable("Jobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ReattachInformation", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("AccessIdentifier")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<long>("CompileJobId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsPrimary")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("LaunchSecurityLevel")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Port")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ProcessId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RebootState")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CompileJobId");
|
||||
|
||||
b.ToTable("ReattachInformations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("AccessUser")
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("AutoUpdatesKeepTestMerges")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("AutoUpdatesSynchronize")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("CommitterEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("CommitterName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("PostTestMergeComment")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("PushTestMergeCommits")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool?>("ShowTestMergeCommitters")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RepositorySettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RevInfoTestMerge", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<long>("RevisionInformationId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TestMergeId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RevisionInformationId");
|
||||
|
||||
b.HasIndex("TestMergeId");
|
||||
|
||||
b.ToTable("RevInfoTestMerges");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("CommitSha")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(40)")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OriginCommitSha")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(40)")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("InstanceId", "CommitSha")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("RevisionInformations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<string>("Author")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("BodyAtMerge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<DateTimeOffset>("MergedAt")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<long>("MergedById")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Number")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long?>("PrimaryRevisionInformationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PullRequestRevision")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(40)")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.Property<string>("TitleAtMerge")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("MergedById");
|
||||
|
||||
b.HasIndex("PrimaryRevisionInformationId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("TestMerges");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<decimal>("AdministrationRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<string>("CanonicalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTimeOffset?>("CreatedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<long?>("CreatedById")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("Enabled")
|
||||
.IsRequired()
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<decimal>("InstanceManagerRights")
|
||||
.HasColumnType("decimal(20,0)");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastPasswordUpdate")
|
||||
.HasColumnType("datetimeoffset");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("SystemIdentifier")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CanonicalName")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("CreatedById");
|
||||
|
||||
b.HasIndex("SystemIdentifier")
|
||||
.IsUnique()
|
||||
.HasFilter("[SystemIdentifier] IS NOT NULL");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.WatchdogReattachInformation", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<long?>("AlphaId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("AlphaIsActive")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<long?>("BravoId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AlphaId");
|
||||
|
||||
b.HasIndex("BravoId");
|
||||
|
||||
b.HasIndex("InstanceId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("WatchdogReattachInformations");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithMany("ChatSettings")
|
||||
.HasForeignKey("InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.ChatBot", "ChatSettings")
|
||||
.WithMany("Channels")
|
||||
.HasForeignKey("ChatSettingsId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithOne("DreamDaemonSettings")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.DreamDaemonSettings", "InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithOne("DreamMakerSettings")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.DreamMakerSettings", "InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithMany("InstanceUsers")
|
||||
.HasForeignKey("InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.User", null)
|
||||
.WithMany("InstanceUsers")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.User", "CancelledBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CancelledById");
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithMany("Jobs")
|
||||
.HasForeignKey("InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.User", "StartedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("StartedById")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ReattachInformation", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
|
||||
.WithMany()
|
||||
.HasForeignKey("CompileJobId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithOne("RepositorySettings")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.RepositorySettings", "InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RevInfoTestMerge", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("ActiveTestMerges")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
|
||||
.WithMany("RevisionInformations")
|
||||
.HasForeignKey("InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.User", "MergedBy")
|
||||
.WithMany("TestMerges")
|
||||
.HasForeignKey("MergedById")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.User", "CreatedBy")
|
||||
.WithMany("CreatedUsers")
|
||||
.HasForeignKey("CreatedById");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.WatchdogReattachInformation", b =>
|
||||
{
|
||||
b.HasOne("Tgstation.Server.Host.Models.ReattachInformation", "Alpha")
|
||||
.WithMany()
|
||||
.HasForeignKey("AlphaId");
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.ReattachInformation", "Bravo")
|
||||
.WithMany()
|
||||
.HasForeignKey("BravoId");
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.Instance", null)
|
||||
.WithOne("WatchdogReattachInformation")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.WatchdogReattachInformation", "InstanceId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Fix cascading data deletes for <see cref="Models.Instance"/>s on MSSQL.
|
||||
/// </summary>
|
||||
public partial class MSFixCascadingDelete : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs",
|
||||
column: "RevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges",
|
||||
column: "TestMergeId",
|
||||
principalTable: "TestMerges",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges",
|
||||
column: "PrimaryRevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs",
|
||||
column: "RevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges",
|
||||
column: "TestMergeId",
|
||||
principalTable: "TestMerges",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges",
|
||||
column: "PrimaryRevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+137
-133
@@ -6,49 +6,50 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(SqliteDatabaseContext))]
|
||||
[Migration("20200423053214_SLRebuild")]
|
||||
partial class SLRebuild
|
||||
[DbContext(typeof(MySqlDatabaseContext))]
|
||||
[Migration("20200427180159_MYFixCascadingDelete")]
|
||||
partial class MYFixCascadingDelete
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "3.1.3");
|
||||
.HasAnnotation("ProductVersion", "3.1.3")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64);
|
||||
|
||||
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ushort?>("ChannelLimit")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<string>("ConnectionString")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("Enabled")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("varchar(100) CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(100);
|
||||
|
||||
b.Property<int>("Provider")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<uint?>("ReconnectionInterval")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -62,32 +63,32 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("ChatSettingsId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ulong?>("DiscordChannelId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<string>("IrcChannel")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("varchar(100) CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(100);
|
||||
|
||||
b.Property<bool?>("IsAdminChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("IsUpdatesChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("IsWatchdogChannel")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Tag")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -105,41 +106,41 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ByondVersion")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<int?>("DMApiMajorVersion")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DMApiMinorVersion")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int?>("DMApiPatchVersion")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<Guid?>("DirectoryName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("DmeName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<long>("JobId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("MinimumSecurityLevel")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Output")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<long>("RevisionInformationId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -157,47 +158,47 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<bool?>("AllowWebClient")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("AutoStart")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ushort?>("PrimaryPort")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<int?>("ProcessId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<ushort?>("SecondaryPort")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<int>("SecurityLevel")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<bool?>("SoftRestart")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("SoftShutdown")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<uint?>("StartupTimeout")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -211,20 +212,20 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ushort?>("ApiValidationPort")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<int>("ApiValidationSecurityLevel")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("ProjectName")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -239,31 +240,31 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<uint?>("AutoUpdateInterval")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<ushort?>("ChatBotLimit")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<int>("ConfigurationType")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("Online")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -277,35 +278,35 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ulong>("ByondRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("ChatBotRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("ConfigurationRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("DreamDaemonRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("DreamMakerRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ulong>("InstanceUserRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong>("RepositoryRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<long?>("UserId")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -321,40 +322,43 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ulong?>("CancelRight")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<ulong?>("CancelRightsType")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<bool?>("Cancelled")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long?>("CancelledById")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<uint?>("ErrorCode")
|
||||
.HasColumnType("int unsigned");
|
||||
|
||||
b.Property<string>("ExceptionDetails")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("StartedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<long>("StartedById")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<DateTimeOffset?>("StoppedAt")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -371,29 +375,29 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("AccessIdentifier")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<long>("CompileJobId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("IsPrimary")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<int>("LaunchSecurityLevel")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<ushort>("Port")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("smallint unsigned");
|
||||
|
||||
b.Property<int>("ProcessId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("RebootState")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -406,48 +410,48 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("AccessUser")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<bool?>("AutoUpdatesKeepTestMerges")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("AutoUpdatesSynchronize")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<string>("CommitterEmail")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("CommitterName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("PostTestMergeComment")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("PushTestMergeCommits")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<bool?>("ShowTestMergeCommitters")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -461,13 +465,13 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("RevisionInformationId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("TestMergeId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -482,19 +486,19 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("CommitSha")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("OriginCommitSha")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.HasKey("Id");
|
||||
@@ -509,45 +513,45 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("Author")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<string>("BodyAtMerge")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<string>("Comment")
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<DateTimeOffset>("MergedAt")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<long>("MergedById")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<int>("Number")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long?>("PrimaryRevisionInformationId")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<string>("PullRequestRevision")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("varchar(40) CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(40);
|
||||
|
||||
b.Property<string>("TitleAtMerge")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<string>("Url")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -563,42 +567,42 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<ulong>("AdministrationRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<string>("CanonicalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<DateTimeOffset?>("CreatedAt")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<long?>("CreatedById")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool?>("Enabled")
|
||||
.IsRequired()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<ulong>("InstanceManagerRights")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint unsigned");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastPasswordUpdate")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT")
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4")
|
||||
.HasMaxLength(10000);
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("longtext CHARACTER SET utf8mb4");
|
||||
|
||||
b.Property<string>("SystemIdentifier")
|
||||
.HasColumnType("TEXT");
|
||||
.HasColumnType("varchar(255) CHARACTER SET utf8mb4");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -617,19 +621,19 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long?>("AlphaId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<bool>("AlphaIsActive")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("tinyint(1)");
|
||||
|
||||
b.Property<long?>("BravoId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.Property<long>("InstanceId")
|
||||
.HasColumnType("INTEGER");
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
@@ -666,13 +670,13 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -757,7 +761,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -781,7 +785,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using System;
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Fix cascading data deletes for <see cref="Models.Instance"/>s on MYSQL.
|
||||
/// </summary>
|
||||
public partial class MYFixCascadingDelete : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs",
|
||||
column: "RevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges",
|
||||
column: "TestMergeId",
|
||||
principalTable: "TestMerges",
|
||||
principalColumn: "Id");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges",
|
||||
column: "PrimaryRevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
if (migrationBuilder == null)
|
||||
throw new ArgumentNullException(nameof(migrationBuilder));
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_Jobs_JobId",
|
||||
table: "CompileJobs",
|
||||
column: "JobId",
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
table: "CompileJobs",
|
||||
column: "RevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
table: "RevInfoTestMerges",
|
||||
column: "TestMergeId",
|
||||
principalTable: "TestMerges",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_TestMerges_RevisionInformations_PrimaryRevisionInformationId",
|
||||
table: "TestMerges",
|
||||
column: "PrimaryRevisionInformationId",
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-6
@@ -7,8 +7,8 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(SqliteDatabaseContext))]
|
||||
[Migration("20200425024539_SLAddJobErrorCodes")]
|
||||
partial class SLAddJobErrorCodes
|
||||
[Migration("20200427180904_SLRebuild")]
|
||||
partial class SLRebuild
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
@@ -669,13 +669,13 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -760,7 +760,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -784,7 +784,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
+5
-9
@@ -1,9 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#pragma warning disable CA1502
|
||||
#pragma warning disable CA1506
|
||||
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
@@ -228,6 +225,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
Id = table.Column<long>(nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Description = table.Column<string>(nullable: false),
|
||||
ErrorCode = table.Column<uint>(nullable: true),
|
||||
ExceptionDetails = table.Column<string>(nullable: true),
|
||||
StartedAt = table.Column<DateTimeOffset>(nullable: false),
|
||||
StoppedAt = table.Column<DateTimeOffset>(nullable: true),
|
||||
@@ -317,7 +315,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
column: x => x.PrimaryRevisionInformationId,
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -345,13 +343,12 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
column: x => x.JobId,
|
||||
principalTable: "Jobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
|
||||
column: x => x.RevisionInformationId,
|
||||
principalTable: "RevisionInformations",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -376,8 +373,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
name: "FK_RevInfoTestMerges_TestMerges_TestMergeId",
|
||||
column: x => x.TestMergeId,
|
||||
principalTable: "TestMerges",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
||||
namespace Tgstation.Server.Host.Database
|
||||
namespace Tgstation.Server.Host.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(MySqlDatabaseContext))]
|
||||
partial class MySqlDatabaseContextModelSnapshot : ModelSnapshot
|
||||
@@ -667,13 +667,13 @@ namespace Tgstation.Server.Host.Database
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -758,7 +758,7 @@ namespace Tgstation.Server.Host.Database
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -782,7 +782,7 @@ namespace Tgstation.Server.Host.Database
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
|
||||
+4
-4
@@ -679,13 +679,13 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -770,7 +770,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -794,7 +794,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
|
||||
@@ -666,13 +666,13 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.Job", "Job")
|
||||
.WithOne()
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.CompileJob", "JobId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
|
||||
.WithMany("CompileJobs")
|
||||
.HasForeignKey("RevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -757,7 +757,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.TestMerge", "TestMerge")
|
||||
.WithMany("RevisonInformations")
|
||||
.HasForeignKey("TestMergeId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.OnDelete(DeleteBehavior.ClientNoAction)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
@@ -781,7 +781,7 @@ namespace Tgstation.Server.Host.Database.Migrations
|
||||
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "PrimaryRevisionInformation")
|
||||
.WithOne("PrimaryTestMerge")
|
||||
.HasForeignKey("Tgstation.Server.Host.Models.TestMerge", "PrimaryRevisionInformationId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user