Реализация 5 лабораторной работы

This commit is contained in:
2026-11-27 20:06:14 +03:00
parent 276dbdad8a
commit 4fe4ab3432
116 changed files with 11883 additions and 25 deletions
@@ -0,0 +1,71 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Messenger.Api.Data.Migrations
{
/// <inheritdoc />
public partial class AddAttachments : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "attachments",
columns: table => new
{
id = table.Column<Guid>(type: "uuid", nullable: false),
chat_id = table.Column<Guid>(type: "uuid", nullable: false),
owner_id = table.Column<Guid>(type: "uuid", nullable: false),
filename = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
object_key = table.Column<string>(type: "text", nullable: false),
content_type = table.Column<string>(type: "character varying(100)", maxLength: 100, nullable: false),
size_bytes = table.Column<long>(type: "bigint", nullable: false),
checksum_sha256 = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
status = table.Column<string>(type: "character varying(20)", maxLength: 20, nullable: false),
created_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
uploaded_at = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_attachments", x => x.id);
table.ForeignKey(
name: "fk_attachments_chats_chat_id",
column: x => x.chat_id,
principalTable: "chats",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "fk_attachments_users_owner_id",
column: x => x.owner_id,
principalTable: "users",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "ix_attachments_chat_id",
table: "attachments",
column: "chat_id");
migrationBuilder.CreateIndex(
name: "ix_attachments_object_key",
table: "attachments",
column: "object_key",
unique: true);
migrationBuilder.CreateIndex(
name: "ix_attachments_owner_id",
table: "attachments",
column: "owner_id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "attachments");
}
}
}