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(nullable: false) .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), DiscordGuildId = table.Column(nullable: false), TargetId = table.Column(nullable: false), TargetType = table.Column(nullable: false), Command = table.Column(nullable: false) }, 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); } } public enum PermissionTarget { User, Role } }