diff --git a/src/Tgstation.Server.Host/Configuration/DatabaseType.cs b/src/Tgstation.Server.Host/Configuration/DatabaseType.cs index bbc8be7798..c536486427 100644 --- a/src/Tgstation.Server.Host/Configuration/DatabaseType.cs +++ b/src/Tgstation.Server.Host/Configuration/DatabaseType.cs @@ -12,10 +12,6 @@ /// /// Use MySQL/MariaDB /// - MySql, - /// - /// Use SQLite 3 - /// - Sqlite + MySql } } diff --git a/src/Tgstation.Server.Host/Core/Application.cs b/src/Tgstation.Server.Host/Core/Application.cs index 556c2d1fbe..c2bbf8d6c2 100644 --- a/src/Tgstation.Server.Host/Core/Application.cs +++ b/src/Tgstation.Server.Host/Core/Application.cs @@ -149,22 +149,19 @@ namespace Tgstation.Server.Host.Core builder.EnableSensitiveDataLogging(); }; - switch (databaseConfiguration?.DatabaseType ?? DatabaseType.Sqlite) + var dbType = databaseConfiguration?.DatabaseType; + switch (dbType) { case DatabaseType.MySql: services.AddDbContext(ConfigureDatabase); services.AddScoped(x => x.GetRequiredService()); break; - case DatabaseType.Sqlite: - services.AddDbContext(ConfigureDatabase); - services.AddScoped(x => x.GetRequiredService()); - break; case DatabaseType.SqlServer: services.AddDbContext(ConfigureDatabase); services.AddScoped(x => x.GetRequiredService()); break; default: - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Invalid {0}!", nameof(DatabaseType))); + throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, "Invalid {0}: {1}!", nameof(DatabaseType), dbType)); } services.AddScoped(); diff --git a/src/Tgstation.Server.Host/Models/Migrations/SqliteDesignTimeDbContextFactory.cs b/src/Tgstation.Server.Host/Models/Migrations/SqliteDesignTimeDbContextFactory.cs deleted file mode 100644 index bf8b3c379b..0000000000 --- a/src/Tgstation.Server.Host/Models/Migrations/SqliteDesignTimeDbContextFactory.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Microsoft.AspNetCore.Identity; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Design; -using Microsoft.Extensions.Logging; -using Tgstation.Server.Host.Security; - -namespace Tgstation.Server.Host.Models.Migrations -{ - /// - sealed class SqliteDesignTimeDbContextFactory : IDesignTimeDbContextFactory - { - /// - public SqliteDatabaseContext CreateDbContext(string[] args) => new SqliteDatabaseContext(new DbContextOptions(), DesignTimeDbContextFactoryHelpers.GetDbContextOptions(), new DatabaseSeeder(new CryptographySuite(new PasswordHasher())), new LoggerFactory().CreateLogger()); - } -} diff --git a/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs b/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs deleted file mode 100644 index 224f08ff0b..0000000000 --- a/src/Tgstation.Server.Host/Models/SqliteDatabaseContext.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using System; -using Tgstation.Server.Host.Configuration; - -namespace Tgstation.Server.Host.Models -{ - /// - /// for Sqlite - /// - sealed class SqliteDatabaseContext : DatabaseContext - { - /// - /// Construct a - /// - /// The for the - /// The of for the - /// The for the - /// The for the - public SqliteDatabaseContext(DbContextOptions dbContextOptions, IOptions databaseConfiguration, IDatabaseSeeder databaseSeeder, ILogger logger) : base(dbContextOptions, databaseConfiguration, databaseSeeder, logger) - { } - - /// - protected override void OnConfiguring(DbContextOptionsBuilder options) - { - base.OnConfiguring(options); - //on the off chance that connection string is null here we default to a db file next to the executable since this is the default database - if (ConnectionString == null) - { - Logger.LogWarning("No database configured! Defaulting to SQLite in the working directory!"); - options.UseSqlite("Data Source=TgsDatabase.db3"); - } - else - options.UseSqlite(ConnectionString); - } - } -} diff --git a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj index 6ed2f231b1..af69de349b 100644 --- a/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj +++ b/src/Tgstation.Server.Host/Tgstation.Server.Host.csproj @@ -37,7 +37,6 @@ -