Skip to content

Commit

Permalink
feat: add mssql sqlserver support
Browse files Browse the repository at this point in the history
  • Loading branch information
jcsawyer committed Oct 22, 2024
1 parent 2009fb7 commit 115b977
Show file tree
Hide file tree
Showing 16 changed files with 5,652 additions and 2 deletions.
16 changes: 16 additions & 0 deletions src/Ombi.Store/Context/MsSql/ExternalMsSqlContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;

namespace Ombi.Store.Context.MsSql;

public sealed class ExternalMsSqlContext : ExternalContext
{
private static bool _created;

public ExternalMsSqlContext(DbContextOptions<ExternalMsSqlContext> options) : base(options)
{
if (_created) return;

_created = true;
Database.Migrate();
}
}
16 changes: 16 additions & 0 deletions src/Ombi.Store/Context/MsSql/OmbiMsSqlContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;

namespace Ombi.Store.Context.MsSql;

public sealed class OmbiMsSqlContext : OmbiContext
{
private static bool _created;

public OmbiMsSqlContext(DbContextOptions<OmbiMsSqlContext> options) : base(options)
{
if (_created) return;
_created = true;

Database.Migrate();
}
}
16 changes: 16 additions & 0 deletions src/Ombi.Store/Context/MsSql/SettingsMsSqlContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Microsoft.EntityFrameworkCore;

namespace Ombi.Store.Context.MsSql;

public sealed class SettingsMsSqlContext : SettingsContext
{
private static bool _created;

public SettingsMsSqlContext(DbContextOptions<SettingsMsSqlContext> options) : base(options)
{
if (_created) return;

_created = true;
Database.Migrate();
}
}
17 changes: 17 additions & 0 deletions src/Ombi.Store/Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ If running migrations for any db provider other than Sqlite, then ensure the dat
}
```

### MSSQL Example
```
{
"OmbiDatabase": {
"Type": "MSSQL",
"ConnectionString": "Server=localhost;Database=ombi;User Id=ombi;Password=ombi;TrustServerCertificate=True"
},
"SettingsDatabase": {
"Type": "MSSQL",
"ConnectionString": "Server=localhost;Database=ombi;User Id=ombi;Password=ombi;TrustServerCertificate=True"
},
"ExternalDatabase": {
"Type": "MSSQL",
"ConnectionString": "Server=localhost;Database=ombi;User Id=ombi;Password=ombi;TrustServerCertificate=True"
}
}
```

### Postgres Example
```
Expand Down
Loading

0 comments on commit 115b977

Please sign in to comment.