Migrate users

pull/687/head
TidusJar 8 years ago
parent 92016abe34
commit 6d2bc0eb72

@ -27,23 +27,27 @@
using System.Data; using System.Data;
using PlexRequests.Store; using PlexRequests.Store;
using PlexRequests.Store.Repository;
namespace PlexRequests.Core.Migration.Migrations namespace PlexRequests.Core.Migration.Migrations
{ {
[Migration(11000, "v1.10.0.0")] [Migration(11000, "v1.10.0.0")]
public class Version1100 : BaseMigration, IMigration public class Version1100 : BaseMigration, IMigration
{ {
public Version1100() public Version1100(IUserRepository userRepo)
{ {
} }
public int Version => 11000; public int Version => 11000;
public IUserRepository UserRepo {get;set;}
public void Start(IDbConnection con) public void Start(IDbConnection con)
{ {
UpdateDb(con); UpdateDb(con);
// Update the current admin permissions set
UpdateAdmin(con);
UpdateSchema(con, Version); UpdateSchema(con, Version);
} }
@ -54,5 +58,17 @@ namespace PlexRequests.Core.Migration.Migrations
con.AlterTable("Users", "ADD", "Features", true, "INTEGER"); con.AlterTable("Users", "ADD", "Features", true, "INTEGER");
} }
private void UpdateAdmin(IDbConnection con)
{
var users = UserRepo.GetAll();
foreach (var user in users)
{
user.Permissions = Permissions.Administrator | ReportIssue | RequestMusic
| RequestTvShow
| RequestMovie;
}
}
} }
} }

@ -1,11 +1,11 @@
version: 1.9.{build} version: 1.10.{build}
configuration: Release configuration: Release
assembly_info: assembly_info:
patch: true patch: true
file: '**\AssemblyInfo.*' file: '**\AssemblyInfo.*'
assembly_version: '1.9.7' assembly_version: '1.10.0'
assembly_file_version: '{version}' assembly_file_version: '{version}'
assembly_informational_version: '1.9.7' assembly_informational_version: '1.10.0'
before_build: before_build:
- cmd: appveyor-retry nuget restore - cmd: appveyor-retry nuget restore
build: build:

Loading…
Cancel
Save