-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to MS SQL for .ToJson support
- Loading branch information
1 parent
23e9d3f
commit ef814e7
Showing
14 changed files
with
242 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,3 @@ TestResults/ | |
.cr/ | ||
.vs/ | ||
__mismatch__ | ||
.mongodb | ||
.rabbitmq | ||
.redis | ||
.mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
version: '3.8' | ||
|
||
services: | ||
mysql: | ||
image: 'mysql:8.0-debian' | ||
mssql: | ||
image: 'mcr.microsoft.com/mssql/server:2019-latest' | ||
restart: always | ||
environment: | ||
MYSQL_DATABASE: shop | ||
MYSQL_USER: mysql | ||
MYSQL_PASSWORD: mysql | ||
MYSQL_ROOT_PASSWORD: root | ||
ACCEPT_EULA: Y | ||
MSSQL_PID: Developer | ||
SA_PASSWORD: P@ssw0rd | ||
ports: | ||
- '3306:3306' | ||
volumes: | ||
- .mysql:/var/lib/mysql | ||
- 11433:1433 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||
|
||
namespace Shop.Application.Features.Basket.Entities; | ||
|
||
internal sealed record Basket | ||
{ | ||
public required Guid Id { get; init; } | ||
|
||
public required Reservation[] Reservations { get; init; } | ||
} | ||
|
||
internal sealed record Reservation | ||
{ | ||
public required Guid ProductId { get; init; } | ||
|
||
public required int Quantity { get; init; } | ||
} | ||
|
||
internal sealed class BasketEntityTypeConfiguration : IEntityTypeConfiguration<Basket> | ||
{ | ||
public void Configure(EntityTypeBuilder<Basket> builder) | ||
{ | ||
builder.HasKey(x => x.Id); | ||
|
||
builder.OwnsMany<Reservation>(x => x.Reservations, options => options.ToJson()); | ||
} | ||
} |
45 changes: 0 additions & 45 deletions
45
src/Shop.Application/Migrations/20230706213110_Add product.Designer.cs
This file was deleted.
Oops, something went wrong.
44 changes: 0 additions & 44 deletions
44
src/Shop.Application/Migrations/20230706213110_Add product.cs
This file was deleted.
Oops, something went wrong.
48 changes: 0 additions & 48 deletions
48
src/Shop.Application/Migrations/20230706214258_Add product unitprice.Designer.cs
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
src/Shop.Application/Migrations/20230706214258_Add product unitprice.cs
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
src/Shop.Application/Migrations/20231023191622_Initial.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using Microsoft.EntityFrameworkCore.Migrations; | ||
|
||
#nullable disable | ||
|
||
namespace Shop.Application.Migrations | ||
{ | ||
/// <inheritdoc /> | ||
public partial class Initial : Migration | ||
{ | ||
/// <inheritdoc /> | ||
protected override void Up(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.CreateTable( | ||
name: "Basket", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Reservations = table.Column<string>(type: "nvarchar(max)", nullable: true) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Basket", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateTable( | ||
name: "Product", | ||
columns: table => new | ||
{ | ||
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false), | ||
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false), | ||
UnitPrice = table.Column<decimal>(type: "decimal(18,2)", nullable: false) | ||
}, | ||
constraints: table => | ||
{ | ||
table.PrimaryKey("PK_Product", x => x.Id); | ||
}); | ||
|
||
migrationBuilder.CreateIndex( | ||
name: "IX_Product_Name", | ||
table: "Product", | ||
column: "Name"); | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Down(MigrationBuilder migrationBuilder) | ||
{ | ||
migrationBuilder.DropTable( | ||
name: "Basket"); | ||
|
||
migrationBuilder.DropTable( | ||
name: "Product"); | ||
} | ||
} | ||
} |
Oops, something went wrong.