mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Extend identity role model.
This commit is contained in:
@@ -4,16 +4,10 @@
|
||||
<RootNamespace>Marechai.Database</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.4" />
|
||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="3.1.1" />
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore">
|
||||
<HintPath>..\..\..\.nuget\packages\microsoft.aspnetcore.identity.entityframeworkcore\2.1.2\lib\netstandard2.0\Microsoft.AspNetCore.Identity.EntityFrameworkCore.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
8540
Marechai.Database/Migrations/20200523142934_ExtendIdentityRole.Designer.cs
generated
Normal file
8540
Marechai.Database/Migrations/20200523142934_ExtendIdentityRole.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Marechai.Database.Migrations
|
||||
{
|
||||
public partial class ExtendIdentityRole : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn("Discriminator", "AspNetUsers");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>("updated", "marechai_db", "datetime", nullable: true,
|
||||
defaultValueSql: "CURRENT_TIMESTAMP",
|
||||
oldClrType: typeof(DateTimeOffset), oldType: "timestamp",
|
||||
oldNullable: true, oldDefaultValueSql: "CURRENT_TIMESTAMP");
|
||||
|
||||
migrationBuilder.AlterColumn<string>("Name", "AspNetUserTokens", nullable: false,
|
||||
oldClrType: typeof(string), oldMaxLength: 128);
|
||||
|
||||
migrationBuilder.AlterColumn<string>("LoginProvider", "AspNetUserTokens", nullable: false,
|
||||
oldClrType: typeof(string), oldMaxLength: 128);
|
||||
|
||||
migrationBuilder.AlterColumn<string>("ProviderKey", "AspNetUserLogins", nullable: false,
|
||||
oldClrType: typeof(string), oldMaxLength: 128);
|
||||
|
||||
migrationBuilder.AlterColumn<string>("LoginProvider", "AspNetUserLogins", nullable: false,
|
||||
oldClrType: typeof(string), oldMaxLength: 128);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>("Created", "AspNetRoles", nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0,
|
||||
DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<string>("Description", "AspNetRoles", nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn("Created", "AspNetRoles");
|
||||
|
||||
migrationBuilder.DropColumn("Description", "AspNetRoles");
|
||||
|
||||
migrationBuilder.AlterColumn<DateTimeOffset>("updated", "marechai_db", "timestamp", nullable: true,
|
||||
defaultValueSql: "CURRENT_TIMESTAMP",
|
||||
oldClrType: typeof(DateTimeOffset), oldType: "datetime",
|
||||
oldNullable: true, oldDefaultValueSql: "CURRENT_TIMESTAMP");
|
||||
|
||||
migrationBuilder.AlterColumn<string>("Name", "AspNetUserTokens", maxLength: 128, nullable: false,
|
||||
oldClrType: typeof(string));
|
||||
|
||||
migrationBuilder.AlterColumn<string>("LoginProvider", "AspNetUserTokens", maxLength: 128, nullable: false,
|
||||
oldClrType: typeof(string));
|
||||
|
||||
migrationBuilder.AddColumn<string>("Discriminator", "AspNetUsers", nullable: false, defaultValue: "");
|
||||
|
||||
migrationBuilder.AlterColumn<string>("ProviderKey", "AspNetUserLogins", maxLength: 128, nullable: false,
|
||||
oldClrType: typeof(string));
|
||||
|
||||
migrationBuilder.AlterColumn<string>("LoginProvider", "AspNetUserLogins", maxLength: 128, nullable: false,
|
||||
oldClrType: typeof(string));
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
25
Marechai.Database/Models/ApplicationRole.cs
Normal file
25
Marechai.Database/Models/ApplicationRole.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
{
|
||||
public class ApplicationRole : IdentityRole
|
||||
{
|
||||
public ApplicationRole() => Created = DateTime.UtcNow;
|
||||
|
||||
public ApplicationRole(string name) : base(name)
|
||||
{
|
||||
Description = name;
|
||||
Created = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public ApplicationRole(string name, string description) : base(name)
|
||||
{
|
||||
Description = description;
|
||||
Created = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public string Description { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Marechai.Database.Models
|
||||
{
|
||||
public class MarechaiContext : IdentityDbContext
|
||||
public class MarechaiContext : IdentityDbContext<ApplicationUser, ApplicationRole, string>
|
||||
{
|
||||
public MarechaiContext() { }
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<Version>3.0.99.987</Version>
|
||||
<Version>3.0.99.990</Version>
|
||||
<Company>Canary Islands Computer Museum</Company>
|
||||
<Copyright>Copyright © 2003-2020 Natalia Portillo</Copyright>
|
||||
<Product>Canary Islands Computer Museum Website</Product>
|
||||
|
||||
Reference in New Issue
Block a user