Skip to content

Commit c68f03d

Browse files
authored
Merge branch 'main' into release/v5
2 parents 8a3746e + 9ab2466 commit c68f03d

File tree

40 files changed

+2035
-522
lines changed

40 files changed

+2035
-522
lines changed

AdminApi/src/AdminApi.Infrastructure.Database.Postgres/Migrations/20240110182619_MessagesOverview.Designer.cs

Lines changed: 256 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
#nullable disable
4+
5+
namespace Backbone.AdminApi.Infrastructure.Database.Postgres.Migrations
6+
{
7+
/// <inheritdoc />
8+
public partial class MessagesOverview : Migration
9+
{
10+
/// <inheritdoc />
11+
protected override void Up(MigrationBuilder migrationBuilder)
12+
{
13+
migrationBuilder.Sql("""
14+
CREATE VIEW "AdminUi"."MessageOverviews" AS
15+
SELECT
16+
"Messages"."Id" AS "MessageId",
17+
"Messages"."CreatedBy" AS "SenderAddress",
18+
"Messages"."CreatedByDevice" AS "SenderDevice",
19+
"Messages"."CreatedAt" AS "SendDate",
20+
COUNT ("Attachments"."Id") AS "NumberOfAttachments"
21+
FROM
22+
"Messages"."Messages" AS "Messages"
23+
LEFT JOIN
24+
"Messages"."Attachments" AS "Attachments"
25+
ON
26+
"Messages"."Id" = "Attachments"."MessageId"
27+
GROUP BY
28+
"Messages"."Id", "Messages"."CreatedBy", "Messages"."CreatedByDevice", "Messages"."CreatedAt"
29+
""");
30+
}
31+
32+
/// <inheritdoc />
33+
protected override void Down(MigrationBuilder migrationBuilder)
34+
{
35+
migrationBuilder.Sql(""" DROP VIEW "AdminUi"."MessageOverviews" """);
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)