Fix release build, deleted schema for now

This commit is contained in:
Cyberboss
2018-04-11 12:39:34 -04:00
parent 18ceaf57d8
commit e62fc56184
42 changed files with 171 additions and 3202 deletions
@@ -4,9 +4,7 @@ using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Metadata about an installation
/// </summary>
/// <inheritdoc />
public sealed class Administration : Internal.ServerSettings
{
/// <summary>
@@ -28,7 +26,7 @@ namespace Tgstation.Server.Api.Models
public Version CurrentVersion { get; set; }
/// <summary>
/// Users in the <see cref="SystemAuthenticationGroup"/>
/// Users in the <see cref="Internal.ServerSettings.SystemAuthenticationGroup"/>
/// </summary>
[Permissions(DenyWrite = true)]
public IReadOnlyList<User> Users { get; set; }
@@ -1,5 +1,6 @@
namespace Tgstation.Server.Api.Models
{
/// <inheritdoc />
public sealed class CompileJob : Internal.CompileJob
{
/// <summary>
@@ -6,7 +6,6 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server
/// </summary>
[Model(RightsType.DreamDaemon, CanCrud = true, RequiresInstance = true)]
public sealed class DreamDaemon : DreamDaemonSettings
{
/// <summary>
@@ -21,8 +20,11 @@ namespace Tgstation.Server.Api.Models
[Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadMetadata)]
public DreamDaemonStatus? Status { get; set; }
/// <summary>
/// The current <see cref="DreamDaemonSecurity"/> of <see cref="DreamDaemon"/>
/// </summary>
[Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadMetadata)]
public DreamDaemonSecurity? CurrentSecurityLevel { get; set; }
public DreamDaemonSecurity? CurrentSecurity { get; set; }
/// <summary>
/// The port the running <see cref="DreamDaemon"/> instance is set to
@@ -8,7 +8,7 @@
/// <summary>
/// Server is unrestricted in terms of file access and shell commands
/// </summary>
Trusted = 0,
Trusted,
/// <summary>
/// Server will not be able to run shell commands or access files outside it's working directory
/// </summary>
@@ -6,12 +6,12 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile
/// </summary>
[Model(RightsType.DreamMaker, ReadRight = DreamMakerRights.Read, CanCrud = true, RequiresInstance = true)]
public sealed class DreamMaker : DreamMakerSettings
{
/// <summary>
/// The last <see cref="CompileJob"/> ran
/// </summary>
[Permissions(DenyWrite = true)]
public CompileJob LastJob { get; set; }
/// <summary>
@@ -3,6 +3,9 @@ using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a run of <see cref="DreamMaker"/>
/// </summary>
public class CompileJob
{
/// <summary>
@@ -2,6 +2,10 @@
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Configurable settings for <see cref="DreamDaemon"/>
/// </summary>
[Model(RightsType.DreamDaemon, CanCrud = true, RequiresInstance = true)]
public class DreamDaemonSettings
{
/// <summary>
@@ -2,6 +2,10 @@
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Configurable settings for <see cref="DreamMaker"/>
/// </summary>
[Model(RightsType.DreamMaker, ReadRight = DreamMakerRights.Read, CanCrud = true, RequiresInstance = true)]
public class DreamMakerSettings
{
/// <summary>
@@ -3,33 +3,42 @@ using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a long running job
/// </summary>
[Model]
public class Job
{
/// <summary>
/// The <see cref="Job"/> ID
/// </summary>
[Permissions(DenyWrite = true)]
public long Id { get; set; }
/// <summary>
/// Human readable description of the <see cref="Job"/>
/// English description of the <see cref="Job"/>
/// </summary>
[Permissions(DenyWrite = true)]
[Required]
public string Description { get; set; }
/// <summary>
/// When the <see cref="Job"/> was started
/// </summary>
[Permissions(DenyWrite = true)]
[Required]
public DateTimeOffset StartedAt { get; set; }
/// <summary>
/// When the <see cref="Job"/> stopped
/// </summary>
[Permissions(DenyWrite = true)]
public DateTimeOffset StoppedAt { get; set; }
/// <summary>
/// If the <see cref="Job"/> was cancelled
/// </summary>
[Permissions(DenyWrite = true)]
public bool Cancelled { get; set; }
}
}
@@ -3,14 +3,12 @@ using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents configurable settings for a <see cref="Repository"/>
/// </summary>
[Model(RightsType.Repository, ReadRight = RepositoryRights.Read, RequiresInstance = true)]
public class RepositorySettings
{
/// <summary>
/// The origin URL. If <see langword="null"/>, the <see cref="Repository"/> does not exist
/// </summary>
[Permissions(WriteRight = RepositoryRights.SetOrigin)]
public string Origin { get; set; }
/// <summary>
/// The name of the committer
/// </summary>
@@ -2,11 +2,22 @@
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents information about a current git revison
/// </summary>
public class RevisionInformation
{
/// <summary>
/// The revision sha
/// </summary>
[Permissions(DenyWrite = true)]
[Required, StringLength(40)]
public string Revision { get; set; }
/// <summary>
/// The sha of the most recent remote commit
/// </summary>
[Permissions(DenyWrite = true)]
[Required, StringLength(40)]
public string OriginRevision { get; set; }
}
@@ -2,6 +2,9 @@
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Metadata about an installation
/// </summary>
[Model(RightsType.Administration)]
public class ServerSettings
{
@@ -3,19 +3,37 @@ using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
public class TestMerge
/// <summary>
/// Represents a merge of a GitHub pull request
/// </summary>
public class TestMerge : TestMergeParameters
{
/// <summary>
/// The ID of the <see cref="TestMerge"/>
/// </summary>
public long Id { get; set; }
/// <summary>
/// When the <see cref="TestMerge"/> was created
/// </summary>
[Required]
public DateTimeOffset MergedAt { get; set; }
/// <summary>
/// The title of the pull request
/// </summary>
[Required]
public string TitleAtMerge { get; set; }
/// <summary>
/// The body of the pull request
/// </summary>
[Required]
public string BodyAtMerge { get; set; }
/// <summary>
/// The author of the pull request
/// </summary>
[Required]
public string Author { get; set; }
}
@@ -7,7 +7,7 @@ namespace Tgstation.Server.Api.Models.Internal
/// <summary>
/// Represents a server <see cref="User"/>
/// </summary>
[Model(RightsType.Administration, WriteRight = AdministrationRights.EditUsers)]
[Model(RightsType.Administration, WriteRight = AdministrationRights.EditUsers, CanCrud = true)]
public class User
{
/// <summary>
@@ -16,6 +16,9 @@ namespace Tgstation.Server.Api.Models.Internal
[Permissions(DenyWrite = true)]
public long Id { get; set; }
/// <summary>
/// When the <see cref="User"/> was created
/// </summary>
[Permissions(DenyWrite = true)]
[Required]
public DateTimeOffset CreatedAt { get; set; }
+6 -1
View File
@@ -3,19 +3,24 @@
/// <summary>
/// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job
/// </summary>
[Model]
public sealed class Job : Internal.Job
{
/// <summary>
/// If the <see cref="Job"/> has incremental progress, this will range from 1 - 100. 0 otherwise
/// </summary>
[Permissions(DenyWrite = true)]
public int Progress { get; set; }
/// <summary>
/// If the current user has permission to cancel the job
/// </summary>
[Permissions(DenyWrite = true)]
public bool UserCanCancel { get; set; }
/// <summary>
/// The <see cref="User"/> that started the job
/// </summary>
[Permissions(DenyWrite = true)]
public User StartedBy { get; set; }
}
}
+12 -1
View File
@@ -6,15 +6,23 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Represents a git repository
/// </summary>
[Model(RightsType.Repository, ReadRight = RepositoryRights.Read, RequiresInstance = true)]
public sealed class Repository : Internal.RepositorySettings
{
/// <summary>
/// The origin URL. If <see langword="null"/>, the <see cref="Repository"/> does not exist
/// </summary>
[Permissions(WriteRight = RepositoryRights.SetOrigin)]
public string Origin { get; set; }
/// <summary>
/// The commit HEAD points to
/// </summary>
[Permissions(WriteRight = RepositoryRights.SetSha)]
public string NewRevision { get; set; }
/// <summary>
/// The current <see cref="Models.RevisionInformation"/> for the <see cref="Repository"/>
/// </summary>
[Permissions(DenyWrite = true)]
public RevisionInformation RevisionInformation { get; set; }
@@ -24,6 +32,9 @@ namespace Tgstation.Server.Api.Models
[Permissions(WriteRight = RepositoryRights.SetReference)]
public string Reference { get; set; }
/// <summary>
/// <see cref="TestMergeParameters"/> for new <see cref="TestMerge"/>s
/// </summary>
[Permissions(WriteRight = RepositoryRights.MergePullRequest)]
public List<TestMergeParameters> NewTestMerges { get; set; }
}
@@ -2,8 +2,12 @@
namespace Tgstation.Server.Api.Models
{
/// <inheritdoc />
public sealed class RevisionInformation : Internal.RevisionInformation
{
{
/// <summary>
/// The <see cref="TestMerge"/>s active in the <see cref="RevisionInformation"/>
/// </summary>
public List<TestMerge> TestMerges { get; set; }
}
}
@@ -1,7 +1,11 @@
namespace Tgstation.Server.Api.Models
{
/// <inheritdoc />
public sealed class TestMerge : Internal.TestMerge
{
/// <summary>
/// The <see cref="User"/> who created the <see cref="TestMerge"/>
/// </summary>
public User MergedBy { get; set; }
}
}
@@ -2,10 +2,19 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Parameters for creating a <see cref="TestMerge"/>
/// </summary>
public class TestMergeParameters
{
/// <summary>
/// The number of the pull request
/// </summary>
public int Number { get; set; }
/// <summary>
/// The sha of the pull request revision to merge
/// </summary>
[Required]
public string PullRequestRevision { get; set; }
}
+6 -1
View File
@@ -1,8 +1,13 @@
namespace Tgstation.Server.Api.Models
{
/// <inheritdoc />
/// <summary>
/// Represents a JWT returned by the API
/// </summary>
public sealed class Token
{
/// <summary>
/// The value of the JWT
/// </summary>
public string Value { get; set; }
}
}
+4 -3
View File
@@ -1,10 +1,11 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Represents a server <see cref="User"/>
/// </summary>
/// <inheritdoc />
public sealed class User : Internal.User
{
/// <summary>
/// If the <see cref="User"/> is enabled since users cannot be deleted
/// </summary>
[Permissions(DenyWrite = true)]
public bool Enabled { get; set; }
}
@@ -17,7 +17,7 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
ChangeAuthenticationGroup = 1,
/// <summary>
/// User can change <see cref="Models.Administration.EnableTelemetry"/>
/// User can change <see cref="Models.Internal.ServerSettings.EnableTelemetry"/>
/// </summary>
ChangeTelemetry = 2,
/// <summary>
@@ -33,7 +33,7 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
ChangeVersion = 16,
/// <summary>
/// User can change <see cref="Models.Administration.UpstreamRepository"/>
/// User can change <see cref="Models.Internal.ServerSettings.UpstreamRepository"/>
/// </summary>
SetUpstreamRepository = 32
}
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
None = 0,
/// <summary>
/// User can read <see cref="Models.DreamDaemon.PullRequests"/>, <see cref="Models.DreamDaemon.Sha"/>, and <see cref="Models.DreamDaemon.OriginSha"/>
/// User can read <see cref="Models.DreamDaemon.CompileJob"/>
/// </summary>
ReadRevision = 1,
/// <summary>
@@ -21,27 +21,27 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
SetPorts = 2,
/// <summary>
/// User can change <see cref="Models.DreamDaemon.AutoStart"/>
/// User can change <see cref="Models.Internal.DreamDaemonSettings.AutoStart"/>
/// </summary>
SetAutoStart = 4,
/// <summary>
/// User set <see cref="Models.DreamDaemon.SecurirtyLevel"/>
/// User set <see cref="Models.Internal.DreamDaemonSettings.SecurityLevel"/>
/// </summary>
SetSecurity = 8,
/// <summary>
/// User can read all ports, <see cref="Models.DreamDaemon.SoftRestart"/>, <see cref="Models.DreamDaemon.SoftShutdown"/>, <see cref="Models.DreamDaemon.Status"/>, <see cref="Models.DreamDaemon.AllowWebClient"/>, and <see cref="Models.DreamDaemon.AutoStart"/>
/// User can read all ports, <see cref="Models.Internal.DreamDaemonSettings.SoftRestart"/>, <see cref="Models.Internal.DreamDaemonSettings.SoftShutdown"/>, <see cref="Models.DreamDaemon.Status"/>, <see cref="Models.Internal.DreamDaemonSettings.AllowWebClient"/>, and <see cref="Models.Internal.DreamDaemonSettings.AutoStart"/>
/// </summary>
ReadMetadata = 16,
/// <summary>
/// User can change <see cref="Models.DreamDaemon.AllowWebClient"/>
/// User can change <see cref="Models.Internal.DreamDaemonSettings.AllowWebClient"/>
/// </summary>
SetWebClient = 32,
/// <summary>
/// User can enable <see cref="Models.DreamDaemon.SoftRestart"/>
/// User can enable <see cref="Models.Internal.DreamDaemonSettings.SoftRestart"/>
/// </summary>
SoftRestart = 64,
/// <summary>
/// User can enable <see cref="Models.DreamDaemon.SoftShutdown"/>
/// User can enable <see cref="Models.Internal.DreamDaemonSettings.SoftShutdown"/>
/// </summary>
SoftShutdown = 128,
/// <summary>
@@ -53,7 +53,7 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
Shutdown = 512,
/// <summary>
/// User can start <see cref="Models.DreamDaemon"/> and disable <see cref="Models.DreamDaemon.SoftRestart"/> and <see cref="Models.DreamDaemon.SoftShutdown"/>
/// User can start <see cref="Models.DreamDaemon"/> and disable <see cref="Models.Internal.DreamDaemonSettings.SoftRestart"/> and <see cref="Models.Internal.DreamDaemonSettings.SoftShutdown"/>
/// </summary>
Start = 1024
}
@@ -25,11 +25,11 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
CancelCompile = 4,
/// <summary>
/// User may modify <see cref="Models.DreamMaker.AutoCompileInterval"/>
/// User may modify <see cref="Models.Internal.DreamMakerSettings.AutoCompileInterval"/>
/// </summary>
SetAutoCompile = 8,
/// <summary>
/// User may modify <see cref="Models.DreamMaker.TargetDme"/>
/// User may modify <see cref="Models.Internal.DreamMakerSettings.TargetDme"/>
/// </summary>
SetDme = 16
}
@@ -29,19 +29,19 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
UpdateBranch = 16,
/// <summary>
/// User may change <see cref="Models.Repository.CommitterName"/> and <see cref="Models.Repository.CommitterEmail"/>
/// User may change <see cref="Models.Internal.RepositorySettings.CommitterName"/> and <see cref="Models.Internal.RepositorySettings.CommitterEmail"/>
/// </summary>
ChangeCommitter = 32,
/// <summary>
/// User may change <see cref="Models.Repository.PushTestMergeCommits"/>
/// User may change <see cref="Models.Internal.RepositorySettings.PushTestMergeCommits"/>
/// </summary>
ChangeTestMergeCommits = 64,
/// <summary>
/// User may change <see cref="Models.Repository.AutoUpdateInterval"/>
/// User may change <see cref="Models.Internal.RepositorySettings.AutoUpdateInterval"/>
/// </summary>
ChangeAutoUpdate = 128,
/// <summary>
/// User may read and change <see cref="Models.Repository.AccessUser"/> and <see cref="Models.Repository.AccessToken"/>
/// User may read and change <see cref="Models.Internal.RepositorySettings.AccessUser"/> and <see cref="Models.Internal.RepositorySettings.AccessToken"/>
/// </summary>
ChangeCredentials = 256,
/// <summary>
@@ -49,7 +49,7 @@ namespace Tgstation.Server.Api.Rights
/// </summary>
SetReference = 512,
/// <summary>
/// User may read all fields in the <see cref="Models.Repository"/> with the exception of <see cref="Models.Repository.AccessToken"/>
/// User may read all fields in the <see cref="Models.Repository"/> with the exception of <see cref="Models.Internal.RepositorySettings.AccessToken"/>
/// </summary>
Read = 1024,
}
@@ -32,7 +32,7 @@ namespace Tgstation.Server.Client.Components
Task Shutdown(CancellationToken cancellationToken);
/// <summary>
/// Update <see cref="DreamDaemon"/>. This may trigger <see cref="DreamDaemon.SoftRestart"/>
/// Update <see cref="DreamDaemon"/>. This may trigger <see cref="Api.Models.Internal.DreamDaemonSettings.SoftRestart"/>
/// </summary>
/// <param name="dreamDaemon">The <see cref="DreamDaemon"/> to update</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> for the operation</param>
+1 -1
View File
@@ -10,7 +10,7 @@ namespace Tgstation.Server.Host.Startup
public interface IServer
{
/// <summary>
/// The path to the updated assembly to run if any. Populated once <see cref="RunAsync(string[], CancellationToken)"/> returns
/// The path to the updated assembly to run if any. Populated once <see cref="RunAsync(CancellationToken)"/> returns
/// </summary>
string UpdatePath { get; }
@@ -55,7 +55,6 @@ namespace Tgstation.Server.Host.Core
services.AddMvc();
services.AddOptions();
services.AddLocalization();
var databaseConfiguration = databaseConfigurationSection.Get<DatabaseConfiguration>();
void ConfigureDatabase(DbContextOptionsBuilder builder)
@@ -99,21 +98,6 @@ namespace Tgstation.Server.Host.Core
if (hostingEnvironment.IsDevelopment())
applicationBuilder.UseDeveloperExceptionPage();
var defaultCulture = new CultureInfo("en");
var supportedCultures = new List<CultureInfo>
{
defaultCulture
};
CultureInfo.CurrentCulture = defaultCulture;
CultureInfo.CurrentUICulture = defaultCulture;
applicationBuilder.UseRequestLocalization(new RequestLocalizationOptions
{
SupportedCultures = supportedCultures,
SupportedUICultures = supportedCultures,
});
applicationBuilder.UseAsyncInitialization(async (cancellationToken) =>
{
using (var scop = applicationBuilder.ApplicationServices.CreateScope())
@@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Net;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Api;
@@ -39,7 +38,7 @@ namespace Tgstation.Server.Host.Core
ApiHeaders headers;
try
{
headers = new ApiHeaders(httpContext.Request.Headers.ToDictionary(x => x.Key, x => x.Value.First()));
headers = new ApiHeaders(httpContext.Request.GetTypedHeaders());
}
catch (InvalidOperationException)
{
@@ -87,12 +86,12 @@ namespace Tgstation.Server.Host.Core
/// <summary>
/// Construct a <see cref="IAuthenticationContext"/>
/// </summary>
/// <param name="systemIdentity">The value of <see cref="systemIdentity"/></param>
/// <param name="systemIdentity">The value of <see cref="SystemIdentity"/></param>
/// <param name="databaseContext">The value of <see cref="databaseContext"/></param>
public AuthenticationContext(ISystemIdentity systemIdentity, IDatabaseContext databaseContext)
{
SystemIdentity = systemIdentity ?? throw new ArgumentNullException(nameof(systemIdentity));
this.databaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext));
SystemIdentity = systemIdentity;
}
/// <inheritdoc />
@@ -38,27 +38,27 @@ namespace Tgstation.Server.Host.Models
public DbSet<RepositorySettings> RepositorySettings { get; set; }
/// <summary>
/// The connection string for the <see cref="DatabaseContext"/>
/// The connection string for the <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
protected string ConnectionString => databaseConfiguration.ConnectionString;
/// <summary>
/// The <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext"/>
/// The <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
readonly DatabaseConfiguration databaseConfiguration;
/// <summary>
/// The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext"/>
/// The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
readonly ILoggerFactory loggerFactory;
/// <summary>
/// The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext"/>
/// The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
readonly IDatabaseSeeder databaseSeeder;
/// <summary>
/// Construct a <see cref="DatabaseContext"/>
/// Construct a <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TParentContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseConfigurationOptions">The <see cref="IOptions{TOptions}"/> containing the value of <see cref="databaseConfiguration"/></param>
/// <param name="loggerFactory">The value of <see cref="loggerFactory"/></param>
/// <param name="databaseSeeder">The value of <see cref="databaseSeeder"/></param>
@@ -79,7 +79,7 @@ namespace Tgstation.Server.Host.Models
modelBuilder.Entity<Log>().ToTable(nameof(Logs));
modelBuilder.Entity<RevisionInformation>().HasIndex(x => x.Revision).IsUnique();
modelBuilder.Entity<User>().HasIndex(x => x.SystemIdentifier).IsUnique();
modelBuilder.Entity<User>().HasIndex(x => new { x.Name, x.SystemIdentifier }).IsUnique();
}
/// <inheritdoc />
@@ -105,9 +105,13 @@ namespace Tgstation.Server.Host.Models
/// <inheritdoc />
public async Task Initialize(CancellationToken cancellationToken)
{
#if DEBUG
await Database.EnsureCreatedAsync().ConfigureAwait(false);
#else
var migrations = await Database.GetAppliedMigrationsAsync().ConfigureAwait(false);
var wasEmpty = !migrations.Any();
await Database.MigrateAsync(cancellationToken).ConfigureAwait(false);
#endif
if (wasEmpty)
await databaseSeeder.SeedDatabase(this, cancellationToken).ConfigureAwait(false);
}
@@ -20,7 +20,7 @@ namespace Tgstation.Server.Host.Models
const string DefaultUpstreamRepository = "https://github.com/tgstation/tgstation-server";
/// <summary>
/// The <see cref="ICryptographySuite"/> for the <see cref="DatabaseContext"/>
/// The <see cref="ICryptographySuite"/> for the <see cref="DatabaseContext{TParentContext}"/>
/// </summary>
readonly ICryptographySuite cryptographySuite;
@@ -7,7 +7,7 @@ using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Models.Migrations
{
/// <summary>
/// Contains helpers for creating design time <see cref="Models.DatabaseContext"/>s
/// Contains helpers for creating design time <see cref="Models.DatabaseContext{TParentContext}"/>s
/// </summary>
static class DesignTimeDbContextFactoryHelpers
{
@@ -1,512 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Migrations;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Models.Migrations.SqlServer
{
[DbContext(typeof(SqlServerDatabaseContext))]
[Migration("20180410203936_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.0-preview2-30571")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ChatSettingsId");
b.Property<long?>("ChatSettingsId1");
b.Property<long>("DiscordChannelId");
b.Property<string>("IrcChannel");
b.HasKey("Id");
b.HasIndex("ChatSettingsId");
b.HasIndex("ChatSettingsId1");
b.ToTable("ChatChannels");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DiscordBotToken");
b.Property<bool>("DiscordEnabled");
b.Property<long>("InstanceId");
b.Property<bool>("IrcEnabled");
b.Property<string>("IrcHost")
.IsRequired();
b.Property<string>("IrcNickServPassword");
b.Property<int>("IrcPort");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("ChatSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ExitCode");
b.Property<DateTimeOffset>("FinishedAt");
b.Property<long?>("InstanceId");
b.Property<string>("Output");
b.Property<long>("RevisionInformationId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<bool?>("TargetedPrimaryDirectory");
b.Property<long>("TriggeredById");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("RevisionInformationId");
b.HasIndex("TriggeredById");
b.ToTable("CompileJobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<bool>("AllowWebClient");
b.Property<bool>("AutoStart");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<int>("PrimaryPort");
b.Property<int?>("ProcessId");
b.Property<int>("SecondaryPort");
b.Property<int>("SecurityLevel");
b.Property<bool>("SoftRestart");
b.Property<bool>("SoftShutdown");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamDaemonSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("AutoCompileInterval");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<string>("TargetDme");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamMakerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("ConfigurationAllowed");
b.Property<string>("Name")
.IsRequired();
b.Property<bool>("Online");
b.Property<string>("Path")
.IsRequired();
b.HasKey("Id");
b.ToTable("Instances");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ByondRights");
b.Property<int>("ChatSettingsRights");
b.Property<int>("ConfigurationRights");
b.Property<int>("DreamDaemonRights");
b.Property<int>("DreamMakerRights");
b.Property<long?>("InstanceId");
b.Property<int>("RepositoryRights");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("UserId");
b.ToTable("InstanceUsers");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Cancelled");
b.Property<string>("Description")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<long>("StartedById");
b.Property<DateTimeOffset>("StoppedAt");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("StartedById");
b.ToTable("Jobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<string>("AccessUser");
b.Property<int?>("AutoUpdateInterval");
b.Property<string>("CommitterEmail")
.IsRequired();
b.Property<string>("CommitterName")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<string>("Origin");
b.Property<bool>("PushTestMergeCommits");
b.Property<long?>("RevisionInformationId");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.HasIndex("RevisionInformationId");
b.ToTable("RepositorySettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("OriginRevision")
.IsRequired()
.HasMaxLength(40);
b.Property<string>("Revision")
.IsRequired()
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("Revision")
.IsUnique();
b.ToTable("RevisionInformations");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("EnableTelemetry");
b.Property<string>("SystemAuthenticationGroup");
b.Property<string>("UpstreamRepository");
b.HasKey("Id");
b.ToTable("ServerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.IsRequired();
b.Property<string>("BodyAtMerge")
.IsRequired();
b.Property<long?>("InstanceId");
b.Property<DateTimeOffset>("MergedAt");
b.Property<long>("MergedById");
b.Property<long?>("RevisionInformationId");
b.Property<string>("TitleAtMerge")
.IsRequired();
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("MergedById");
b.HasIndex("RevisionInformationId");
b.ToTable("TestMerges");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AdministrationRights");
b.Property<DateTimeOffset>("CreatedAt");
b.Property<int>("InstanceManagerRights");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("PasswordHash");
b.Property<string>("SystemIdentifier");
b.Property<string>("TokenSecret")
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("SystemIdentifier")
.IsUnique()
.HasFilter("[SystemIdentifier] IS NOT NULL");
b.ToTable("Users");
});
modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("Level");
b.Property<string>("Message");
b.Property<string>("Name")
.HasMaxLength(255);
b.Property<DateTimeOffset>("TimeStamp");
b.HasKey("Id");
b.ToTable("Logs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("AdminChannels")
.HasForeignKey("ChatSettingsId");
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("GeneralChannels")
.HasForeignKey("ChatSettingsId1");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("ChatSettings")
.HasForeignKey("Tgstation.Server.Host.Models.ChatSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("CompileJobs")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "TriggeredBy")
.WithMany()
.HasForeignKey("TriggeredById")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamDaemonSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamDaemonSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamMakerSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamMakerSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("InstanceUsers")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User")
.WithMany("InstanceUsers")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithMany("Jobs")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "StartedBy")
.WithMany()
.HasForeignKey("StartedById")
.OnDelete(DeleteBehavior.Cascade);
});
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);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("TestMerges")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User", "MergedBy")
.WithMany()
.HasForeignKey("MergedById")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation")
.WithMany("TestMerges")
.HasForeignKey("RevisionInformationId");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,537 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Models.Migrations.SqlServer
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Instances",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(nullable: false),
Path = table.Column<string>(nullable: false),
Online = table.Column<bool>(nullable: false),
ConfigurationAllowed = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Instances", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Logs",
columns: table => new
{
EventId = table.Column<int>(nullable: false),
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Level = table.Column<int>(nullable: false),
Message = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 255, nullable: true),
TimeStamp = table.Column<DateTimeOffset>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Logs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RevisionInformations",
columns: table => new
{
Revision = table.Column<string>(maxLength: 40, nullable: false),
OriginRevision = table.Column<string>(maxLength: 40, nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn)
},
constraints: table =>
{
table.PrimaryKey("PK_RevisionInformations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ServerSettings",
columns: table => new
{
SystemAuthenticationGroup = table.Column<string>(nullable: true),
EnableTelemetry = table.Column<bool>(nullable: false),
UpstreamRepository = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn)
},
constraints: table =>
{
table.PrimaryKey("PK_ServerSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
AdministrationRights = table.Column<int>(nullable: false),
CreatedAt = table.Column<DateTimeOffset>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
InstanceManagerRights = table.Column<int>(nullable: false),
SystemIdentifier = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: false),
PasswordHash = table.Column<string>(nullable: true),
TokenSecret = table.Column<string>(maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ChatSettings",
columns: table => new
{
IrcEnabled = table.Column<bool>(nullable: false),
IrcHost = table.Column<string>(nullable: false),
IrcPort = table.Column<int>(nullable: false),
IrcNickServPassword = table.Column<string>(nullable: true),
DiscordEnabled = table.Column<bool>(nullable: false),
DiscordBotToken = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
InstanceId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatSettings", x => x.Id);
table.ForeignKey(
name: "FK_ChatSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RepositorySettings",
columns: table => new
{
Origin = table.Column<string>(nullable: true),
CommitterName = table.Column<string>(nullable: false),
CommitterEmail = table.Column<string>(nullable: false),
AccessUser = table.Column<string>(nullable: true),
AccessToken = table.Column<string>(nullable: true),
PushTestMergeCommits = table.Column<bool>(nullable: false),
AutoUpdateInterval = table.Column<int>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
InstanceId = table.Column<long>(nullable: false),
RevisionInformationId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RepositorySettings", x => x.Id);
table.ForeignKey(
name: "FK_RepositorySettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RepositorySettings_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "CompileJobs",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
StartedAt = table.Column<DateTimeOffset>(nullable: false),
FinishedAt = table.Column<DateTimeOffset>(nullable: false),
TargetedPrimaryDirectory = table.Column<bool>(nullable: true),
Output = table.Column<string>(nullable: true),
ExitCode = table.Column<int>(nullable: true),
TriggeredById = table.Column<long>(nullable: false),
RevisionInformationId = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CompileJobs", x => x.Id);
table.ForeignKey(
name: "FK_CompileJobs_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CompileJobs_Users_TriggeredById",
column: x => x.TriggeredById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstanceUsers",
columns: table => new
{
ByondRights = table.Column<int>(nullable: false),
DreamDaemonRights = table.Column<int>(nullable: false),
DreamMakerRights = table.Column<int>(nullable: false),
RepositoryRights = table.Column<int>(nullable: false),
ChatSettingsRights = table.Column<int>(nullable: false),
ConfigurationRights = table.Column<int>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
InstanceId = table.Column<long>(nullable: true),
UserId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_InstanceUsers", x => x.Id);
table.ForeignKey(
name: "FK_InstanceUsers_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_InstanceUsers_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Description = table.Column<string>(nullable: false),
StartedAt = table.Column<DateTimeOffset>(nullable: false),
StoppedAt = table.Column<DateTimeOffset>(nullable: false),
Cancelled = table.Column<bool>(nullable: false),
StartedById = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_Jobs_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Jobs_Users_StartedById",
column: x => x.StartedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TestMerges",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
MergedAt = table.Column<DateTimeOffset>(nullable: false),
TitleAtMerge = table.Column<string>(nullable: false),
BodyAtMerge = table.Column<string>(nullable: false),
Author = table.Column<string>(nullable: false),
MergedById = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: true),
RevisionInformationId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TestMerges", x => x.Id);
table.ForeignKey(
name: "FK_TestMerges_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TestMerges_Users_MergedById",
column: x => x.MergedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TestMerges_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ChatChannels",
columns: table => new
{
IrcChannel = table.Column<string>(nullable: true),
DiscordChannelId = table.Column<long>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ChatSettingsId = table.Column<long>(nullable: true),
ChatSettingsId1 = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatChannels", x => x.Id);
table.ForeignKey(
name: "FK_ChatChannels_ChatSettings_ChatSettingsId",
column: x => x.ChatSettingsId,
principalTable: "ChatSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ChatChannels_ChatSettings_ChatSettingsId1",
column: x => x.ChatSettingsId1,
principalTable: "ChatSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DreamDaemonSettings",
columns: table => new
{
AutoStart = table.Column<bool>(nullable: false),
AllowWebClient = table.Column<bool>(nullable: false),
SoftRestart = table.Column<bool>(nullable: false),
SoftShutdown = table.Column<bool>(nullable: false),
SecurityLevel = table.Column<int>(nullable: false),
PrimaryPort = table.Column<int>(nullable: false),
SecondaryPort = table.Column<int>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
ProcessId = table.Column<int>(nullable: true),
AccessToken = table.Column<string>(nullable: true),
InstanceId = table.Column<long>(nullable: false),
CompileJobId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DreamDaemonSettings", x => x.Id);
table.ForeignKey(
name: "FK_DreamDaemonSettings_CompileJobs_CompileJobId",
column: x => x.CompileJobId,
principalTable: "CompileJobs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DreamDaemonSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DreamMakerSettings",
columns: table => new
{
AutoCompileInterval = table.Column<int>(nullable: true),
TargetDme = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
InstanceId = table.Column<long>(nullable: false),
CompileJobId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DreamMakerSettings", x => x.Id);
table.ForeignKey(
name: "FK_DreamMakerSettings_CompileJobs_CompileJobId",
column: x => x.CompileJobId,
principalTable: "CompileJobs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DreamMakerSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ChatChannels_ChatSettingsId",
table: "ChatChannels",
column: "ChatSettingsId");
migrationBuilder.CreateIndex(
name: "IX_ChatChannels_ChatSettingsId1",
table: "ChatChannels",
column: "ChatSettingsId1");
migrationBuilder.CreateIndex(
name: "IX_ChatSettings_InstanceId",
table: "ChatSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_InstanceId",
table: "CompileJobs",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_RevisionInformationId",
table: "CompileJobs",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_TriggeredById",
table: "CompileJobs",
column: "TriggeredById");
migrationBuilder.CreateIndex(
name: "IX_DreamDaemonSettings_CompileJobId",
table: "DreamDaemonSettings",
column: "CompileJobId");
migrationBuilder.CreateIndex(
name: "IX_DreamDaemonSettings_InstanceId",
table: "DreamDaemonSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DreamMakerSettings_CompileJobId",
table: "DreamMakerSettings",
column: "CompileJobId");
migrationBuilder.CreateIndex(
name: "IX_DreamMakerSettings_InstanceId",
table: "DreamMakerSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_InstanceUsers_InstanceId",
table: "InstanceUsers",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_InstanceUsers_UserId",
table: "InstanceUsers",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_InstanceId",
table: "Jobs",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_StartedById",
table: "Jobs",
column: "StartedById");
migrationBuilder.CreateIndex(
name: "IX_RepositorySettings_InstanceId",
table: "RepositorySettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RepositorySettings_RevisionInformationId",
table: "RepositorySettings",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_RevisionInformations_Revision",
table: "RevisionInformations",
column: "Revision",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TestMerges_InstanceId",
table: "TestMerges",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_TestMerges_MergedById",
table: "TestMerges",
column: "MergedById");
migrationBuilder.CreateIndex(
name: "IX_TestMerges_RevisionInformationId",
table: "TestMerges",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_Users_SystemIdentifier",
table: "Users",
column: "SystemIdentifier",
unique: true,
filter: "[SystemIdentifier] IS NOT NULL");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChatChannels");
migrationBuilder.DropTable(
name: "DreamDaemonSettings");
migrationBuilder.DropTable(
name: "DreamMakerSettings");
migrationBuilder.DropTable(
name: "InstanceUsers");
migrationBuilder.DropTable(
name: "Jobs");
migrationBuilder.DropTable(
name: "Logs");
migrationBuilder.DropTable(
name: "RepositorySettings");
migrationBuilder.DropTable(
name: "ServerSettings");
migrationBuilder.DropTable(
name: "TestMerges");
migrationBuilder.DropTable(
name: "ChatSettings");
migrationBuilder.DropTable(
name: "CompileJobs");
migrationBuilder.DropTable(
name: "Instances");
migrationBuilder.DropTable(
name: "RevisionInformations");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -1,511 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Migrations;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Models.Migrations.SqlServer
{
[DbContext(typeof(SqlServerDatabaseContext))]
partial class SqlServerDatabaseContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.0-preview2-30571")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ChatSettingsId");
b.Property<long?>("ChatSettingsId1");
b.Property<long>("DiscordChannelId");
b.Property<string>("IrcChannel");
b.HasKey("Id");
b.HasIndex("ChatSettingsId");
b.HasIndex("ChatSettingsId1");
b.ToTable("ChatChannels");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DiscordBotToken");
b.Property<bool>("DiscordEnabled");
b.Property<long>("InstanceId");
b.Property<bool>("IrcEnabled");
b.Property<string>("IrcHost")
.IsRequired();
b.Property<string>("IrcNickServPassword");
b.Property<int>("IrcPort");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("ChatSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ExitCode");
b.Property<DateTimeOffset>("FinishedAt");
b.Property<long?>("InstanceId");
b.Property<string>("Output");
b.Property<long>("RevisionInformationId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<bool?>("TargetedPrimaryDirectory");
b.Property<long>("TriggeredById");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("RevisionInformationId");
b.HasIndex("TriggeredById");
b.ToTable("CompileJobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<bool>("AllowWebClient");
b.Property<bool>("AutoStart");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<int>("PrimaryPort");
b.Property<int?>("ProcessId");
b.Property<int>("SecondaryPort");
b.Property<int>("SecurityLevel");
b.Property<bool>("SoftRestart");
b.Property<bool>("SoftShutdown");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamDaemonSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("AutoCompileInterval");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<string>("TargetDme");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamMakerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("ConfigurationAllowed");
b.Property<string>("Name")
.IsRequired();
b.Property<bool>("Online");
b.Property<string>("Path")
.IsRequired();
b.HasKey("Id");
b.ToTable("Instances");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ByondRights");
b.Property<int>("ChatSettingsRights");
b.Property<int>("ConfigurationRights");
b.Property<int>("DreamDaemonRights");
b.Property<int>("DreamMakerRights");
b.Property<long?>("InstanceId");
b.Property<int>("RepositoryRights");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("UserId");
b.ToTable("InstanceUsers");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Cancelled");
b.Property<string>("Description")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<long>("StartedById");
b.Property<DateTimeOffset>("StoppedAt");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("StartedById");
b.ToTable("Jobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<string>("AccessUser");
b.Property<int?>("AutoUpdateInterval");
b.Property<string>("CommitterEmail")
.IsRequired();
b.Property<string>("CommitterName")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<string>("Origin");
b.Property<bool>("PushTestMergeCommits");
b.Property<long?>("RevisionInformationId");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.HasIndex("RevisionInformationId");
b.ToTable("RepositorySettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("OriginRevision")
.IsRequired()
.HasMaxLength(40);
b.Property<string>("Revision")
.IsRequired()
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("Revision")
.IsUnique();
b.ToTable("RevisionInformations");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("EnableTelemetry");
b.Property<string>("SystemAuthenticationGroup");
b.Property<string>("UpstreamRepository");
b.HasKey("Id");
b.ToTable("ServerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.IsRequired();
b.Property<string>("BodyAtMerge")
.IsRequired();
b.Property<long?>("InstanceId");
b.Property<DateTimeOffset>("MergedAt");
b.Property<long>("MergedById");
b.Property<long?>("RevisionInformationId");
b.Property<string>("TitleAtMerge")
.IsRequired();
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("MergedById");
b.HasIndex("RevisionInformationId");
b.ToTable("TestMerges");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AdministrationRights");
b.Property<DateTimeOffset>("CreatedAt");
b.Property<int>("InstanceManagerRights");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("PasswordHash");
b.Property<string>("SystemIdentifier");
b.Property<string>("TokenSecret")
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("SystemIdentifier")
.IsUnique()
.HasFilter("[SystemIdentifier] IS NOT NULL");
b.ToTable("Users");
});
modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("Level");
b.Property<string>("Message");
b.Property<string>("Name")
.HasMaxLength(255);
b.Property<DateTimeOffset>("TimeStamp");
b.HasKey("Id");
b.ToTable("Logs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("AdminChannels")
.HasForeignKey("ChatSettingsId");
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("GeneralChannels")
.HasForeignKey("ChatSettingsId1");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("ChatSettings")
.HasForeignKey("Tgstation.Server.Host.Models.ChatSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("CompileJobs")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "TriggeredBy")
.WithMany()
.HasForeignKey("TriggeredById")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamDaemonSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamDaemonSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamMakerSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamMakerSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("InstanceUsers")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User")
.WithMany("InstanceUsers")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithMany("Jobs")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "StartedBy")
.WithMany()
.HasForeignKey("StartedById")
.OnDelete(DeleteBehavior.Cascade);
});
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);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("TestMerges")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User", "MergedBy")
.WithMany()
.HasForeignKey("MergedById")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation")
.WithMany("TestMerges")
.HasForeignKey("RevisionInformationId");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,510 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Migrations;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Models.Migrations.Sqlite
{
[DbContext(typeof(SqliteDatabaseContext))]
[Migration("20180410204120_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.0-preview2-30571");
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ChatSettingsId");
b.Property<long?>("ChatSettingsId1");
b.Property<long>("DiscordChannelId");
b.Property<string>("IrcChannel");
b.HasKey("Id");
b.HasIndex("ChatSettingsId");
b.HasIndex("ChatSettingsId1");
b.ToTable("ChatChannels");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DiscordBotToken");
b.Property<bool>("DiscordEnabled");
b.Property<long>("InstanceId");
b.Property<bool>("IrcEnabled");
b.Property<string>("IrcHost")
.IsRequired();
b.Property<string>("IrcNickServPassword");
b.Property<ushort>("IrcPort");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("ChatSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ExitCode");
b.Property<DateTimeOffset>("FinishedAt");
b.Property<long?>("InstanceId");
b.Property<string>("Output");
b.Property<long>("RevisionInformationId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<bool?>("TargetedPrimaryDirectory");
b.Property<long>("TriggeredById");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("RevisionInformationId");
b.HasIndex("TriggeredById");
b.ToTable("CompileJobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<bool>("AllowWebClient");
b.Property<bool>("AutoStart");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<ushort>("PrimaryPort");
b.Property<int?>("ProcessId");
b.Property<ushort>("SecondaryPort");
b.Property<int>("SecurityLevel");
b.Property<bool>("SoftRestart");
b.Property<bool>("SoftShutdown");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamDaemonSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("AutoCompileInterval");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<string>("TargetDme");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamMakerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("ConfigurationAllowed");
b.Property<string>("Name")
.IsRequired();
b.Property<bool>("Online");
b.Property<string>("Path")
.IsRequired();
b.HasKey("Id");
b.ToTable("Instances");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ByondRights");
b.Property<int>("ChatSettingsRights");
b.Property<int>("ConfigurationRights");
b.Property<int>("DreamDaemonRights");
b.Property<int>("DreamMakerRights");
b.Property<long?>("InstanceId");
b.Property<int>("RepositoryRights");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("UserId");
b.ToTable("InstanceUsers");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Cancelled");
b.Property<string>("Description")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<long>("StartedById");
b.Property<DateTimeOffset>("StoppedAt");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("StartedById");
b.ToTable("Jobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<string>("AccessUser");
b.Property<int?>("AutoUpdateInterval");
b.Property<string>("CommitterEmail")
.IsRequired();
b.Property<string>("CommitterName")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<string>("Origin");
b.Property<bool>("PushTestMergeCommits");
b.Property<long?>("RevisionInformationId");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.HasIndex("RevisionInformationId");
b.ToTable("RepositorySettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("OriginRevision")
.IsRequired()
.HasMaxLength(40);
b.Property<string>("Revision")
.IsRequired()
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("Revision")
.IsUnique();
b.ToTable("RevisionInformations");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("EnableTelemetry");
b.Property<string>("SystemAuthenticationGroup");
b.Property<string>("UpstreamRepository");
b.HasKey("Id");
b.ToTable("ServerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.IsRequired();
b.Property<string>("BodyAtMerge")
.IsRequired();
b.Property<long?>("InstanceId");
b.Property<DateTimeOffset>("MergedAt");
b.Property<long>("MergedById");
b.Property<long?>("RevisionInformationId");
b.Property<string>("TitleAtMerge")
.IsRequired();
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("MergedById");
b.HasIndex("RevisionInformationId");
b.ToTable("TestMerges");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AdministrationRights");
b.Property<DateTimeOffset>("CreatedAt");
b.Property<int>("InstanceManagerRights");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("PasswordHash");
b.Property<string>("SystemIdentifier");
b.Property<string>("TokenSecret")
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("SystemIdentifier")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("Level");
b.Property<string>("Message");
b.Property<string>("Name")
.HasMaxLength(255);
b.Property<DateTimeOffset>("TimeStamp");
b.HasKey("Id");
b.ToTable("Logs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("AdminChannels")
.HasForeignKey("ChatSettingsId");
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("GeneralChannels")
.HasForeignKey("ChatSettingsId1");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("ChatSettings")
.HasForeignKey("Tgstation.Server.Host.Models.ChatSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("CompileJobs")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "TriggeredBy")
.WithMany()
.HasForeignKey("TriggeredById")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamDaemonSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamDaemonSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamMakerSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamMakerSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("InstanceUsers")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User")
.WithMany("InstanceUsers")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithMany("Jobs")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "StartedBy")
.WithMany()
.HasForeignKey("StartedById")
.OnDelete(DeleteBehavior.Cascade);
});
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);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("TestMerges")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User", "MergedBy")
.WithMany()
.HasForeignKey("MergedById")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation")
.WithMany("TestMerges")
.HasForeignKey("RevisionInformationId");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,535 +0,0 @@
using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Models.Migrations.Sqlite
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Instances",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Name = table.Column<string>(nullable: false),
Path = table.Column<string>(nullable: false),
Online = table.Column<bool>(nullable: false),
ConfigurationAllowed = table.Column<bool>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Instances", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Logs",
columns: table => new
{
EventId = table.Column<int>(nullable: false),
Id = table.Column<int>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Level = table.Column<int>(nullable: false),
Message = table.Column<string>(nullable: true),
Name = table.Column<string>(maxLength: 255, nullable: true),
TimeStamp = table.Column<DateTimeOffset>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Logs", x => x.Id);
});
migrationBuilder.CreateTable(
name: "RevisionInformations",
columns: table => new
{
Revision = table.Column<string>(maxLength: 40, nullable: false),
OriginRevision = table.Column<string>(maxLength: 40, nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true)
},
constraints: table =>
{
table.PrimaryKey("PK_RevisionInformations", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ServerSettings",
columns: table => new
{
SystemAuthenticationGroup = table.Column<string>(nullable: true),
EnableTelemetry = table.Column<bool>(nullable: false),
UpstreamRepository = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true)
},
constraints: table =>
{
table.PrimaryKey("PK_ServerSettings", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
AdministrationRights = table.Column<int>(nullable: false),
CreatedAt = table.Column<DateTimeOffset>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InstanceManagerRights = table.Column<int>(nullable: false),
SystemIdentifier = table.Column<string>(nullable: true),
Name = table.Column<string>(nullable: false),
PasswordHash = table.Column<string>(nullable: true),
TokenSecret = table.Column<string>(maxLength: 40, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "ChatSettings",
columns: table => new
{
IrcEnabled = table.Column<bool>(nullable: false),
IrcHost = table.Column<string>(nullable: false),
IrcPort = table.Column<ushort>(nullable: false),
IrcNickServPassword = table.Column<string>(nullable: true),
DiscordEnabled = table.Column<bool>(nullable: false),
DiscordBotToken = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InstanceId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatSettings", x => x.Id);
table.ForeignKey(
name: "FK_ChatSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "RepositorySettings",
columns: table => new
{
Origin = table.Column<string>(nullable: true),
CommitterName = table.Column<string>(nullable: false),
CommitterEmail = table.Column<string>(nullable: false),
AccessUser = table.Column<string>(nullable: true),
AccessToken = table.Column<string>(nullable: true),
PushTestMergeCommits = table.Column<bool>(nullable: false),
AutoUpdateInterval = table.Column<int>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InstanceId = table.Column<long>(nullable: false),
RevisionInformationId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_RepositorySettings", x => x.Id);
table.ForeignKey(
name: "FK_RepositorySettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RepositorySettings_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "CompileJobs",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
StartedAt = table.Column<DateTimeOffset>(nullable: false),
FinishedAt = table.Column<DateTimeOffset>(nullable: false),
TargetedPrimaryDirectory = table.Column<bool>(nullable: true),
Output = table.Column<string>(nullable: true),
ExitCode = table.Column<int>(nullable: true),
TriggeredById = table.Column<long>(nullable: false),
RevisionInformationId = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CompileJobs", x => x.Id);
table.ForeignKey(
name: "FK_CompileJobs_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_CompileJobs_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CompileJobs_Users_TriggeredById",
column: x => x.TriggeredById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstanceUsers",
columns: table => new
{
ByondRights = table.Column<int>(nullable: false),
DreamDaemonRights = table.Column<int>(nullable: false),
DreamMakerRights = table.Column<int>(nullable: false),
RepositoryRights = table.Column<int>(nullable: false),
ChatSettingsRights = table.Column<int>(nullable: false),
ConfigurationRights = table.Column<int>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InstanceId = table.Column<long>(nullable: true),
UserId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_InstanceUsers", x => x.Id);
table.ForeignKey(
name: "FK_InstanceUsers_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_InstanceUsers_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "Jobs",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
Description = table.Column<string>(nullable: false),
StartedAt = table.Column<DateTimeOffset>(nullable: false),
StoppedAt = table.Column<DateTimeOffset>(nullable: false),
Cancelled = table.Column<bool>(nullable: false),
StartedById = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Jobs", x => x.Id);
table.ForeignKey(
name: "FK_Jobs_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Jobs_Users_StartedById",
column: x => x.StartedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "TestMerges",
columns: table => new
{
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
MergedAt = table.Column<DateTimeOffset>(nullable: false),
TitleAtMerge = table.Column<string>(nullable: false),
BodyAtMerge = table.Column<string>(nullable: false),
Author = table.Column<string>(nullable: false),
MergedById = table.Column<long>(nullable: false),
InstanceId = table.Column<long>(nullable: true),
RevisionInformationId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_TestMerges", x => x.Id);
table.ForeignKey(
name: "FK_TestMerges_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_TestMerges_Users_MergedById",
column: x => x.MergedById,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_TestMerges_RevisionInformations_RevisionInformationId",
column: x => x.RevisionInformationId,
principalTable: "RevisionInformations",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "ChatChannels",
columns: table => new
{
IrcChannel = table.Column<string>(nullable: true),
DiscordChannelId = table.Column<long>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ChatSettingsId = table.Column<long>(nullable: true),
ChatSettingsId1 = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ChatChannels", x => x.Id);
table.ForeignKey(
name: "FK_ChatChannels_ChatSettings_ChatSettingsId",
column: x => x.ChatSettingsId,
principalTable: "ChatSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_ChatChannels_ChatSettings_ChatSettingsId1",
column: x => x.ChatSettingsId1,
principalTable: "ChatSettings",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateTable(
name: "DreamDaemonSettings",
columns: table => new
{
AutoStart = table.Column<bool>(nullable: false),
AllowWebClient = table.Column<bool>(nullable: false),
SoftRestart = table.Column<bool>(nullable: false),
SoftShutdown = table.Column<bool>(nullable: false),
SecurityLevel = table.Column<int>(nullable: false),
PrimaryPort = table.Column<ushort>(nullable: false),
SecondaryPort = table.Column<ushort>(nullable: false),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
ProcessId = table.Column<int>(nullable: true),
AccessToken = table.Column<string>(nullable: true),
InstanceId = table.Column<long>(nullable: false),
CompileJobId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DreamDaemonSettings", x => x.Id);
table.ForeignKey(
name: "FK_DreamDaemonSettings_CompileJobs_CompileJobId",
column: x => x.CompileJobId,
principalTable: "CompileJobs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DreamDaemonSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DreamMakerSettings",
columns: table => new
{
AutoCompileInterval = table.Column<int>(nullable: true),
TargetDme = table.Column<string>(nullable: true),
Id = table.Column<long>(nullable: false)
.Annotation("Sqlite:Autoincrement", true),
InstanceId = table.Column<long>(nullable: false),
CompileJobId = table.Column<long>(nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_DreamMakerSettings", x => x.Id);
table.ForeignKey(
name: "FK_DreamMakerSettings_CompileJobs_CompileJobId",
column: x => x.CompileJobId,
principalTable: "CompileJobs",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_DreamMakerSettings_Instances_InstanceId",
column: x => x.InstanceId,
principalTable: "Instances",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ChatChannels_ChatSettingsId",
table: "ChatChannels",
column: "ChatSettingsId");
migrationBuilder.CreateIndex(
name: "IX_ChatChannels_ChatSettingsId1",
table: "ChatChannels",
column: "ChatSettingsId1");
migrationBuilder.CreateIndex(
name: "IX_ChatSettings_InstanceId",
table: "ChatSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_InstanceId",
table: "CompileJobs",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_RevisionInformationId",
table: "CompileJobs",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_CompileJobs_TriggeredById",
table: "CompileJobs",
column: "TriggeredById");
migrationBuilder.CreateIndex(
name: "IX_DreamDaemonSettings_CompileJobId",
table: "DreamDaemonSettings",
column: "CompileJobId");
migrationBuilder.CreateIndex(
name: "IX_DreamDaemonSettings_InstanceId",
table: "DreamDaemonSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_DreamMakerSettings_CompileJobId",
table: "DreamMakerSettings",
column: "CompileJobId");
migrationBuilder.CreateIndex(
name: "IX_DreamMakerSettings_InstanceId",
table: "DreamMakerSettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_InstanceUsers_InstanceId",
table: "InstanceUsers",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_InstanceUsers_UserId",
table: "InstanceUsers",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_InstanceId",
table: "Jobs",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_Jobs_StartedById",
table: "Jobs",
column: "StartedById");
migrationBuilder.CreateIndex(
name: "IX_RepositorySettings_InstanceId",
table: "RepositorySettings",
column: "InstanceId",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_RepositorySettings_RevisionInformationId",
table: "RepositorySettings",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_RevisionInformations_Revision",
table: "RevisionInformations",
column: "Revision",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TestMerges_InstanceId",
table: "TestMerges",
column: "InstanceId");
migrationBuilder.CreateIndex(
name: "IX_TestMerges_MergedById",
table: "TestMerges",
column: "MergedById");
migrationBuilder.CreateIndex(
name: "IX_TestMerges_RevisionInformationId",
table: "TestMerges",
column: "RevisionInformationId");
migrationBuilder.CreateIndex(
name: "IX_Users_SystemIdentifier",
table: "Users",
column: "SystemIdentifier",
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ChatChannels");
migrationBuilder.DropTable(
name: "DreamDaemonSettings");
migrationBuilder.DropTable(
name: "DreamMakerSettings");
migrationBuilder.DropTable(
name: "InstanceUsers");
migrationBuilder.DropTable(
name: "Jobs");
migrationBuilder.DropTable(
name: "Logs");
migrationBuilder.DropTable(
name: "RepositorySettings");
migrationBuilder.DropTable(
name: "ServerSettings");
migrationBuilder.DropTable(
name: "TestMerges");
migrationBuilder.DropTable(
name: "ChatSettings");
migrationBuilder.DropTable(
name: "CompileJobs");
migrationBuilder.DropTable(
name: "Instances");
migrationBuilder.DropTable(
name: "RevisionInformations");
migrationBuilder.DropTable(
name: "Users");
}
}
}
@@ -1,509 +0,0 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Microsoft.EntityFrameworkCore.Migrations;
using Tgstation.Server.Host.Models;
namespace Tgstation.Server.Host.Models.Migrations.Sqlite
{
[DbContext(typeof(SqliteDatabaseContext))]
partial class SqliteDatabaseContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.1.0-preview2-30571");
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<long?>("ChatSettingsId");
b.Property<long?>("ChatSettingsId1");
b.Property<long>("DiscordChannelId");
b.Property<string>("IrcChannel");
b.HasKey("Id");
b.HasIndex("ChatSettingsId");
b.HasIndex("ChatSettingsId1");
b.ToTable("ChatChannels");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("DiscordBotToken");
b.Property<bool>("DiscordEnabled");
b.Property<long>("InstanceId");
b.Property<bool>("IrcEnabled");
b.Property<string>("IrcHost")
.IsRequired();
b.Property<string>("IrcNickServPassword");
b.Property<ushort>("IrcPort");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("ChatSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("ExitCode");
b.Property<DateTimeOffset>("FinishedAt");
b.Property<long?>("InstanceId");
b.Property<string>("Output");
b.Property<long>("RevisionInformationId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<bool?>("TargetedPrimaryDirectory");
b.Property<long>("TriggeredById");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("RevisionInformationId");
b.HasIndex("TriggeredById");
b.ToTable("CompileJobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<bool>("AllowWebClient");
b.Property<bool>("AutoStart");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<ushort>("PrimaryPort");
b.Property<int?>("ProcessId");
b.Property<ushort>("SecondaryPort");
b.Property<int>("SecurityLevel");
b.Property<bool>("SoftRestart");
b.Property<bool>("SoftShutdown");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamDaemonSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int?>("AutoCompileInterval");
b.Property<long?>("CompileJobId");
b.Property<long>("InstanceId");
b.Property<string>("TargetDme");
b.HasKey("Id");
b.HasIndex("CompileJobId");
b.HasIndex("InstanceId")
.IsUnique();
b.ToTable("DreamMakerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("ConfigurationAllowed");
b.Property<string>("Name")
.IsRequired();
b.Property<bool>("Online");
b.Property<string>("Path")
.IsRequired();
b.HasKey("Id");
b.ToTable("Instances");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("ByondRights");
b.Property<int>("ChatSettingsRights");
b.Property<int>("ConfigurationRights");
b.Property<int>("DreamDaemonRights");
b.Property<int>("DreamMakerRights");
b.Property<long?>("InstanceId");
b.Property<int>("RepositoryRights");
b.Property<long?>("UserId");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("UserId");
b.ToTable("InstanceUsers");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("Cancelled");
b.Property<string>("Description")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<DateTimeOffset>("StartedAt");
b.Property<long>("StartedById");
b.Property<DateTimeOffset>("StoppedAt");
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("StartedById");
b.ToTable("Jobs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("AccessToken");
b.Property<string>("AccessUser");
b.Property<int?>("AutoUpdateInterval");
b.Property<string>("CommitterEmail")
.IsRequired();
b.Property<string>("CommitterName")
.IsRequired();
b.Property<long>("InstanceId");
b.Property<string>("Origin");
b.Property<bool>("PushTestMergeCommits");
b.Property<long?>("RevisionInformationId");
b.HasKey("Id");
b.HasIndex("InstanceId")
.IsUnique();
b.HasIndex("RevisionInformationId");
b.ToTable("RepositorySettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("OriginRevision")
.IsRequired()
.HasMaxLength(40);
b.Property<string>("Revision")
.IsRequired()
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("Revision")
.IsUnique();
b.ToTable("RevisionInformations");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<bool>("EnableTelemetry");
b.Property<string>("SystemAuthenticationGroup");
b.Property<string>("UpstreamRepository");
b.HasKey("Id");
b.ToTable("ServerSettings");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("Author")
.IsRequired();
b.Property<string>("BodyAtMerge")
.IsRequired();
b.Property<long?>("InstanceId");
b.Property<DateTimeOffset>("MergedAt");
b.Property<long>("MergedById");
b.Property<long?>("RevisionInformationId");
b.Property<string>("TitleAtMerge")
.IsRequired();
b.HasKey("Id");
b.HasIndex("InstanceId");
b.HasIndex("MergedById");
b.HasIndex("RevisionInformationId");
b.ToTable("TestMerges");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.User", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AdministrationRights");
b.Property<DateTimeOffset>("CreatedAt");
b.Property<int>("InstanceManagerRights");
b.Property<string>("Name")
.IsRequired();
b.Property<string>("PasswordHash");
b.Property<string>("SystemIdentifier");
b.Property<string>("TokenSecret")
.HasMaxLength(40);
b.HasKey("Id");
b.HasIndex("SystemIdentifier")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("EventId");
b.Property<int>("Level");
b.Property<string>("Message");
b.Property<string>("Name")
.HasMaxLength(255);
b.Property<DateTimeOffset>("TimeStamp");
b.HasKey("Id");
b.ToTable("Logs");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatChannel", b =>
{
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("AdminChannels")
.HasForeignKey("ChatSettingsId");
b.HasOne("Tgstation.Server.Host.Models.ChatSettings")
.WithMany("GeneralChannels")
.HasForeignKey("ChatSettingsId1");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("ChatSettings")
.HasForeignKey("Tgstation.Server.Host.Models.ChatSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("CompileJobs")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "TriggeredBy")
.WithMany()
.HasForeignKey("TriggeredById")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamDaemonSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamDaemonSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamDaemonSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b =>
{
b.HasOne("Tgstation.Server.Host.Models.CompileJob", "CompileJob")
.WithMany()
.HasForeignKey("CompileJobId");
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithOne("DreamMakerSettings")
.HasForeignKey("Tgstation.Server.Host.Models.DreamMakerSettings", "InstanceId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("InstanceUsers")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User")
.WithMany("InstanceUsers")
.HasForeignKey("UserId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance", "Instance")
.WithMany("Jobs")
.HasForeignKey("InstanceId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.User", "StartedBy")
.WithMany()
.HasForeignKey("StartedById")
.OnDelete(DeleteBehavior.Cascade);
});
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);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation", "RevisionInformation")
.WithMany()
.HasForeignKey("RevisionInformationId");
});
modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b =>
{
b.HasOne("Tgstation.Server.Host.Models.Instance")
.WithMany("TestMerges")
.HasForeignKey("InstanceId");
b.HasOne("Tgstation.Server.Host.Models.User", "MergedBy")
.WithMany()
.HasForeignKey("MergedById")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("Tgstation.Server.Host.Models.RevisionInformation")
.WithMany("TestMerges")
.HasForeignKey("RevisionInformationId");
});
#pragma warning restore 612, 618
}
}
}
@@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Models
{
/// <summary>
/// <see cref="DatabaseContext"/> for MySQL
/// <see cref="DatabaseContext{TParentContext}"/> for MySQL
/// </summary>
sealed class MySqlDatabaseContext : DatabaseContext<MySqlDatabaseContext>
{
/// <summary>
/// Construct a <see cref="MySqlDatabaseContext"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext"/></param>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
public MySqlDatabaseContext(DbContextOptions<MySqlDatabaseContext> dbContextOptions, IOptions<DatabaseConfiguration> databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder)
{ }
@@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Models
{
/// <summary>
/// <see cref="DatabaseContext"/> for Sqlserver
/// <see cref="DatabaseContext{TParentContext}"/> for Sqlserver
/// </summary>
sealed class SqlServerDatabaseContext : DatabaseContext<SqlServerDatabaseContext>
{
/// <summary>
/// Construct a <see cref="SqlServerDatabaseContext"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext"/></param>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
public SqlServerDatabaseContext(DbContextOptions<SqlServerDatabaseContext> dbContextOptions, IOptions<DatabaseConfiguration> databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder)
{ }
@@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Models
{
/// <summary>
/// <see cref="DatabaseContext"/> for Sqlite
/// <see cref="DatabaseContext{TParentContext}"/> for Sqlite
/// </summary>
sealed class SqliteDatabaseContext : DatabaseContext<SqliteDatabaseContext>
{
/// <summary>
/// Construct a <see cref="SqliteDatabaseContext"/>
/// </summary>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext"/></param>
/// <param name="dbContextOptions">The <see cref="DbContextOptions{TContext}"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseConfiguration">The <see cref="IOptions{TOptions}"/> of <see cref="DatabaseConfiguration"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="loggerFactory">The <see cref="ILoggerFactory"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
/// <param name="databaseSeeder">The <see cref="IDatabaseSeeder"/> for the <see cref="DatabaseContext{TParentContext}"/></param>
public SqliteDatabaseContext(DbContextOptions<SqliteDatabaseContext> dbContextOptions, IOptions<DatabaseConfiguration> databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder)
{ }
+4 -1
View File
@@ -9,10 +9,13 @@ namespace Tgstation.Server.Host.Models
/// </summary>
sealed class User : Api.Models.Internal.User
{
/// <summary>
/// The hash of the user's password
/// </summary>
public string PasswordHash { get; set; }
/// <summary>
/// The value used for the <see cref="SymmetricSecurityKey"/> to encrypt JWTs
/// The value used to encrypt JWTs
/// </summary>
[StringLength(CryptographySuite.SecureStringLength)]
public string TokenSecret { get; set; }