Initial commit carried over from private repo. This is V2.
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m3s
Build and Push Docker Image / docker (push) Successful in 43s

This commit is contained in:
2025-07-04 21:24:12 +02:00
parent 7715816029
commit 4393977389
96 changed files with 3223 additions and 0 deletions

View File

@ -0,0 +1,100 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MessengerApi.Db.Sql.Migrations
{
/// <inheritdoc />
public partial class Initial : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Messages",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
CreatedUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
FromId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ToId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
IsDelivered = table.Column<bool>(type: "bit", nullable: false),
IsAcknowledged = table.Column<bool>(type: "bit", nullable: false),
PayloadType = table.Column<string>(type: "nvarchar(max)", nullable: true),
Payload = table.Column<string>(type: "nvarchar(max)", nullable: true),
PayloadLifespanInSeconds = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Messages", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
ApiKey = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
IsEnabled = table.Column<bool>(type: "bit", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserRoutes",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
FromId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
ToId = table.Column<Guid>(type: "uniqueidentifier", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserRoutes", x => x.Id);
table.ForeignKey(
name: "FK_UserRoutes_Users_FromId",
column: x => x.FromId,
principalTable: "Users",
principalColumn: "Id");
table.ForeignKey(
name: "FK_UserRoutes_Users_ToId",
column: x => x.ToId,
principalTable: "Users",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Messages_ToId_IsDelivered",
table: "Messages",
columns: new[] { "ToId", "IsDelivered" })
.Annotation("SqlServer:Clustered", false);
migrationBuilder.CreateIndex(
name: "IX_UserRoutes_FromId",
table: "UserRoutes",
column: "FromId");
migrationBuilder.CreateIndex(
name: "IX_UserRoutes_ToId",
table: "UserRoutes",
column: "ToId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Messages");
migrationBuilder.DropTable(
name: "UserRoutes");
migrationBuilder.DropTable(
name: "Users");
}
}
}