Skip to content

Commit fa579d0

Browse files
committed
#184 -Manipular o carrinho via RabbitMQ
1 parent 2628b0b commit fa579d0

File tree

3 files changed

+183
-0
lines changed

3 files changed

+183
-0
lines changed

src/services/JSE.Carrinho.API/Migrations/20241107201348_CarrinhoCascade.Designer.cs

Lines changed: 141 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace JSE.Carrinho.API.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class CarrinhoCascade : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.DropForeignKey(
14+
name: "FK_CarrinhoItens_CarrinhoCliente_CarrinhoId",
15+
table: "CarrinhoItens");
16+
17+
migrationBuilder.AddForeignKey(
18+
name: "FK_CarrinhoItens_CarrinhoCliente_CarrinhoId",
19+
table: "CarrinhoItens",
20+
column: "CarrinhoId",
21+
principalTable: "CarrinhoCliente",
22+
principalColumn: "Id",
23+
onDelete: ReferentialAction.Cascade);
24+
}
25+
26+
/// <inheritdoc />
27+
protected override void Down(MigrationBuilder migrationBuilder)
28+
{
29+
migrationBuilder.DropForeignKey(
30+
name: "FK_CarrinhoItens_CarrinhoCliente_CarrinhoId",
31+
table: "CarrinhoItens");
32+
33+
migrationBuilder.AddForeignKey(
34+
name: "FK_CarrinhoItens_CarrinhoCliente_CarrinhoId",
35+
table: "CarrinhoItens",
36+
column: "CarrinhoId",
37+
principalTable: "CarrinhoCliente",
38+
principalColumn: "Id");
39+
}
40+
}
41+
}

src/services/JSE.Carrinho.API/Migrations/CarrinhoContextModelSnapshot.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
122122
b.HasOne("JSE.Carrinho.API.Model.CarrinhoCliente", "CarrinhoCliente")
123123
.WithMany("Itens")
124124
.HasForeignKey("CarrinhoId")
125+
.OnDelete(DeleteBehavior.Cascade)
125126
.IsRequired();
126127

127128
b.Navigation("CarrinhoCliente");

0 commit comments

Comments
 (0)