Skip to content

Commit

Permalink
Fix Sqlite migrations.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed Oct 9, 2020
1 parent 28f9fcd commit 0bda9b0
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 37 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class IsServerAdminproperty : Migration
{
Expand Down
4 changes: 2 additions & 2 deletions Server/Migrations/Sqlite/20200325145606_Alerts.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/Migrations/Sqlite/20200325145606_Alerts.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class Alerts : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/Migrations/Sqlite/20200327034430_Device Notes.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class DeviceNotes : Migration
{
Expand Down
4 changes: 2 additions & 2 deletions Server/Migrations/Sqlite/20200425052143_PublicIP.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/Migrations/Sqlite/20200425052143_PublicIP.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class PublicIP : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/Migrations/Sqlite/20200430222500_DisplayName.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class DisplayName : Migration
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Server/Migrations/Sqlite/20200717143837_Temp password.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
public partial class Temppassword : Migration
{
Expand Down
4 changes: 2 additions & 2 deletions Server/Migrations/Sqlite/SqliteDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Remotely.Server.Data;

namespace Remotely.Server.Migrations
namespace Remotely.Server.Migrations.Sqlite
{
[DbContext(typeof(SqliteDbContext))]
partial class SqliteDbContextModelSnapshot : ModelSnapshot
Expand All @@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "3.1.5");
.HasAnnotation("ProductVersion", "3.1.7");

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
Expand Down
1 change: 1 addition & 0 deletions Server/Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@

<ItemGroup>
<Folder Include="Migrations\PostgreSql\" />
<Folder Include="Migrations\Sqlite\" />
<Folder Include="Properties\" />
</ItemGroup>

Expand Down
21 changes: 5 additions & 16 deletions Server/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,11 @@ public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext, SqliteDbContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("SQLite")));

services.AddIdentity<RemotelyUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();
}
else if (dbProvider == "sqlserver")
{
services.AddDbContext<ApplicationDbContext, SqlServerDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("SQLServer")));


services.AddIdentity<RemotelyUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();
}
else if (dbProvider == "postgresql")
{
Expand All @@ -81,13 +70,13 @@ public void ConfigureServices(IServiceCollection services)
options.UseNpgsql(Configuration.GetConnectionString("PostgreSQL"));
}
});

services.AddIdentity<RemotelyUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();
}

services.AddIdentity<RemotelyUser, IdentityRole>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultUI()
.AddDefaultTokenProviders();

var trustedOrigins = Configuration.GetSection("ApplicationOptions:TrustedCorsOrigins").Get<string[]>();

if (trustedOrigins != null)
Expand Down

0 comments on commit 0bda9b0

Please sign in to comment.