using System;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using UniVerse.Infrastructure.Data;
#nullable disable
namespace UniVerse.Infrastructure.Migrations
{
///
[DbContext(typeof(AppDbContext))]
[Migration("20260512123000_UserNotifications")]
public partial class UserNotifications : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "user_notifications",
columns: table => new
{
id = table.Column(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", Npgsql.EntityFrameworkCore.PostgreSQL.Metadata.NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
user_id = table.Column(type: "integer", nullable: false),
type = table.Column(type: "character varying(50)", maxLength: 50, nullable: false),
title = table.Column(type: "character varying(255)", maxLength: 255, nullable: false),
body = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: false),
is_read = table.Column(type: "boolean", nullable: false, defaultValue: false),
created_at = table.Column(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" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(name: "user_notifications");
}
}
}