Files
EchoHub/src/EchoHub.Server/Data/Migrations/20260717165218_AddInvitesAndReplies.cs
T

57 lines
2.0 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EchoHub.Server.Data.Migrations
{
/// <inheritdoc />
public partial class AddInvitesAndReplies : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "ReplyToMessageId",
table: "Messages",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "InviteCodes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
Code = table.Column<string>(type: "TEXT", maxLength: 32, nullable: false),
CreatedByUserId = table.Column<Guid>(type: "TEXT", nullable: false),
CreatedByUsername = table.Column<string>(type: "TEXT", maxLength: 50, nullable: false),
CreatedAt = table.Column<long>(type: "INTEGER", nullable: false),
ExpiresAt = table.Column<long>(type: "INTEGER", nullable: true),
MaxUses = table.Column<int>(type: "INTEGER", nullable: false),
UseCount = table.Column<int>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InviteCodes", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_InviteCodes_Code",
table: "InviteCodes",
column: "Code",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InviteCodes");
migrationBuilder.DropColumn(
name: "ReplyToMessageId",
table: "Messages");
}
}
}