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,49 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using RadicadeServer.DB;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace RadicadeServer.Migrations;
|
||||
|
||||
[DbContext(typeof(RecDBContext))]
|
||||
[Migration("20260921130000_AddCustomAvatarItems")]
|
||||
public partial class AddCustomAvatarItems : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.CustomAvatarItems', N'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE [dbo].[CustomAvatarItems] (
|
||||
[Id] bigint IDENTITY(1,1) NOT NULL,
|
||||
[CustomAvatarItemId] uniqueidentifier NOT NULL,
|
||||
[CreatorAccountId] bigint NOT NULL,
|
||||
[Name] nvarchar(max) NULL,
|
||||
[Description] nvarchar(max) NULL,
|
||||
[Price] int NOT NULL,
|
||||
[BaseAvatarItemId] int NOT NULL,
|
||||
[BaseAvatarItemColor] nvarchar(max) NULL,
|
||||
[Accessibility] int NOT NULL,
|
||||
[IsPublished] bit NOT NULL,
|
||||
[ImageName] nvarchar(max) NULL,
|
||||
[DesignFileName] nvarchar(max) NULL,
|
||||
[CreatedAt] datetime2 NOT NULL,
|
||||
[ModifiedAt] datetime2 NOT NULL,
|
||||
CONSTRAINT [PK_CustomAvatarItems] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
||||
-- Every read of this table is either ""by item id"" (the resolve calls, the single-item
|
||||
-- fetch) or ""by creator"" (my items, owned, fromCreator), so those are the two indexes.
|
||||
CREATE UNIQUE INDEX [IX_CustomAvatarItems_CustomAvatarItemId] ON [dbo].[CustomAvatarItems] ([CustomAvatarItemId]);
|
||||
CREATE INDEX [IX_CustomAvatarItems_CreatorAccountId] ON [dbo].[CustomAvatarItems] ([CreatorAccountId]);
|
||||
END");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.Sql(@"
|
||||
IF OBJECT_ID(N'dbo.CustomAvatarItems', N'U') IS NOT NULL
|
||||
DROP TABLE [dbo].[CustomAvatarItems];");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user