MySQL insists on a bunch of migration changes

This commit is contained in:
Jordan Dominion
2024-04-20 11:43:42 -04:00
parent d1f61dd633
commit 94ca8d38d1
3 changed files with 1516 additions and 1 deletions
@@ -0,0 +1,329 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Tgstation.Server.Host.Database.Migrations
{
/// <inheritdoc />
public partial class MYNormalizeVersionUpdates : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Users",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "TestMerges",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RevisionInformations",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RevInfoTestMerges",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RepositorySettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ReattachInformations",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "PermissionSets",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "OAuthConnections",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Jobs",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Instances",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "InstancePermissionSets",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Groups",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "DreamMakerSettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "DreamDaemonSettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "CompileJobs",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ChatChannels",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ChatBots",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
ArgumentNullException.ThrowIfNull(migrationBuilder);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Users",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "TestMerges",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RevisionInformations",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RevInfoTestMerges",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "RepositorySettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ReattachInformations",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "PermissionSets",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "OAuthConnections",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Jobs",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Instances",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "InstancePermissionSets",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "Groups",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "DreamMakerSettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "DreamDaemonSettings",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "CompileJobs",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ChatChannels",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "ChatBots",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
}
}
}
@@ -13,15 +13,19 @@ namespace Tgstation.Server.Host.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.1")
.HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Tgstation.Server.Host.Models.ChatBot", b =>
{
b.Property<long?>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<ushort?>("ChannelLimit")
.IsRequired()
.HasColumnType("smallint unsigned");
@@ -65,6 +69,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<long>("ChatSettingsId")
.HasColumnType("bigint");
@@ -116,6 +122,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<int?>("DMApiMajorVersion")
.HasColumnType("int");
@@ -185,6 +193,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<string>("AdditionalParameters")
.IsRequired()
.HasMaxLength(10000)
@@ -259,6 +269,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<ushort?>("ApiValidationPort")
.IsRequired()
.HasColumnType("smallint unsigned");
@@ -297,6 +309,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<uint?>("AutoUpdateInterval")
.IsRequired()
.HasColumnType("int unsigned");
@@ -344,6 +358,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<ulong>("ChatBotRights")
.HasColumnType("bigint unsigned");
@@ -387,6 +403,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<ulong?>("CancelRight")
.HasColumnType("bigint unsigned");
@@ -447,6 +465,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ExternalUserId")
.IsRequired()
.HasMaxLength(100)
@@ -476,6 +496,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<ulong>("AdministrationRights")
.HasColumnType("bigint unsigned");
@@ -505,6 +527,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<string>("AccessIdentifier")
.IsRequired()
.HasColumnType("longtext");
@@ -550,6 +574,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<string>("AccessToken")
.HasMaxLength(10000)
.HasColumnType("longtext");
@@ -621,6 +647,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<long>("RevisionInformationId")
.HasColumnType("bigint");
@@ -642,6 +670,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<string>("CommitSha")
.IsRequired()
.HasMaxLength(40)
@@ -676,6 +706,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<string>("Author")
.IsRequired()
.HasColumnType("longtext");
@@ -742,6 +774,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<string>("CanonicalName")
.IsRequired()
.HasMaxLength(100)
@@ -805,6 +839,8 @@ namespace Tgstation.Server.Host.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long?>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)