using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace PnvPanel.Infrastructure.Persistence.Migrations
{
///
public partial class AddSupportTickets : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SupportTickets",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
UserId = table.Column(type: "uuid", nullable: false),
Type = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
Status = table.Column(type: "character varying(32)", maxLength: 32, nullable: false),
RequestedRoleId = table.Column(type: "uuid", nullable: true),
ProposedRoleName = table.Column(type: "character varying(100)", maxLength: 100, nullable: true),
ProposedMaxConfigs = table.Column(type: "integer", nullable: true),
ProposedMaxIpLimit = table.Column(type: "integer", nullable: true),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SupportTickets", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TicketAttachments",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
CommentId = table.Column(type: "uuid", nullable: false),
FileName = table.Column(type: "character varying(255)", maxLength: 255, nullable: false),
StoredFileName = table.Column(type: "character varying(100)", maxLength: 100, nullable: false),
ContentType = table.Column(type: "character varying(100)", maxLength: 100, nullable: false),
SizeBytes = table.Column(type: "bigint", nullable: false),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TicketAttachments", x => x.Id);
});
migrationBuilder.CreateTable(
name: "TicketComments",
columns: table => new
{
Id = table.Column(type: "uuid", nullable: false),
TicketId = table.Column(type: "uuid", nullable: false),
AuthorId = table.Column(type: "uuid", nullable: false),
Body = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: false),
CreatedAt = table.Column(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_TicketComments", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_SupportTickets_Type_Status",
table: "SupportTickets",
columns: new[] { "Type", "Status" });
migrationBuilder.CreateIndex(
name: "IX_SupportTickets_UserId_Status",
table: "SupportTickets",
columns: new[] { "UserId", "Status" });
migrationBuilder.CreateIndex(
name: "IX_TicketAttachments_CommentId",
table: "TicketAttachments",
column: "CommentId");
migrationBuilder.CreateIndex(
name: "IX_TicketAttachments_StoredFileName",
table: "TicketAttachments",
column: "StoredFileName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_TicketComments_TicketId_CreatedAt",
table: "TicketComments",
columns: new[] { "TicketId", "CreatedAt" });
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SupportTickets");
migrationBuilder.DropTable(
name: "TicketAttachments");
migrationBuilder.DropTable(
name: "TicketComments");
}
}
}