Skip to content

Commit

Permalink
Merge branch 'main' into do-not-create-external-events-for-identity-d…
Browse files Browse the repository at this point in the history
…eletion-if-change-was-initiated-by-owner
  • Loading branch information
mergify[bot] authored May 6, 2024
2 parents 6ca02e7 + 9ab2466 commit c4576cb
Show file tree
Hide file tree
Showing 38 changed files with 1,942 additions and 429 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 c4576cb

Please sign in to comment.