37 lines
1.4 KiB
C#
37 lines
1.4 KiB
C#
using ChaosBot.Models;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
namespace ChaosBot.Migrations
|
|
{
|
|
public partial class CommandPermissions : Migration
|
|
{
|
|
private const string Table = "CommandPermissions";
|
|
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.CreateTable(
|
|
name: Table,
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<ulong>(nullable: false)
|
|
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
|
|
DiscordGuildId = table.Column<ulong>(nullable: false),
|
|
TargetId = table.Column<ulong>(nullable: false),
|
|
TargetType = table.Column<PermissionTarget>(nullable: false),
|
|
Command = table.Column<string>(nullable: false, maxLength: 128)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_ID", x => x.Id);
|
|
table.UniqueConstraint("UK_OneCommandPerTargetOnGuild", x => new {x.DiscordGuildId, x.TargetType, x.TargetId, x.Command});
|
|
});
|
|
}
|
|
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(Table);
|
|
}
|
|
}
|
|
}
|