Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payments
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
Юнусов Ибрагим
payments
Commits
c3a02c61
Commit
c3a02c61
authored
Jul 27, 2022
by
Юнусов Ибрагим
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил миграции
parent
dbc2f6e0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
458 additions
and
0 deletions
+458
-0
20220727143944_Init.Designer.cs
...Payment.WebApi/Migrations/20220727143944_Init.Designer.cs
+175
-0
20220727143944_Init.cs
Payments/Payment.WebApi/Migrations/20220727143944_Init.cs
+110
-0
PaymentDbContextModelSnapshot.cs
...ayment.WebApi/Migrations/PaymentDbContextModelSnapshot.cs
+173
-0
No files found.
Payments/Payment.WebApi/Migrations/20220727143944_Init.Designer.cs
0 → 100644
View file @
c3a02c61
// <auto-generated />
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
using
Payment.WebApi.Infrastructures.Databases
;
#
nullable
disable
namespace
Payment.WebApi.Migrations
{
[
DbContext
(
typeof
(
PaymentDbContext
))]
[
Migration
(
"20220727143944_Init"
)]
partial
class
Init
{
protected
override
void
BuildTargetModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"6.0.7"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
63
);
NpgsqlModelBuilderExtensions
.
UseIdentityByDefaultColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.Supplier"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasColumnType
(
"text"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Suppliers"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"Алсеко"
},
new
{
Id
=
2
,
Name
=
"Казактелеком"
},
new
{
Id
=
3
,
Name
=
"Beeline"
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
short
>(
"Age"
)
.
HasColumnType
(
"SMALLINT"
);
b
.
Property
<
string
>(
"Email"
)
.
IsRequired
()
.
HasMaxLength
(
128
)
.
HasColumnType
(
"character varying(128)"
);
b
.
Property
<
string
>(
"FirstName"
)
.
IsRequired
()
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
Property
<
bool
>(
"IsActive"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
Property
<
string
>(
"MiddleName"
)
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
b
.
HasData
(
new
{
Id
=
1
,
Age
=
(
short
)
25
,
Email
=
"userOne@test"
,
FirstName
=
"Jhon"
,
IsActive
=
true
,
LastName
=
"Doe"
,
MiddleName
=
"Blastovich"
},
new
{
Id
=
2
,
Age
=
(
short
)
27
,
Email
=
"userOne@test"
,
FirstName
=
"Jhoan"
,
IsActive
=
true
,
LastName
=
"Shepard"
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.UserBalance"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
decimal
>(
"Amount"
)
.
HasColumnType
(
"numeric(18,2)"
);
b
.
Property
<
string
>(
"Currency"
)
.
IsRequired
()
.
HasMaxLength
(
8
)
.
HasColumnType
(
"character varying(8)"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"UserBalance"
);
b
.
HasData
(
new
{
Id
=
1
,
Amount
=
100
m
,
Currency
=
"KZT"
,
UserId
=
1
},
new
{
Id
=
2
,
Amount
=
250
m
,
Currency
=
"KZT"
,
UserId
=
2
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.UserBalance"
,
b
=>
{
b
.
HasOne
(
"Payment.WebApi.Models.DbModels.User"
,
"User"
)
.
WithMany
(
"Balances"
)
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.User"
,
b
=>
{
b
.
Navigation
(
"Balances"
);
});
#pragma warning restore 612, 618
}
}
}
Payments/Payment.WebApi/Migrations/20220727143944_Init.cs
0 → 100644
View file @
c3a02c61
using
Microsoft.EntityFrameworkCore.Migrations
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
#
nullable
disable
namespace
Payment.WebApi.Migrations
{
public
partial
class
Init
:
Migration
{
protected
override
void
Up
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
CreateTable
(
name
:
"Suppliers"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
)
.
Annotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
),
Name
=
table
.
Column
<
string
>(
type
:
"text"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Suppliers"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"Users"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
)
.
Annotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
),
FirstName
=
table
.
Column
<
string
>(
type
:
"VARCHAR(256)"
,
nullable
:
false
),
LastName
=
table
.
Column
<
string
>(
type
:
"VARCHAR(256)"
,
nullable
:
true
),
MiddleName
=
table
.
Column
<
string
>(
type
:
"VARCHAR(256)"
,
nullable
:
true
),
Email
=
table
.
Column
<
string
>(
type
:
"character varying(128)"
,
maxLength
:
128
,
nullable
:
false
),
Age
=
table
.
Column
<
short
>(
type
:
"SMALLINT"
,
nullable
:
false
),
IsActive
=
table
.
Column
<
bool
>(
type
:
"boolean"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_Users"
,
x
=>
x
.
Id
);
});
migrationBuilder
.
CreateTable
(
name
:
"UserBalance"
,
columns
:
table
=>
new
{
Id
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
)
.
Annotation
(
"Npgsql:ValueGenerationStrategy"
,
NpgsqlValueGenerationStrategy
.
IdentityByDefaultColumn
),
Amount
=
table
.
Column
<
decimal
>(
type
:
"numeric(18,2)"
,
nullable
:
false
),
Currency
=
table
.
Column
<
string
>(
type
:
"character varying(8)"
,
maxLength
:
8
,
nullable
:
false
),
UserId
=
table
.
Column
<
int
>(
type
:
"integer"
,
nullable
:
false
)
},
constraints
:
table
=>
{
table
.
PrimaryKey
(
"PK_UserBalance"
,
x
=>
x
.
Id
);
table
.
ForeignKey
(
name
:
"FK_UserBalance_Users_UserId"
,
column
:
x
=>
x
.
UserId
,
principalTable
:
"Users"
,
principalColumn
:
"Id"
,
onDelete
:
ReferentialAction
.
Cascade
);
});
migrationBuilder
.
InsertData
(
table
:
"Suppliers"
,
columns
:
new
[]
{
"Id"
,
"Name"
},
values
:
new
object
[,]
{
{
1
,
"Алсеко"
},
{
2
,
"Казактелеком"
},
{
3
,
"Beeline"
}
});
migrationBuilder
.
InsertData
(
table
:
"Users"
,
columns
:
new
[]
{
"Id"
,
"Age"
,
"Email"
,
"FirstName"
,
"IsActive"
,
"LastName"
,
"MiddleName"
},
values
:
new
object
[,]
{
{
1
,
(
short
)
25
,
"userOne@test"
,
"Jhon"
,
true
,
"Doe"
,
"Blastovich"
},
{
2
,
(
short
)
27
,
"userOne@test"
,
"Jhoan"
,
true
,
"Shepard"
,
null
}
});
migrationBuilder
.
InsertData
(
table
:
"UserBalance"
,
columns
:
new
[]
{
"Id"
,
"Amount"
,
"Currency"
,
"UserId"
},
values
:
new
object
[,]
{
{
1
,
100
m
,
"KZT"
,
1
},
{
2
,
250
m
,
"KZT"
,
2
}
});
migrationBuilder
.
CreateIndex
(
name
:
"IX_UserBalance_UserId"
,
table
:
"UserBalance"
,
column
:
"UserId"
);
}
protected
override
void
Down
(
MigrationBuilder
migrationBuilder
)
{
migrationBuilder
.
DropTable
(
name
:
"Suppliers"
);
migrationBuilder
.
DropTable
(
name
:
"UserBalance"
);
migrationBuilder
.
DropTable
(
name
:
"Users"
);
}
}
}
Payments/Payment.WebApi/Migrations/PaymentDbContextModelSnapshot.cs
0 → 100644
View file @
c3a02c61
// <auto-generated />
using
Microsoft.EntityFrameworkCore
;
using
Microsoft.EntityFrameworkCore.Infrastructure
;
using
Microsoft.EntityFrameworkCore.Storage.ValueConversion
;
using
Npgsql.EntityFrameworkCore.PostgreSQL.Metadata
;
using
Payment.WebApi.Infrastructures.Databases
;
#
nullable
disable
namespace
Payment.WebApi.Migrations
{
[
DbContext
(
typeof
(
PaymentDbContext
))]
partial
class
PaymentDbContextModelSnapshot
:
ModelSnapshot
{
protected
override
void
BuildModel
(
ModelBuilder
modelBuilder
)
{
#pragma warning disable 612, 618
modelBuilder
.
HasAnnotation
(
"ProductVersion"
,
"6.0.7"
)
.
HasAnnotation
(
"Relational:MaxIdentifierLength"
,
63
);
NpgsqlModelBuilderExtensions
.
UseIdentityByDefaultColumns
(
modelBuilder
);
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.Supplier"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
string
>(
"Name"
)
.
IsRequired
()
.
HasColumnType
(
"text"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Suppliers"
);
b
.
HasData
(
new
{
Id
=
1
,
Name
=
"Алсеко"
},
new
{
Id
=
2
,
Name
=
"Казактелеком"
},
new
{
Id
=
3
,
Name
=
"Beeline"
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.User"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
short
>(
"Age"
)
.
HasColumnType
(
"SMALLINT"
);
b
.
Property
<
string
>(
"Email"
)
.
IsRequired
()
.
HasMaxLength
(
128
)
.
HasColumnType
(
"character varying(128)"
);
b
.
Property
<
string
>(
"FirstName"
)
.
IsRequired
()
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
Property
<
bool
>(
"IsActive"
)
.
HasColumnType
(
"boolean"
);
b
.
Property
<
string
>(
"LastName"
)
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
Property
<
string
>(
"MiddleName"
)
.
HasColumnType
(
"VARCHAR(256)"
);
b
.
HasKey
(
"Id"
);
b
.
ToTable
(
"Users"
);
b
.
HasData
(
new
{
Id
=
1
,
Age
=
(
short
)
25
,
Email
=
"userOne@test"
,
FirstName
=
"Jhon"
,
IsActive
=
true
,
LastName
=
"Doe"
,
MiddleName
=
"Blastovich"
},
new
{
Id
=
2
,
Age
=
(
short
)
27
,
Email
=
"userOne@test"
,
FirstName
=
"Jhoan"
,
IsActive
=
true
,
LastName
=
"Shepard"
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.UserBalance"
,
b
=>
{
b
.
Property
<
int
>(
"Id"
)
.
ValueGeneratedOnAdd
()
.
HasColumnType
(
"integer"
);
NpgsqlPropertyBuilderExtensions
.
UseIdentityByDefaultColumn
(
b
.
Property
<
int
>(
"Id"
));
b
.
Property
<
decimal
>(
"Amount"
)
.
HasColumnType
(
"numeric(18,2)"
);
b
.
Property
<
string
>(
"Currency"
)
.
IsRequired
()
.
HasMaxLength
(
8
)
.
HasColumnType
(
"character varying(8)"
);
b
.
Property
<
int
>(
"UserId"
)
.
HasColumnType
(
"integer"
);
b
.
HasKey
(
"Id"
);
b
.
HasIndex
(
"UserId"
);
b
.
ToTable
(
"UserBalance"
);
b
.
HasData
(
new
{
Id
=
1
,
Amount
=
100
m
,
Currency
=
"KZT"
,
UserId
=
1
},
new
{
Id
=
2
,
Amount
=
250
m
,
Currency
=
"KZT"
,
UserId
=
2
});
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.UserBalance"
,
b
=>
{
b
.
HasOne
(
"Payment.WebApi.Models.DbModels.User"
,
"User"
)
.
WithMany
(
"Balances"
)
.
HasForeignKey
(
"UserId"
)
.
OnDelete
(
DeleteBehavior
.
Cascade
)
.
IsRequired
();
b
.
Navigation
(
"User"
);
});
modelBuilder
.
Entity
(
"Payment.WebApi.Models.DbModels.User"
,
b
=>
{
b
.
Navigation
(
"Balances"
);
});
#pragma warning restore 612, 618
}
}
}
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