You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi.Store/MigrationHelper.cs

25 lines
819 B

using Microsoft.EntityFrameworkCore.Migrations;
using System;
namespace Ombi.Store
{
internal static class MigrationHelper
{
public static void InsertRole(this MigrationBuilder mb, string role)
{
mb.Sql($@"
INSERT INTO AspnetRoles(Id, ConcurrencyStamp, Name, NormalizedName)
SELECT '{Guid.NewGuid()}','{Guid.NewGuid()}','{role}', '{role.ToUpper()}'
WHERE NOT EXISTS(SELECT 1 FROM AspnetRoles WHERE Name = '{role}');");
}
public static void InsertRoleMySql(this MigrationBuilder mb, string role)
{
mb.Sql($@"
INSERT INTO AspNetRoles(Id, ConcurrencyStamp, Name, NormalizedName)
SELECT '{Guid.NewGuid()}','{Guid.NewGuid()}','{role}', '{role.ToUpper()}'
WHERE NOT EXISTS(SELECT 1 FROM AspNetRoles WHERE Name = '{role}');");
}
}
}