using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace EchoHub.Server.Data.Migrations
{
///
public partial class AddInvitesAndReplies : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "ReplyToMessageId",
table: "Messages",
type: "TEXT",
nullable: true);
migrationBuilder.CreateTable(
name: "InviteCodes",
columns: table => new
{
Id = table.Column(type: "TEXT", nullable: false),
Code = table.Column(type: "TEXT", maxLength: 32, nullable: false),
CreatedByUserId = table.Column(type: "TEXT", nullable: false),
CreatedByUsername = table.Column(type: "TEXT", maxLength: 50, nullable: false),
CreatedAt = table.Column(type: "INTEGER", nullable: false),
ExpiresAt = table.Column(type: "INTEGER", nullable: true),
MaxUses = table.Column(type: "INTEGER", nullable: false),
UseCount = table.Column(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);
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InviteCodes");
migrationBuilder.DropColumn(
name: "ReplyToMessageId",
table: "Messages");
}
}
}