Files
UniVerse/backend/UniVerse.Infrastructure/Migrations/20260512123000_UserNotifications.cs
T
serega404 b0a4a6d259
🚀 Create and publish a Docker image / Detect changes in backend and frontend (push) Successful in 9s
🚀 Create and publish a Docker image / Build & publish backend image (push) Successful in 26s
🚀 Create and publish a Docker image / Build & publish frontend image (push) Successful in 19s
🚀 Create and publish a Docker image / Update stack on Portainer (push) Successful in 8s
feat: добавил личные уведомления для пользователей
Реализовал хранение, получение и отметку прочитанными пользовательских уведомлений. Обновил фронтенд для отображения и управления уведомлениями в профиле студента.
2026-05-12 23:54:55 +03:00

55 lines
2.4 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using UniVerse.Infrastructure.Data;
#nullable disable
namespace UniVerse.Infrastructure.Migrations
{
/// <inheritdoc />
[DbContext(typeof(AppDbContext))]
[Migration("20260512123000_UserNotifications")]
public partial class UserNotifications : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user_notifications",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column<int>(type: "integer", nullable: false),
type = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
title = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
body = table.Column<string>(type: "character varying(1000)", maxLength: 1000, nullable: false),
is_read = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "NOW()")
},
constraints: table =>
{
table.PrimaryKey("PK_user_notifications", x => x.id);
table.ForeignKey(
name: "FK_user_notifications_users_user_id",
column: x => x.user_id,
principalTable: "users",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_user_notifications_user_id_created_at",
table: "user_notifications",
columns: new[] { "user_id", "created_at" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "user_notifications");
}
}
}