mirror of
https://github.com/JogmansonReal/Radicade.git
synced 2026-10-27 07:59:03 -07:00
Radicade Public Code
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using RadicadeServer.DB;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RadicadeServer.Migrations;
|
||||
|
||||
[DbContext(typeof(RecDBContext))]
|
||||
[Migration("20260921150000_AddSubRoomPermissions")]
|
||||
public partial class AddSubRoomPermissions : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.SubRoomPermissions', N'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[SubRoomPermissions] (
|
||||
[Id] bigint IDENTITY(1,1) NOT NULL,
|
||||
[subRoomId] bigint NOT NULL,
|
||||
[permission] nvarchar(128) NOT NULL,
|
||||
[role] bigint NOT NULL,
|
||||
[type] int NOT NULL,
|
||||
[value] nvarchar(max) NOT NULL,
|
||||
CONSTRAINT [PK_SubRoomPermissions] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
||||
-- The client addresses an entry by its (permission, role) pair, so that pair is unique:
|
||||
-- re-sending it updates the stored row instead of adding a second one with a new value.
|
||||
CREATE UNIQUE INDEX [IX_SubRoomPermissions_subRoomId_permission_role]
|
||||
ON [dbo].[SubRoomPermissions] ([subRoomId], [permission], [role]);
|
||||
END");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.SubRoomPermissions', N'U') IS NOT NULL
|
||||
DROP TABLE [dbo].[SubRoomPermissions];");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user