mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-10 23:42:36 -07:00
Migrate users
This commit is contained in:
parent
92016abe34
commit
6d2bc0eb72
2 changed files with 21 additions and 5 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue