diff --git a/src/Tgstation.Server.Api/Models/Administration.cs b/src/Tgstation.Server.Api/Models/Administration.cs index 374d82a178..7f04e2d428 100644 --- a/src/Tgstation.Server.Api/Models/Administration.cs +++ b/src/Tgstation.Server.Api/Models/Administration.cs @@ -4,9 +4,7 @@ using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Api.Models { - /// - /// Metadata about an installation - /// + /// public sealed class Administration : Internal.ServerSettings { /// @@ -28,7 +26,7 @@ namespace Tgstation.Server.Api.Models public Version CurrentVersion { get; set; } /// - /// Users in the + /// Users in the /// [Permissions(DenyWrite = true)] public IReadOnlyList Users { get; set; } diff --git a/src/Tgstation.Server.Api/Models/CompileJob.cs b/src/Tgstation.Server.Api/Models/CompileJob.cs index 4478dde763..2cc0f74988 100644 --- a/src/Tgstation.Server.Api/Models/CompileJob.cs +++ b/src/Tgstation.Server.Api/Models/CompileJob.cs @@ -1,5 +1,6 @@ namespace Tgstation.Server.Api.Models { + /// public sealed class CompileJob : Internal.CompileJob { /// diff --git a/src/Tgstation.Server.Api/Models/DreamDaemon.cs b/src/Tgstation.Server.Api/Models/DreamDaemon.cs index 2c48828bbf..49571a3fa3 100644 --- a/src/Tgstation.Server.Api/Models/DreamDaemon.cs +++ b/src/Tgstation.Server.Api/Models/DreamDaemon.cs @@ -6,7 +6,6 @@ namespace Tgstation.Server.Api.Models /// /// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server /// - [Model(RightsType.DreamDaemon, CanCrud = true, RequiresInstance = true)] public sealed class DreamDaemon : DreamDaemonSettings { /// @@ -21,8 +20,11 @@ namespace Tgstation.Server.Api.Models [Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadMetadata)] public DreamDaemonStatus? Status { get; set; } + /// + /// The current of + /// [Permissions(DenyWrite = true, ReadRight = DreamDaemonRights.ReadMetadata)] - public DreamDaemonSecurity? CurrentSecurityLevel { get; set; } + public DreamDaemonSecurity? CurrentSecurity { get; set; } /// /// The port the running instance is set to diff --git a/src/Tgstation.Server.Api/Models/DreamDaemonSecurity.cs b/src/Tgstation.Server.Api/Models/DreamDaemonSecurity.cs index fef6a8f20c..094332d1e4 100644 --- a/src/Tgstation.Server.Api/Models/DreamDaemonSecurity.cs +++ b/src/Tgstation.Server.Api/Models/DreamDaemonSecurity.cs @@ -8,7 +8,7 @@ /// /// Server is unrestricted in terms of file access and shell commands /// - Trusted = 0, + Trusted, /// /// Server will not be able to run shell commands or access files outside it's working directory /// diff --git a/src/Tgstation.Server.Api/Models/DreamMaker.cs b/src/Tgstation.Server.Api/Models/DreamMaker.cs index 6864a7e4aa..de1d893846 100644 --- a/src/Tgstation.Server.Api/Models/DreamMaker.cs +++ b/src/Tgstation.Server.Api/Models/DreamMaker.cs @@ -6,12 +6,12 @@ namespace Tgstation.Server.Api.Models /// /// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile /// - [Model(RightsType.DreamMaker, ReadRight = DreamMakerRights.Read, CanCrud = true, RequiresInstance = true)] public sealed class DreamMaker : DreamMakerSettings { /// /// The last ran /// + [Permissions(DenyWrite = true)] public CompileJob LastJob { get; set; } /// diff --git a/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs index b9af1662d6..9fccf5e173 100644 --- a/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs +++ b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs @@ -3,6 +3,9 @@ using System.ComponentModel.DataAnnotations; namespace Tgstation.Server.Api.Models.Internal { + /// + /// Represents a run of + /// public class CompileJob { /// diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs index 610d6b59a1..6b0520c59e 100644 --- a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs @@ -2,6 +2,10 @@ namespace Tgstation.Server.Api.Models.Internal { + /// + /// Configurable settings for + /// + [Model(RightsType.DreamDaemon, CanCrud = true, RequiresInstance = true)] public class DreamDaemonSettings { /// diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs b/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs index f1c826ec03..8d31ef3ef0 100644 --- a/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs @@ -2,6 +2,10 @@ namespace Tgstation.Server.Api.Models.Internal { + /// + /// Configurable settings for + /// + [Model(RightsType.DreamMaker, ReadRight = DreamMakerRights.Read, CanCrud = true, RequiresInstance = true)] public class DreamMakerSettings { /// diff --git a/src/Tgstation.Server.Api/Models/Internal/Job.cs b/src/Tgstation.Server.Api/Models/Internal/Job.cs index 0effd5cbfc..a3f38d806d 100644 --- a/src/Tgstation.Server.Api/Models/Internal/Job.cs +++ b/src/Tgstation.Server.Api/Models/Internal/Job.cs @@ -3,33 +3,42 @@ using System.ComponentModel.DataAnnotations; namespace Tgstation.Server.Api.Models.Internal { + /// + /// Represents a long running job + /// + [Model] public class Job { /// /// The ID /// + [Permissions(DenyWrite = true)] public long Id { get; set; } /// - /// Human readable description of the + /// English description of the /// + [Permissions(DenyWrite = true)] [Required] public string Description { get; set; } /// /// When the was started /// + [Permissions(DenyWrite = true)] [Required] public DateTimeOffset StartedAt { get; set; } /// /// When the stopped /// + [Permissions(DenyWrite = true)] public DateTimeOffset StoppedAt { get; set; } /// /// If the was cancelled /// + [Permissions(DenyWrite = true)] public bool Cancelled { get; set; } } } \ No newline at end of file diff --git a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs index 1d50db143c..11917d2f81 100644 --- a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs @@ -3,14 +3,12 @@ using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Api.Models.Internal { + /// + /// Represents configurable settings for a + /// + [Model(RightsType.Repository, ReadRight = RepositoryRights.Read, RequiresInstance = true)] public class RepositorySettings { - /// - /// The origin URL. If , the does not exist - /// - [Permissions(WriteRight = RepositoryRights.SetOrigin)] - public string Origin { get; set; } - /// /// The name of the committer /// diff --git a/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs b/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs index 5914d3d962..44eb907a89 100644 --- a/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs +++ b/src/Tgstation.Server.Api/Models/Internal/RevisionInformation.cs @@ -2,11 +2,22 @@ namespace Tgstation.Server.Api.Models.Internal { + /// + /// Represents information about a current git revison + /// public class RevisionInformation { + /// + /// The revision sha + /// + [Permissions(DenyWrite = true)] [Required, StringLength(40)] public string Revision { get; set; } + /// + /// The sha of the most recent remote commit + /// + [Permissions(DenyWrite = true)] [Required, StringLength(40)] public string OriginRevision { get; set; } } diff --git a/src/Tgstation.Server.Api/Models/Internal/ServerSettings.cs b/src/Tgstation.Server.Api/Models/Internal/ServerSettings.cs index 9a46e42237..f044801219 100644 --- a/src/Tgstation.Server.Api/Models/Internal/ServerSettings.cs +++ b/src/Tgstation.Server.Api/Models/Internal/ServerSettings.cs @@ -2,6 +2,9 @@ namespace Tgstation.Server.Api.Models.Internal { + /// + /// Metadata about an installation + /// [Model(RightsType.Administration)] public class ServerSettings { diff --git a/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs b/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs index 9db2ffcb83..9e1d04f64d 100644 --- a/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs +++ b/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs @@ -3,19 +3,37 @@ using System.ComponentModel.DataAnnotations; namespace Tgstation.Server.Api.Models.Internal { - public class TestMerge + /// + /// Represents a merge of a GitHub pull request + /// + public class TestMerge : TestMergeParameters { + /// + /// The ID of the + /// public long Id { get; set; } + /// + /// When the was created + /// [Required] public DateTimeOffset MergedAt { get; set; } + /// + /// The title of the pull request + /// [Required] public string TitleAtMerge { get; set; } + /// + /// The body of the pull request + /// [Required] public string BodyAtMerge { get; set; } + /// + /// The author of the pull request + /// [Required] public string Author { get; set; } } diff --git a/src/Tgstation.Server.Api/Models/Internal/User.cs b/src/Tgstation.Server.Api/Models/Internal/User.cs index 0368a0d1b9..2a62da30b2 100644 --- a/src/Tgstation.Server.Api/Models/Internal/User.cs +++ b/src/Tgstation.Server.Api/Models/Internal/User.cs @@ -7,7 +7,7 @@ namespace Tgstation.Server.Api.Models.Internal /// /// Represents a server /// - [Model(RightsType.Administration, WriteRight = AdministrationRights.EditUsers)] + [Model(RightsType.Administration, WriteRight = AdministrationRights.EditUsers, CanCrud = true)] public class User { /// @@ -16,6 +16,9 @@ namespace Tgstation.Server.Api.Models.Internal [Permissions(DenyWrite = true)] public long Id { get; set; } + /// + /// When the was created + /// [Permissions(DenyWrite = true)] [Required] public DateTimeOffset CreatedAt { get; set; } diff --git a/src/Tgstation.Server.Api/Models/Job.cs b/src/Tgstation.Server.Api/Models/Job.cs index 959d546962..ebbf23bb21 100644 --- a/src/Tgstation.Server.Api/Models/Job.cs +++ b/src/Tgstation.Server.Api/Models/Job.cs @@ -3,19 +3,24 @@ /// /// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job /// - [Model] public sealed class Job : Internal.Job { /// /// If the has incremental progress, this will range from 1 - 100. 0 otherwise /// + [Permissions(DenyWrite = true)] public int Progress { get; set; } /// /// If the current user has permission to cancel the job /// + [Permissions(DenyWrite = true)] public bool UserCanCancel { get; set; } + /// + /// The that started the job + /// + [Permissions(DenyWrite = true)] public User StartedBy { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/Repository.cs b/src/Tgstation.Server.Api/Models/Repository.cs index fbc279d226..96ca42c58c 100644 --- a/src/Tgstation.Server.Api/Models/Repository.cs +++ b/src/Tgstation.Server.Api/Models/Repository.cs @@ -6,15 +6,23 @@ namespace Tgstation.Server.Api.Models /// /// Represents a git repository /// - [Model(RightsType.Repository, ReadRight = RepositoryRights.Read, RequiresInstance = true)] public sealed class Repository : Internal.RepositorySettings { + /// + /// The origin URL. If , the does not exist + /// + [Permissions(WriteRight = RepositoryRights.SetOrigin)] + public string Origin { get; set; } + /// /// The commit HEAD points to /// [Permissions(WriteRight = RepositoryRights.SetSha)] public string NewRevision { get; set; } + /// + /// The current for the + /// [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; } + /// + /// for new s + /// [Permissions(WriteRight = RepositoryRights.MergePullRequest)] public List NewTestMerges { get; set; } } diff --git a/src/Tgstation.Server.Api/Models/RevisionInformation.cs b/src/Tgstation.Server.Api/Models/RevisionInformation.cs index 14f5fffa0a..0c769f02e7 100644 --- a/src/Tgstation.Server.Api/Models/RevisionInformation.cs +++ b/src/Tgstation.Server.Api/Models/RevisionInformation.cs @@ -2,8 +2,12 @@ namespace Tgstation.Server.Api.Models { + /// public sealed class RevisionInformation : Internal.RevisionInformation - { + { + /// + /// The s active in the + /// public List TestMerges { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/TestMerge.cs b/src/Tgstation.Server.Api/Models/TestMerge.cs index 706b0b58a8..d448504e2d 100644 --- a/src/Tgstation.Server.Api/Models/TestMerge.cs +++ b/src/Tgstation.Server.Api/Models/TestMerge.cs @@ -1,7 +1,11 @@ namespace Tgstation.Server.Api.Models { + /// public sealed class TestMerge : Internal.TestMerge { + /// + /// The who created the + /// public User MergedBy { get; set; } } } \ No newline at end of file diff --git a/src/Tgstation.Server.Api/Models/TestMergeParameters.cs b/src/Tgstation.Server.Api/Models/TestMergeParameters.cs index 06d5f7ebaf..2c3ba33f02 100644 --- a/src/Tgstation.Server.Api/Models/TestMergeParameters.cs +++ b/src/Tgstation.Server.Api/Models/TestMergeParameters.cs @@ -2,10 +2,19 @@ namespace Tgstation.Server.Api.Models { + /// + /// Parameters for creating a + /// public class TestMergeParameters { + /// + /// The number of the pull request + /// public int Number { get; set; } + /// + /// The sha of the pull request revision to merge + /// [Required] public string PullRequestRevision { get; set; } } diff --git a/src/Tgstation.Server.Api/Models/Token.cs b/src/Tgstation.Server.Api/Models/Token.cs index 6e806cf9a6..5f75d2ff03 100644 --- a/src/Tgstation.Server.Api/Models/Token.cs +++ b/src/Tgstation.Server.Api/Models/Token.cs @@ -1,8 +1,13 @@ namespace Tgstation.Server.Api.Models { - /// + /// + /// Represents a JWT returned by the API + /// public sealed class Token { + /// + /// The value of the JWT + /// public string Value { get; set; } } } diff --git a/src/Tgstation.Server.Api/Models/User.cs b/src/Tgstation.Server.Api/Models/User.cs index bb8c604138..78bdb3e934 100644 --- a/src/Tgstation.Server.Api/Models/User.cs +++ b/src/Tgstation.Server.Api/Models/User.cs @@ -1,10 +1,11 @@ namespace Tgstation.Server.Api.Models { - /// - /// Represents a server - /// + /// public sealed class User : Internal.User { + /// + /// If the is enabled since users cannot be deleted + /// [Permissions(DenyWrite = true)] public bool Enabled { get; set; } } diff --git a/src/Tgstation.Server.Api/Rights/AdministrationRights.cs b/src/Tgstation.Server.Api/Rights/AdministrationRights.cs index c27ae958c9..bc7d302397 100644 --- a/src/Tgstation.Server.Api/Rights/AdministrationRights.cs +++ b/src/Tgstation.Server.Api/Rights/AdministrationRights.cs @@ -17,7 +17,7 @@ namespace Tgstation.Server.Api.Rights /// ChangeAuthenticationGroup = 1, /// - /// User can change + /// User can change /// ChangeTelemetry = 2, /// @@ -33,7 +33,7 @@ namespace Tgstation.Server.Api.Rights /// ChangeVersion = 16, /// - /// User can change + /// User can change /// SetUpstreamRepository = 32 } diff --git a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs index 51591eb334..f99f63cd58 100644 --- a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs +++ b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs @@ -13,7 +13,7 @@ namespace Tgstation.Server.Api.Rights /// None = 0, /// - /// User can read , , and + /// User can read /// ReadRevision = 1, /// @@ -21,27 +21,27 @@ namespace Tgstation.Server.Api.Rights /// SetPorts = 2, /// - /// User can change + /// User can change /// SetAutoStart = 4, /// - /// User set + /// User set /// SetSecurity = 8, /// - /// User can read all ports, , , , , and + /// User can read all ports, , , , , and /// ReadMetadata = 16, /// - /// User can change + /// User can change /// SetWebClient = 32, /// - /// User can enable + /// User can enable /// SoftRestart = 64, /// - /// User can enable + /// User can enable /// SoftShutdown = 128, /// @@ -53,7 +53,7 @@ namespace Tgstation.Server.Api.Rights /// Shutdown = 512, /// - /// User can start and disable and + /// User can start and disable and /// Start = 1024 } diff --git a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs index f770f8c01e..809816dbf9 100644 --- a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs +++ b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs @@ -25,11 +25,11 @@ namespace Tgstation.Server.Api.Rights /// CancelCompile = 4, /// - /// User may modify + /// User may modify /// SetAutoCompile = 8, /// - /// User may modify + /// User may modify /// SetDme = 16 } diff --git a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs index 80339d9d7f..c418507036 100644 --- a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs +++ b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs @@ -29,19 +29,19 @@ namespace Tgstation.Server.Api.Rights /// UpdateBranch = 16, /// - /// User may change and + /// User may change and /// ChangeCommitter = 32, /// - /// User may change + /// User may change /// ChangeTestMergeCommits = 64, /// - /// User may change + /// User may change /// ChangeAutoUpdate = 128, /// - /// User may read and change and + /// User may read and change and /// ChangeCredentials = 256, /// @@ -49,7 +49,7 @@ namespace Tgstation.Server.Api.Rights /// SetReference = 512, /// - /// User may read all fields in the with the exception of + /// User may read all fields in the with the exception of /// Read = 1024, } diff --git a/src/Tgstation.Server.Client/Components/IDreamDaemonClient.cs b/src/Tgstation.Server.Client/Components/IDreamDaemonClient.cs index 228055c9c2..1947c4170d 100644 --- a/src/Tgstation.Server.Client/Components/IDreamDaemonClient.cs +++ b/src/Tgstation.Server.Client/Components/IDreamDaemonClient.cs @@ -32,7 +32,7 @@ namespace Tgstation.Server.Client.Components Task Shutdown(CancellationToken cancellationToken); /// - /// Update . This may trigger + /// Update . This may trigger /// /// The to update /// The for the operation diff --git a/src/Tgstation.Server.Host.Startup/IServer.cs b/src/Tgstation.Server.Host.Startup/IServer.cs index 28a2428211..299e193036 100644 --- a/src/Tgstation.Server.Host.Startup/IServer.cs +++ b/src/Tgstation.Server.Host.Startup/IServer.cs @@ -10,7 +10,7 @@ namespace Tgstation.Server.Host.Startup public interface IServer { /// - /// The path to the updated assembly to run if any. Populated once returns + /// The path to the updated assembly to run if any. Populated once returns /// string UpdatePath { get; } diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index b70e80286b..9f8f436f50 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -55,7 +55,6 @@ namespace Tgstation.Server.Host.Core services.AddMvc(); services.AddOptions(); - services.AddLocalization(); var databaseConfiguration = databaseConfigurationSection.Get(); 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 - { - 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()) diff --git a/src/Tgstation.Server.Host/Core/AuthenticationContext.cs b/src/Tgstation.Server.Host/Core/AuthenticationContext.cs index aa8235f1b8..9ba9cd4867 100644 --- a/src/Tgstation.Server.Host/Core/AuthenticationContext.cs +++ b/src/Tgstation.Server.Host/Core/AuthenticationContext.cs @@ -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 /// /// Construct a /// - /// The value of + /// The value of /// The value of public AuthenticationContext(ISystemIdentity systemIdentity, IDatabaseContext databaseContext) { - SystemIdentity = systemIdentity ?? throw new ArgumentNullException(nameof(systemIdentity)); this.databaseContext = databaseContext ?? throw new ArgumentNullException(nameof(databaseContext)); + SystemIdentity = systemIdentity; } /// diff --git a/src/Tgstation.Server.Host/Models/DatabaseContext.cs b/src/Tgstation.Server.Host/Models/DatabaseContext.cs index 9651b6b2db..a429bf65eb 100644 --- a/src/Tgstation.Server.Host/Models/DatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/DatabaseContext.cs @@ -38,27 +38,27 @@ namespace Tgstation.Server.Host.Models public DbSet RepositorySettings { get; set; } /// - /// The connection string for the + /// The connection string for the /// protected string ConnectionString => databaseConfiguration.ConnectionString; /// - /// The for the + /// The for the /// readonly DatabaseConfiguration databaseConfiguration; /// - /// The for the + /// The for the /// readonly ILoggerFactory loggerFactory; /// - /// The for the + /// The for the /// readonly IDatabaseSeeder databaseSeeder; /// - /// Construct a + /// Construct a /// - /// The for the + /// The for the /// The containing the value of /// The value of /// The value of @@ -79,7 +79,7 @@ namespace Tgstation.Server.Host.Models modelBuilder.Entity().ToTable(nameof(Logs)); modelBuilder.Entity().HasIndex(x => x.Revision).IsUnique(); - modelBuilder.Entity().HasIndex(x => x.SystemIdentifier).IsUnique(); + modelBuilder.Entity().HasIndex(x => new { x.Name, x.SystemIdentifier }).IsUnique(); } /// @@ -105,9 +105,13 @@ namespace Tgstation.Server.Host.Models /// 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); } diff --git a/src/Tgstation.Server.Host/Models/DatabaseSeeder.cs b/src/Tgstation.Server.Host/Models/DatabaseSeeder.cs index 278692554e..6a2cd85c0d 100644 --- a/src/Tgstation.Server.Host/Models/DatabaseSeeder.cs +++ b/src/Tgstation.Server.Host/Models/DatabaseSeeder.cs @@ -20,7 +20,7 @@ namespace Tgstation.Server.Host.Models const string DefaultUpstreamRepository = "https://github.com/tgstation/tgstation-server"; /// - /// The for the + /// The for the /// readonly ICryptographySuite cryptographySuite; diff --git a/src/Tgstation.Server.Host/Models/Migrations/DesignTimeDbContextFactoryHelpers.cs b/src/Tgstation.Server.Host/Models/Migrations/DesignTimeDbContextFactoryHelpers.cs index 9c1da8c24e..c633cc1ec4 100644 --- a/src/Tgstation.Server.Host/Models/Migrations/DesignTimeDbContextFactoryHelpers.cs +++ b/src/Tgstation.Server.Host/Models/Migrations/DesignTimeDbContextFactoryHelpers.cs @@ -7,7 +7,7 @@ using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Models.Migrations { /// - /// Contains helpers for creating design time s + /// Contains helpers for creating design time s /// static class DesignTimeDbContextFactoryHelpers { diff --git a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.Designer.cs b/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.Designer.cs deleted file mode 100644 index 44d5df743e..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.Designer.cs +++ /dev/null @@ -1,512 +0,0 @@ -// -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("Id") - .ValueGeneratedOnAdd(); - - b.Property("ChatSettingsId"); - - b.Property("ChatSettingsId1"); - - b.Property("DiscordChannelId"); - - b.Property("IrcChannel"); - - b.HasKey("Id"); - - b.HasIndex("ChatSettingsId"); - - b.HasIndex("ChatSettingsId1"); - - b.ToTable("ChatChannels"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("DiscordBotToken"); - - b.Property("DiscordEnabled"); - - b.Property("InstanceId"); - - b.Property("IrcEnabled"); - - b.Property("IrcHost") - .IsRequired(); - - b.Property("IrcNickServPassword"); - - b.Property("IrcPort"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("ChatSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ExitCode"); - - b.Property("FinishedAt"); - - b.Property("InstanceId"); - - b.Property("Output"); - - b.Property("RevisionInformationId"); - - b.Property("StartedAt"); - - b.Property("TargetedPrimaryDirectory"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AllowWebClient"); - - b.Property("AutoStart"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("PrimaryPort"); - - b.Property("ProcessId"); - - b.Property("SecondaryPort"); - - b.Property("SecurityLevel"); - - b.Property("SoftRestart"); - - b.Property("SoftShutdown"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamDaemonSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AutoCompileInterval"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("TargetDme"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamMakerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConfigurationAllowed"); - - b.Property("Name") - .IsRequired(); - - b.Property("Online"); - - b.Property("Path") - .IsRequired(); - - b.HasKey("Id"); - - b.ToTable("Instances"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ByondRights"); - - b.Property("ChatSettingsRights"); - - b.Property("ConfigurationRights"); - - b.Property("DreamDaemonRights"); - - b.Property("DreamMakerRights"); - - b.Property("InstanceId"); - - b.Property("RepositoryRights"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("UserId"); - - b.ToTable("InstanceUsers"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Cancelled"); - - b.Property("Description") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("StartedAt"); - - b.Property("StartedById"); - - b.Property("StoppedAt"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("StartedById"); - - b.ToTable("Jobs"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AccessUser"); - - b.Property("AutoUpdateInterval"); - - b.Property("CommitterEmail") - .IsRequired(); - - b.Property("CommitterName") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("Origin"); - - b.Property("PushTestMergeCommits"); - - b.Property("RevisionInformationId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.HasIndex("RevisionInformationId"); - - b.ToTable("RepositorySettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("OriginRevision") - .IsRequired() - .HasMaxLength(40); - - b.Property("Revision") - .IsRequired() - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("Revision") - .IsUnique(); - - b.ToTable("RevisionInformations"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EnableTelemetry"); - - b.Property("SystemAuthenticationGroup"); - - b.Property("UpstreamRepository"); - - b.HasKey("Id"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Author") - .IsRequired(); - - b.Property("BodyAtMerge") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("MergedAt"); - - b.Property("MergedById"); - - b.Property("RevisionInformationId"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AdministrationRights"); - - b.Property("CreatedAt"); - - b.Property("InstanceManagerRights"); - - b.Property("Name") - .IsRequired(); - - b.Property("PasswordHash"); - - b.Property("SystemIdentifier"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("EventId"); - - b.Property("Level"); - - b.Property("Message"); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("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 - } - } -} diff --git a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.cs b/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.cs deleted file mode 100644 index 0a9656c3c1..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/20180410203936_InitialCreate.cs +++ /dev/null @@ -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(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Name = table.Column(nullable: false), - Path = table.Column(nullable: false), - Online = table.Column(nullable: false), - ConfigurationAllowed = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Instances", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Logs", - columns: table => new - { - EventId = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Level = table.Column(nullable: false), - Message = table.Column(nullable: true), - Name = table.Column(maxLength: 255, nullable: true), - TimeStamp = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "RevisionInformations", - columns: table => new - { - Revision = table.Column(maxLength: 40, nullable: false), - OriginRevision = table.Column(maxLength: 40, nullable: false), - Id = table.Column(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(nullable: true), - EnableTelemetry = table.Column(nullable: false), - UpstreamRepository = table.Column(nullable: true), - Id = table.Column(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(nullable: false), - CreatedAt = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - InstanceManagerRights = table.Column(nullable: false), - SystemIdentifier = table.Column(nullable: true), - Name = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - TokenSecret = table.Column(maxLength: 40, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ChatSettings", - columns: table => new - { - IrcEnabled = table.Column(nullable: false), - IrcHost = table.Column(nullable: false), - IrcPort = table.Column(nullable: false), - IrcNickServPassword = table.Column(nullable: true), - DiscordEnabled = table.Column(nullable: false), - DiscordBotToken = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - InstanceId = table.Column(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(nullable: true), - CommitterName = table.Column(nullable: false), - CommitterEmail = table.Column(nullable: false), - AccessUser = table.Column(nullable: true), - AccessToken = table.Column(nullable: true), - PushTestMergeCommits = table.Column(nullable: false), - AutoUpdateInterval = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - InstanceId = table.Column(nullable: false), - RevisionInformationId = table.Column(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(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - StartedAt = table.Column(nullable: false), - FinishedAt = table.Column(nullable: false), - TargetedPrimaryDirectory = table.Column(nullable: true), - Output = table.Column(nullable: true), - ExitCode = table.Column(nullable: true), - TriggeredById = table.Column(nullable: false), - RevisionInformationId = table.Column(nullable: false), - InstanceId = table.Column(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(nullable: false), - DreamDaemonRights = table.Column(nullable: false), - DreamMakerRights = table.Column(nullable: false), - RepositoryRights = table.Column(nullable: false), - ChatSettingsRights = table.Column(nullable: false), - ConfigurationRights = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - InstanceId = table.Column(nullable: true), - UserId = table.Column(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(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - Description = table.Column(nullable: false), - StartedAt = table.Column(nullable: false), - StoppedAt = table.Column(nullable: false), - Cancelled = table.Column(nullable: false), - StartedById = table.Column(nullable: false), - InstanceId = table.Column(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(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - MergedAt = table.Column(nullable: false), - TitleAtMerge = table.Column(nullable: false), - BodyAtMerge = table.Column(nullable: false), - Author = table.Column(nullable: false), - MergedById = table.Column(nullable: false), - InstanceId = table.Column(nullable: true), - RevisionInformationId = table.Column(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(nullable: true), - DiscordChannelId = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - ChatSettingsId = table.Column(nullable: true), - ChatSettingsId1 = table.Column(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(nullable: false), - AllowWebClient = table.Column(nullable: false), - SoftRestart = table.Column(nullable: false), - SoftShutdown = table.Column(nullable: false), - SecurityLevel = table.Column(nullable: false), - PrimaryPort = table.Column(nullable: false), - SecondaryPort = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - ProcessId = table.Column(nullable: true), - AccessToken = table.Column(nullable: true), - InstanceId = table.Column(nullable: false), - CompileJobId = table.Column(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(nullable: true), - TargetDme = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn), - InstanceId = table.Column(nullable: false), - CompileJobId = table.Column(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"); - } - } -} diff --git a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs b/src/Tgstation.Server.Host/Models/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs deleted file mode 100644 index 46332b16f3..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/SqlServer/SqlServerDatabaseContextModelSnapshot.cs +++ /dev/null @@ -1,511 +0,0 @@ -// -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("Id") - .ValueGeneratedOnAdd(); - - b.Property("ChatSettingsId"); - - b.Property("ChatSettingsId1"); - - b.Property("DiscordChannelId"); - - b.Property("IrcChannel"); - - b.HasKey("Id"); - - b.HasIndex("ChatSettingsId"); - - b.HasIndex("ChatSettingsId1"); - - b.ToTable("ChatChannels"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("DiscordBotToken"); - - b.Property("DiscordEnabled"); - - b.Property("InstanceId"); - - b.Property("IrcEnabled"); - - b.Property("IrcHost") - .IsRequired(); - - b.Property("IrcNickServPassword"); - - b.Property("IrcPort"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("ChatSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ExitCode"); - - b.Property("FinishedAt"); - - b.Property("InstanceId"); - - b.Property("Output"); - - b.Property("RevisionInformationId"); - - b.Property("StartedAt"); - - b.Property("TargetedPrimaryDirectory"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AllowWebClient"); - - b.Property("AutoStart"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("PrimaryPort"); - - b.Property("ProcessId"); - - b.Property("SecondaryPort"); - - b.Property("SecurityLevel"); - - b.Property("SoftRestart"); - - b.Property("SoftShutdown"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamDaemonSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AutoCompileInterval"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("TargetDme"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamMakerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConfigurationAllowed"); - - b.Property("Name") - .IsRequired(); - - b.Property("Online"); - - b.Property("Path") - .IsRequired(); - - b.HasKey("Id"); - - b.ToTable("Instances"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ByondRights"); - - b.Property("ChatSettingsRights"); - - b.Property("ConfigurationRights"); - - b.Property("DreamDaemonRights"); - - b.Property("DreamMakerRights"); - - b.Property("InstanceId"); - - b.Property("RepositoryRights"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("UserId"); - - b.ToTable("InstanceUsers"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Cancelled"); - - b.Property("Description") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("StartedAt"); - - b.Property("StartedById"); - - b.Property("StoppedAt"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("StartedById"); - - b.ToTable("Jobs"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AccessUser"); - - b.Property("AutoUpdateInterval"); - - b.Property("CommitterEmail") - .IsRequired(); - - b.Property("CommitterName") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("Origin"); - - b.Property("PushTestMergeCommits"); - - b.Property("RevisionInformationId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.HasIndex("RevisionInformationId"); - - b.ToTable("RepositorySettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("OriginRevision") - .IsRequired() - .HasMaxLength(40); - - b.Property("Revision") - .IsRequired() - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("Revision") - .IsUnique(); - - b.ToTable("RevisionInformations"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EnableTelemetry"); - - b.Property("SystemAuthenticationGroup"); - - b.Property("UpstreamRepository"); - - b.HasKey("Id"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Author") - .IsRequired(); - - b.Property("BodyAtMerge") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("MergedAt"); - - b.Property("MergedById"); - - b.Property("RevisionInformationId"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AdministrationRights"); - - b.Property("CreatedAt"); - - b.Property("InstanceManagerRights"); - - b.Property("Name") - .IsRequired(); - - b.Property("PasswordHash"); - - b.Property("SystemIdentifier"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("EventId"); - - b.Property("Level"); - - b.Property("Message"); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("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 - } - } -} diff --git a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.Designer.cs b/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.Designer.cs deleted file mode 100644 index 0194884160..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.Designer.cs +++ /dev/null @@ -1,510 +0,0 @@ -// -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("Id") - .ValueGeneratedOnAdd(); - - b.Property("ChatSettingsId"); - - b.Property("ChatSettingsId1"); - - b.Property("DiscordChannelId"); - - b.Property("IrcChannel"); - - b.HasKey("Id"); - - b.HasIndex("ChatSettingsId"); - - b.HasIndex("ChatSettingsId1"); - - b.ToTable("ChatChannels"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("DiscordBotToken"); - - b.Property("DiscordEnabled"); - - b.Property("InstanceId"); - - b.Property("IrcEnabled"); - - b.Property("IrcHost") - .IsRequired(); - - b.Property("IrcNickServPassword"); - - b.Property("IrcPort"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("ChatSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ExitCode"); - - b.Property("FinishedAt"); - - b.Property("InstanceId"); - - b.Property("Output"); - - b.Property("RevisionInformationId"); - - b.Property("StartedAt"); - - b.Property("TargetedPrimaryDirectory"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AllowWebClient"); - - b.Property("AutoStart"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("PrimaryPort"); - - b.Property("ProcessId"); - - b.Property("SecondaryPort"); - - b.Property("SecurityLevel"); - - b.Property("SoftRestart"); - - b.Property("SoftShutdown"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamDaemonSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AutoCompileInterval"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("TargetDme"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamMakerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConfigurationAllowed"); - - b.Property("Name") - .IsRequired(); - - b.Property("Online"); - - b.Property("Path") - .IsRequired(); - - b.HasKey("Id"); - - b.ToTable("Instances"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ByondRights"); - - b.Property("ChatSettingsRights"); - - b.Property("ConfigurationRights"); - - b.Property("DreamDaemonRights"); - - b.Property("DreamMakerRights"); - - b.Property("InstanceId"); - - b.Property("RepositoryRights"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("UserId"); - - b.ToTable("InstanceUsers"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Cancelled"); - - b.Property("Description") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("StartedAt"); - - b.Property("StartedById"); - - b.Property("StoppedAt"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("StartedById"); - - b.ToTable("Jobs"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AccessUser"); - - b.Property("AutoUpdateInterval"); - - b.Property("CommitterEmail") - .IsRequired(); - - b.Property("CommitterName") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("Origin"); - - b.Property("PushTestMergeCommits"); - - b.Property("RevisionInformationId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.HasIndex("RevisionInformationId"); - - b.ToTable("RepositorySettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("OriginRevision") - .IsRequired() - .HasMaxLength(40); - - b.Property("Revision") - .IsRequired() - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("Revision") - .IsUnique(); - - b.ToTable("RevisionInformations"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EnableTelemetry"); - - b.Property("SystemAuthenticationGroup"); - - b.Property("UpstreamRepository"); - - b.HasKey("Id"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Author") - .IsRequired(); - - b.Property("BodyAtMerge") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("MergedAt"); - - b.Property("MergedById"); - - b.Property("RevisionInformationId"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AdministrationRights"); - - b.Property("CreatedAt"); - - b.Property("InstanceManagerRights"); - - b.Property("Name") - .IsRequired(); - - b.Property("PasswordHash"); - - b.Property("SystemIdentifier"); - - b.Property("TokenSecret") - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("SystemIdentifier") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EventId"); - - b.Property("Level"); - - b.Property("Message"); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("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 - } - } -} diff --git a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.cs b/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.cs deleted file mode 100644 index 433fd2978e..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/20180410204120_InitialCreate.cs +++ /dev/null @@ -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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Name = table.Column(nullable: false), - Path = table.Column(nullable: false), - Online = table.Column(nullable: false), - ConfigurationAllowed = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Instances", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Logs", - columns: table => new - { - EventId = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Level = table.Column(nullable: false), - Message = table.Column(nullable: true), - Name = table.Column(maxLength: 255, nullable: true), - TimeStamp = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "RevisionInformations", - columns: table => new - { - Revision = table.Column(maxLength: 40, nullable: false), - OriginRevision = table.Column(maxLength: 40, nullable: false), - Id = table.Column(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(nullable: true), - EnableTelemetry = table.Column(nullable: false), - UpstreamRepository = table.Column(nullable: true), - Id = table.Column(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(nullable: false), - CreatedAt = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InstanceManagerRights = table.Column(nullable: false), - SystemIdentifier = table.Column(nullable: true), - Name = table.Column(nullable: false), - PasswordHash = table.Column(nullable: true), - TokenSecret = table.Column(maxLength: 40, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ChatSettings", - columns: table => new - { - IrcEnabled = table.Column(nullable: false), - IrcHost = table.Column(nullable: false), - IrcPort = table.Column(nullable: false), - IrcNickServPassword = table.Column(nullable: true), - DiscordEnabled = table.Column(nullable: false), - DiscordBotToken = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InstanceId = table.Column(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(nullable: true), - CommitterName = table.Column(nullable: false), - CommitterEmail = table.Column(nullable: false), - AccessUser = table.Column(nullable: true), - AccessToken = table.Column(nullable: true), - PushTestMergeCommits = table.Column(nullable: false), - AutoUpdateInterval = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InstanceId = table.Column(nullable: false), - RevisionInformationId = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - StartedAt = table.Column(nullable: false), - FinishedAt = table.Column(nullable: false), - TargetedPrimaryDirectory = table.Column(nullable: true), - Output = table.Column(nullable: true), - ExitCode = table.Column(nullable: true), - TriggeredById = table.Column(nullable: false), - RevisionInformationId = table.Column(nullable: false), - InstanceId = table.Column(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(nullable: false), - DreamDaemonRights = table.Column(nullable: false), - DreamMakerRights = table.Column(nullable: false), - RepositoryRights = table.Column(nullable: false), - ChatSettingsRights = table.Column(nullable: false), - ConfigurationRights = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InstanceId = table.Column(nullable: true), - UserId = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - Description = table.Column(nullable: false), - StartedAt = table.Column(nullable: false), - StoppedAt = table.Column(nullable: false), - Cancelled = table.Column(nullable: false), - StartedById = table.Column(nullable: false), - InstanceId = table.Column(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(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - MergedAt = table.Column(nullable: false), - TitleAtMerge = table.Column(nullable: false), - BodyAtMerge = table.Column(nullable: false), - Author = table.Column(nullable: false), - MergedById = table.Column(nullable: false), - InstanceId = table.Column(nullable: true), - RevisionInformationId = table.Column(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(nullable: true), - DiscordChannelId = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ChatSettingsId = table.Column(nullable: true), - ChatSettingsId1 = table.Column(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(nullable: false), - AllowWebClient = table.Column(nullable: false), - SoftRestart = table.Column(nullable: false), - SoftShutdown = table.Column(nullable: false), - SecurityLevel = table.Column(nullable: false), - PrimaryPort = table.Column(nullable: false), - SecondaryPort = table.Column(nullable: false), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - ProcessId = table.Column(nullable: true), - AccessToken = table.Column(nullable: true), - InstanceId = table.Column(nullable: false), - CompileJobId = table.Column(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(nullable: true), - TargetDme = table.Column(nullable: true), - Id = table.Column(nullable: false) - .Annotation("Sqlite:Autoincrement", true), - InstanceId = table.Column(nullable: false), - CompileJobId = table.Column(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"); - } - } -} diff --git a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs b/src/Tgstation.Server.Host/Models/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs deleted file mode 100644 index 499518c925..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/Sqlite/SqliteDatabaseContextModelSnapshot.cs +++ /dev/null @@ -1,509 +0,0 @@ -// -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("Id") - .ValueGeneratedOnAdd(); - - b.Property("ChatSettingsId"); - - b.Property("ChatSettingsId1"); - - b.Property("DiscordChannelId"); - - b.Property("IrcChannel"); - - b.HasKey("Id"); - - b.HasIndex("ChatSettingsId"); - - b.HasIndex("ChatSettingsId1"); - - b.ToTable("ChatChannels"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ChatSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("DiscordBotToken"); - - b.Property("DiscordEnabled"); - - b.Property("InstanceId"); - - b.Property("IrcEnabled"); - - b.Property("IrcHost") - .IsRequired(); - - b.Property("IrcNickServPassword"); - - b.Property("IrcPort"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("ChatSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.CompileJob", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ExitCode"); - - b.Property("FinishedAt"); - - b.Property("InstanceId"); - - b.Property("Output"); - - b.Property("RevisionInformationId"); - - b.Property("StartedAt"); - - b.Property("TargetedPrimaryDirectory"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AllowWebClient"); - - b.Property("AutoStart"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("PrimaryPort"); - - b.Property("ProcessId"); - - b.Property("SecondaryPort"); - - b.Property("SecurityLevel"); - - b.Property("SoftRestart"); - - b.Property("SoftShutdown"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamDaemonSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.DreamMakerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AutoCompileInterval"); - - b.Property("CompileJobId"); - - b.Property("InstanceId"); - - b.Property("TargetDme"); - - b.HasKey("Id"); - - b.HasIndex("CompileJobId"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.ToTable("DreamMakerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Instance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConfigurationAllowed"); - - b.Property("Name") - .IsRequired(); - - b.Property("Online"); - - b.Property("Path") - .IsRequired(); - - b.HasKey("Id"); - - b.ToTable("Instances"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.InstanceUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ByondRights"); - - b.Property("ChatSettingsRights"); - - b.Property("ConfigurationRights"); - - b.Property("DreamDaemonRights"); - - b.Property("DreamMakerRights"); - - b.Property("InstanceId"); - - b.Property("RepositoryRights"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("UserId"); - - b.ToTable("InstanceUsers"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.Job", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Cancelled"); - - b.Property("Description") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("StartedAt"); - - b.Property("StartedById"); - - b.Property("StoppedAt"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId"); - - b.HasIndex("StartedById"); - - b.ToTable("Jobs"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RepositorySettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessToken"); - - b.Property("AccessUser"); - - b.Property("AutoUpdateInterval"); - - b.Property("CommitterEmail") - .IsRequired(); - - b.Property("CommitterName") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("Origin"); - - b.Property("PushTestMergeCommits"); - - b.Property("RevisionInformationId"); - - b.HasKey("Id"); - - b.HasIndex("InstanceId") - .IsUnique(); - - b.HasIndex("RevisionInformationId"); - - b.ToTable("RepositorySettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.RevisionInformation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("OriginRevision") - .IsRequired() - .HasMaxLength(40); - - b.Property("Revision") - .IsRequired() - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("Revision") - .IsUnique(); - - b.ToTable("RevisionInformations"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.ServerSettings", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EnableTelemetry"); - - b.Property("SystemAuthenticationGroup"); - - b.Property("UpstreamRepository"); - - b.HasKey("Id"); - - b.ToTable("ServerSettings"); - }); - - modelBuilder.Entity("Tgstation.Server.Host.Models.TestMerge", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Author") - .IsRequired(); - - b.Property("BodyAtMerge") - .IsRequired(); - - b.Property("InstanceId"); - - b.Property("MergedAt"); - - b.Property("MergedById"); - - b.Property("RevisionInformationId"); - - b.Property("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("Id") - .ValueGeneratedOnAdd(); - - b.Property("AdministrationRights"); - - b.Property("CreatedAt"); - - b.Property("InstanceManagerRights"); - - b.Property("Name") - .IsRequired(); - - b.Property("PasswordHash"); - - b.Property("SystemIdentifier"); - - b.Property("TokenSecret") - .HasMaxLength(40); - - b.HasKey("Id"); - - b.HasIndex("SystemIdentifier") - .IsUnique(); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("ZNetCS.AspNetCore.Logging.EntityFrameworkCore.Log", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EventId"); - - b.Property("Level"); - - b.Property("Message"); - - b.Property("Name") - .HasMaxLength(255); - - b.Property("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 - } - } -} diff --git a/src/Tgstation.Server.Host/Models/MySqlDatabaseContext.cs b/src/Tgstation.Server.Host/Models/MySqlDatabaseContext.cs index c46d26c1ba..e88678bf23 100644 --- a/src/Tgstation.Server.Host/Models/MySqlDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/MySqlDatabaseContext.cs @@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Models { /// - /// for MySQL + /// for MySQL /// sealed class MySqlDatabaseContext : DatabaseContext { /// /// Construct a /// - /// The for the - /// The of for the - /// The for the - /// The for the + /// The for the + /// The of for the + /// The for the + /// The for the public MySqlDatabaseContext(DbContextOptions dbContextOptions, IOptions databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder) { } diff --git a/src/Tgstation.Server.Host/Models/SqlServerDatabaseContext.cs b/src/Tgstation.Server.Host/Models/SqlServerDatabaseContext.cs index 7003c01085..240f8ba1e7 100644 --- a/src/Tgstation.Server.Host/Models/SqlServerDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/SqlServerDatabaseContext.cs @@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Models { /// - /// for Sqlserver + /// for Sqlserver /// sealed class SqlServerDatabaseContext : DatabaseContext { /// /// Construct a /// - /// The for the - /// The of for the - /// The for the - /// The for the + /// The for the + /// The of for the + /// The for the + /// The for the public SqlServerDatabaseContext(DbContextOptions dbContextOptions, IOptions databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder) { } diff --git a/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs b/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs index 3581d3d130..0d6c1c94e3 100644 --- a/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs +++ b/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs @@ -6,17 +6,17 @@ using Tgstation.Server.Host.Configuration; namespace Tgstation.Server.Host.Models { /// - /// for Sqlite + /// for Sqlite /// sealed class SqliteDatabaseContext : DatabaseContext { /// /// Construct a /// - /// The for the - /// The of for the - /// The for the - /// The for the + /// The for the + /// The of for the + /// The for the + /// The for the public SqliteDatabaseContext(DbContextOptions dbContextOptions, IOptions databaseConfiguration, ILoggerFactory loggerFactory, IDatabaseSeeder databaseSeeder) : base(dbContextOptions, databaseConfiguration, loggerFactory, databaseSeeder) { } diff --git a/src/Tgstation.Server.Host/Models/User.cs b/src/Tgstation.Server.Host/Models/User.cs index be2d1ae09d..139f940917 100644 --- a/src/Tgstation.Server.Host/Models/User.cs +++ b/src/Tgstation.Server.Host/Models/User.cs @@ -9,10 +9,13 @@ namespace Tgstation.Server.Host.Models /// sealed class User : Api.Models.Internal.User { + /// + /// The hash of the user's password + /// public string PasswordHash { get; set; } /// - /// The value used for the to encrypt JWTs + /// The value used to encrypt JWTs /// [StringLength(CryptographySuite.SecureStringLength)] public string TokenSecret { get; set; }