Skip to content

Commit

Permalink
Merge branch 'main' into release/v5
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored May 6, 2024
2 parents 8a3746e + 9ab2466 commit c68f03d
Show file tree
Hide file tree
Showing 40 changed files with 2,035 additions and 522 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Backbone.AdminApi.Infrastructure.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class MessagesOverview : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE VIEW "AdminUi"."MessageOverviews" AS
SELECT
"Messages"."Id" AS "MessageId",
"Messages"."CreatedBy" AS "SenderAddress",
"Messages"."CreatedByDevice" AS "SenderDevice",
"Messages"."CreatedAt" AS "SendDate",
COUNT ("Attachments"."Id") AS "NumberOfAttachments"
FROM
"Messages"."Messages" AS "Messages"
LEFT JOIN
"Messages"."Attachments" AS "Attachments"
ON
"Messages"."Id" = "Attachments"."MessageId"
GROUP BY
"Messages"."Id", "Messages"."CreatedBy", "Messages"."CreatedByDevice", "Messages"."CreatedAt"
""");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql(""" DROP VIEW "AdminUi"."MessageOverviews" """);
}
}
}
Loading

0 comments on commit c68f03d

Please sign in to comment.