Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
webinar65
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Нурбек Созоев
webinar65
Commits
f0f5322d
Commit
f0f5322d
authored
Jun 27, 2019
by
Нурбек Созоев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил пользователя по-умолчанию
parent
26c2d5b9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
307 additions
and
0 deletions
+307
-0
20190627030304_SeedDefaultAdmin.Designer.cs
...65/Migrations/20190627030304_SeedDefaultAdmin.Designer.cs
+262
-0
20190627030304_SeedDefaultAdmin.cs
webinar65/Migrations/20190627030304_SeedDefaultAdmin.cs
+43
-0
AspNetIdentityDbContext.cs
webinar65/Models/AspNetIdentityDbContext.cs
+2
-0
No files found.
webinar65/Migrations/20190627030304_SeedDefaultAdmin.Designer.cs
0 → 100644
View file @
f0f5322d
// <auto-generated />
using
System
;
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
using
webinar65.Models
;
namespace
webinar65.Migrations
{
[
DbContext
(
typeof
(
AspNetIdentityDbContext
))]
[
Migration
(
"20190627030304_SeedDefaultAdmin"
)]
partial
class
SeedDefaultAdmin
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
SerialColumn
)
.
HasAnnotation
(
"ProductVersion"
,
"2.2.4-servicing-10062"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
63
);
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRole"
,
b
=>
{
b
.
Property
<
string
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
();
b
.
Property
<
string
>(
"Name"
)
.
HasMaxLength
(
256
);
b
.
Property
<
string
>(
"NormalizedName"
)
.
HasMaxLength
(
256
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedName"
)
.
IsUnique
()
.
HasName
(
"RoleNameIndex"
);
b
.
ToTable
(
"AspNetRoles"
);
b
.
HasData
(
new
{
Id
=
"1f57bac0-04e8-455d-8407-83e6d019f917"
,
ConcurrencyStamp
=
"2613ee8f-ddb0-4c00-8225-0e173168c342"
,
Name
=
"Admins"
,
NormalizedName
=
"ADMINS"
});
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
string
>(
"ClaimType"
);
b
.
Property
<
string
>(
"ClaimValue"
);
b
.
Property
<
string
>(
"RoleId"
)
.
IsRequired
();
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetRoleClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<string>"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
string
>(
"ClaimType"
);
b
.
Property
<
string
>(
"ClaimValue"
);
b
.
Property
<
string
>(
"UserId"
)
.
IsRequired
();
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserClaims"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<string>"
,
b
=>
{
b
.
Property
<
string
>(
"LoginProvider"
);
b
.
Property
<
string
>(
"ProviderKey"
);
b
.
Property
<
string
>(
"ProviderDisplayName"
);
b
.
Property
<
string
>(
"UserId"
)
.
IsRequired
();
b
.
HasKey
(
"LoginProvider"
,
"ProviderKey"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"AspNetUserLogins"
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<string>"
,
b
=>
{
b
.
Property
<
string
>(
"UserId"
);
b
.
Property
<
string
>(
"RoleId"
);
b
.
HasKey
(
"UserId"
,
"RoleId"
);
b
.
HasIndex
(
"RoleId"
);
b
.
ToTable
(
"AspNetUserRoles"
);
b
.
HasData
(
new
{
UserId
=
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
,
RoleId
=
"1f57bac0-04e8-455d-8407-83e6d019f917"
});
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<string>"
,
b
=>
{
b
.
Property
<
string
>(
"UserId"
);
b
.
Property
<
string
>(
"LoginProvider"
);
b
.
Property
<
string
>(
"Name"
);
b
.
Property
<
string
>(
"Value"
);
b
.
HasKey
(
"UserId"
,
"LoginProvider"
,
"Name"
);
b
.
ToTable
(
"AspNetUserTokens"
);
});
modelBuilder
.
Entity
(
"webinar65.Models.User"
,
b
=>
{
b
.
Property
<
string
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
int
>(
"AccessFailedCount"
);
b
.
Property
<
string
>(
"ConcurrencyStamp"
)
.
IsConcurrencyToken
();
b
.
Property
<
string
>(
"Email"
)
.
HasMaxLength
(
256
);
b
.
Property
<
bool
>(
"EmailConfirmed"
);
b
.
Property
<
bool
>(
"LockoutEnabled"
);
b
.
Property
<
DateTimeOffset
?>(
"LockoutEnd"
);
b
.
Property
<
string
>(
"NormalizedEmail"
)
.
HasMaxLength
(
256
);
b
.
Property
<
string
>(
"NormalizedUserName"
)
.
HasMaxLength
(
256
);
b
.
Property
<
string
>(
"PasswordHash"
);
b
.
Property
<
string
>(
"PhoneNumber"
);
b
.
Property
<
bool
>(
"PhoneNumberConfirmed"
);
b
.
Property
<
string
>(
"SecurityStamp"
);
b
.
Property
<
bool
>(
"TwoFactorEnabled"
);
b
.
Property
<
string
>(
"UserName"
)
.
HasMaxLength
(
256
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"NormalizedEmail"
)
.
HasName
(
"EmailIndex"
);
b
.
HasIndex
(
"NormalizedUserName"
)
.
IsUnique
()
.
HasName
(
"UserNameIndex"
);
b
.
ToTable
(
"AspNetUsers"
);
b
.
HasData
(
new
{
Id
=
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
,
AccessFailedCount
=
0
,
ConcurrencyStamp
=
"6d17e12e-4806-47b4-8745-bfaf8bed0c4a"
,
Email
=
"admin@mail.com"
,
EmailConfirmed
=
true
,
LockoutEnabled
=
false
,
NormalizedEmail
=
"ADMIN@MAIL.COM"
,
NormalizedUserName
=
"ADMIN"
,
PasswordHash
=
"AQAAAAEAACcQAAAAEFzShyzdh0jp44UkwRmbeEpSEZsuJp0DNNwOXlSe+EzsZG6mLCWmJp0c9ogEP9HWUw=="
,
PhoneNumberConfirmed
=
false
,
SecurityStamp
=
"bbba9eb1-5dac-4754-a82a-217d8a5e1df7"
,
TwoFactorEnabled
=
false
,
UserName
=
"admin"
});
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityRole"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserClaim<string>"
,
b
=>
{
b
.
HasOne
(
"webinar65.Models.User"
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserLogin<string>"
,
b
=>
{
b
.
HasOne
(
"webinar65.Models.User"
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserRole<string>"
,
b
=>
{
b
.
HasOne
(
"Microsoft.AspNetCore.Identity.IdentityRole"
)
.
WithMany
()
.
HasForeignKey
(
"RoleId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
b
.
HasOne
(
"webinar65.Models.User"
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
});
modelBuilder
.
Entity
(
"Microsoft.AspNetCore.Identity.IdentityUserToken<string>"
,
b
=>
{
b
.
HasOne
(
"webinar65.Models.User"
)
.
WithMany
()
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
);
});
#pragma warning restore 612, 618
}
}
}
webinar65/Migrations/20190627030304_SeedDefaultAdmin.cs
0 → 100644
View file @
f0f5322d
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
webinar65.Migrations
{
public
partial
class
SeedDefaultAdmin
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
InsertData
(
table
:
"AspNetRoles"
,
columns
:
new
[]
{
"Id"
,
"ConcurrencyStamp"
,
"Name"
,
"NormalizedName"
},
values
:
new
object
[]
{
"1f57bac0-04e8-455d-8407-83e6d019f917"
,
"2613ee8f-ddb0-4c00-8225-0e173168c342"
,
"Admins"
,
"ADMINS"
});
migrationBuilder
.
InsertData
(
table
:
"AspNetUsers"
,
columns
:
new
[]
{
"Id"
,
"AccessFailedCount"
,
"ConcurrencyStamp"
,
"Email"
,
"EmailConfirmed"
,
"LockoutEnabled"
,
"LockoutEnd"
,
"NormalizedEmail"
,
"NormalizedUserName"
,
"PasswordHash"
,
"PhoneNumber"
,
"PhoneNumberConfirmed"
,
"SecurityStamp"
,
"TwoFactorEnabled"
,
"UserName"
},
values
:
new
object
[]
{
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
,
0
,
"6d17e12e-4806-47b4-8745-bfaf8bed0c4a"
,
"admin@mail.com"
,
true
,
false
,
null
,
"ADMIN@MAIL.COM"
,
"ADMIN"
,
"AQAAAAEAACcQAAAAEFzShyzdh0jp44UkwRmbeEpSEZsuJp0DNNwOXlSe+EzsZG6mLCWmJp0c9ogEP9HWUw=="
,
null
,
false
,
"bbba9eb1-5dac-4754-a82a-217d8a5e1df7"
,
false
,
"admin"
});
migrationBuilder
.
InsertData
(
table
:
"AspNetUserRoles"
,
columns
:
new
[]
{
"UserId"
,
"RoleId"
},
values
:
new
object
[]
{
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
,
"1f57bac0-04e8-455d-8407-83e6d019f917"
});
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DeleteData
(
table
:
"AspNetUserRoles"
,
keyColumns
:
new
[]
{
"UserId"
,
"RoleId"
},
keyValues
:
new
object
[]
{
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
,
"1f57bac0-04e8-455d-8407-83e6d019f917"
});
migrationBuilder
.
DeleteData
(
table
:
"AspNetRoles"
,
keyColumn
:
"Id"
,
keyValue
:
"1f57bac0-04e8-455d-8407-83e6d019f917"
);
migrationBuilder
.
DeleteData
(
table
:
"AspNetUsers"
,
keyColumn
:
"Id"
,
keyValue
:
"eedbb89e-9c22-4050-8e12-6f77daa0f64d"
);
}
}
}
webinar65/Models/AspNetIdentityDbContext.cs
View file @
f0f5322d
using
System
;
using
Microsoft.AspNetCore.Identity
;
using
Microsoft.AspNetCore.Identity.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment