Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add mssql sqlserver support #5179

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/sonarscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ jobs:
# The organization and project arguments (see /o and /k) are displayed
# on the project dashboard in SonarCloud.
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Ombi-app_Ombi" /o:"ombi-app" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io"
.\.sonar\scanner\dotnet-sonarscanner begin /k:"Ombi-app_Ombi" /o:"ombi-app" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cdp.exclusions="src/Ombi.Store/Migrations/**/*"
dotnet build src/Ombi.sln -c NonUiBuild
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
Expand Down Expand Up @@ -245,6 +245,9 @@ _Pvt_Extensions
/Tools/*
*.db-journal

# macOS shame
.DS_Store

# Ignore local vscode config
*.vscode
/src/Ombi/database.json
Expand Down
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
Loading