mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-25 15:09:26 -07:00
45 lines
1.6 KiB
C#
45 lines
1.6 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using RadicadeServer.DB;
|
|
|
|
#nullable disable
|
|
|
|
namespace RadicadeServer.Migrations;
|
|
|
|
[DbContext(typeof(RecDBContext))]
|
|
[Migration("20260921160000_AddRoomComments")]
|
|
public partial class AddRoomComments : Migration
|
|
{
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql(@"
|
|
IF OBJECT_ID(N'dbo.RoomComments', N'U') IS NULL
|
|
BEGIN
|
|
CREATE TABLE [dbo].[RoomComments] (
|
|
[Id] bigint IDENTITY(1,1) NOT NULL,
|
|
[RoomId] bigint NOT NULL,
|
|
[CreatorAccountId] bigint NOT NULL,
|
|
[Comment] nvarchar(max) NOT NULL,
|
|
[CommentType] nvarchar(64) NOT NULL,
|
|
[PositionX] real NULL,
|
|
[PositionY] real NULL,
|
|
[PositionZ] real NULL,
|
|
[CreatedAt] datetime2 NOT NULL,
|
|
CONSTRAINT [PK_RoomComments] PRIMARY KEY CLUSTERED ([Id] ASC)
|
|
);
|
|
|
|
-- The two lookups are by room (the room page, and the admin panel listing a room's comments)
|
|
-- and by author (moderating one account's comments).
|
|
CREATE INDEX [IX_RoomComments_RoomId] ON [dbo].[RoomComments] ([RoomId]);
|
|
CREATE INDEX [IX_RoomComments_CreatorAccountId] ON [dbo].[RoomComments] ([CreatorAccountId]);
|
|
END");
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.Sql(@"
|
|
IF OBJECT_ID(N'dbo.RoomComments', N'U') IS NOT NULL
|
|
DROP TABLE [dbo].[RoomComments];");
|
|
}
|
|
}
|