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,51 @@
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using RadicadeServer.DB;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RadicadeServer.Migrations;
|
||||
|
||||
[DbContext(typeof(RecDBContext))]
|
||||
[Migration("20260927120000_AddKeepsakes")]
|
||||
public partial class AddKeepsakes : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.KeepsakeInstances', N'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [KeepsakeInstances] (
|
||||
[KeepsakeInstanceId] uniqueidentifier NOT NULL,
|
||||
[RoomId] bigint NOT NULL,
|
||||
[SubRoomId] bigint NULL,
|
||||
[KeepsakeCategoryId] int NOT NULL,
|
||||
[PlacedByAccountId] bigint NOT NULL,
|
||||
[PlacedAt] datetime2 NOT NULL,
|
||||
[Removed] bit NOT NULL DEFAULT 0,
|
||||
CONSTRAINT [PK_KeepsakeInstances] PRIMARY KEY ([KeepsakeInstanceId])
|
||||
);
|
||||
CREATE INDEX [IX_KeepsakeInstances_RoomId] ON [KeepsakeInstances] ([RoomId], [Removed]);
|
||||
END
|
||||
IF OBJECT_ID(N'dbo.KeepsakeCollectionRecords', N'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [KeepsakeCollectionRecords] (
|
||||
[KeepsakeCollectionRecordId] bigint IDENTITY(1,1) NOT NULL,
|
||||
[AccountId] bigint NOT NULL,
|
||||
[KeepsakeInstanceId] uniqueidentifier NOT NULL,
|
||||
[KeepsakeCategoryId] int NOT NULL,
|
||||
[CollectedAt] datetime2 NOT NULL,
|
||||
CONSTRAINT [PK_KeepsakeCollectionRecords] PRIMARY KEY ([KeepsakeCollectionRecordId])
|
||||
);
|
||||
CREATE UNIQUE INDEX [IX_KeepsakeCollectionRecords_AccountId_KeepsakeInstanceId]
|
||||
ON [KeepsakeCollectionRecords] ([AccountId], [KeepsakeInstanceId]);
|
||||
END");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.KeepsakeCollectionRecords', N'U') IS NOT NULL DROP TABLE [KeepsakeCollectionRecords];
|
||||
IF OBJECT_ID(N'dbo.KeepsakeInstances', N'U') IS NOT NULL DROP TABLE [KeepsakeInstances];");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user