Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
webinar63
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
Нурбек Созоев
webinar63
Commits
a8a13abd
Commit
a8a13abd
authored
Jun 19, 2019
by
Нурбек Созоев
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил города по-умолчанию в таблицу Cities
parent
a948edca
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
0 deletions
+89
-0
.gitignore
.gitignore
+1
-0
20190619144720_AddCitiesSeedData.Designer.cs
...s/Migrations/20190619144720_AddCitiesSeedData.Designer.cs
+57
-0
20190619144720_AddCitiesSeedData.cs
MyCities/Migrations/20190619144720_AddCitiesSeedData.cs
+31
-0
No files found.
.gitignore
View file @
a8a13abd
...
...
@@ -15,6 +15,7 @@
# Mono auto generated files
mono_crash.*
.DS_Store
# Build results
[Dd]ebug/
...
...
MyCities/Migrations/20190619144720_AddCitiesSeedData.Designer.cs
0 → 100644
View file @
a8a13abd
// <auto-generated />
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
MyCities.Models
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
namespace
MyCities.Migrations
{
[
DbContext
(
typeof
(
MyCitiesDbContext
))]
[
Migration
(
"20190619144720_AddCitiesSeedData"
)]
partial
class
AddCitiesSeedData
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
SerialColumn
)
.
HasAnnotation
(
"ProductVersion"
,
"2.1.1-rtm-30846"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
63
);
modelBuilder
.
Entity
(
"MyCities.Models.City"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
string
>(
"Country"
);
b
.
Property
<
string
>(
"Name"
);
b
.
Property
<
int
>(
"Population"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Cities"
);
});
modelBuilder
.
Entity
(
"MyCities.Models.Person"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
();
b
.
Property
<
string
>(
"AvatarImagePath"
);
b
.
Property
<
string
>(
"FullName"
);
b
.
Property
<
string
>(
"NickName"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Persons"
);
});
#pragma warning restore 612, 618
}
}
}
MyCities/Migrations/20190619144720_AddCitiesSeedData.cs
0 → 100644
View file @
a8a13abd
using
Microsoft.EntityFrameworkCore.Migrations
;
namespace
MyCities.Migrations
{
public
partial
class
AddCitiesSeedData
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
InsertData
(
table
:
"Cities"
,
columns
:
new
[]
{
"Id"
,
"Country"
,
"Name"
,
"Population"
},
values
:
new
object
[]
{
1
,
"Kazakhstan"
,
"Almaty"
,
3000000
}
);
migrationBuilder
.
InsertData
(
table
:
"Cities"
,
columns
:
new
[]
{
"Id"
,
"Country"
,
"Name"
,
"Population"
},
values
:
new
object
[]
{
2
,
"Russia"
,
"Moscow"
,
12000000
}
);
migrationBuilder
.
InsertData
(
table
:
"Cities"
,
columns
:
new
[]
{
"Id"
,
"Country"
,
"Name"
,
"Population"
},
values
:
new
object
[]
{
3
,
"USA"
,
"New York"
,
7000000
}
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DeleteData
(
table
:
"Cities"
,
keyColumn
:
"Id"
,
keyValues
:
new
object
[]{
1
,
2
,
3
});
}
}
}
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