1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Sync EF migrations for .NET / EF Core 8 (#4448)

* Sync EF migrations for .NET 8

* Format

* Redo migrations with billing fix

* Forgot to format again
This commit is contained in:
Matt Bishop
2024-07-02 10:08:34 -04:00
committed by GitHub
parent 554a004d7a
commit e8c5d73062
10 changed files with 8323 additions and 23 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,200 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Bit.MySqlMigrations.Migrations;
/// <inheritdoc />
public partial class Net8Sync : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_ProviderInvoiceItem_Id_InvoiceId",
table: "ProviderInvoiceItem");
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "SsoUser",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "SsoConfig",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "PlanName",
table: "ProviderInvoiceItem",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "InvoiceNumber",
table: "ProviderInvoiceItem",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "InvoiceId",
table: "ProviderInvoiceItem",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(255)",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ClientName",
table: "ProviderInvoiceItem",
type: "varchar(50)",
maxLength: 50,
nullable: true,
oldClrType: typeof(string),
oldType: "longtext",
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "Grant",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "AccessPolicy",
type: "varchar(34)",
maxLength: 34,
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "SsoUser",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<long>(
name: "Id",
table: "SsoConfig",
type: "bigint",
nullable: false,
oldClrType: typeof(long),
oldType: "bigint")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "PlanName",
table: "ProviderInvoiceItem",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "InvoiceNumber",
table: "ProviderInvoiceItem",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "InvoiceId",
table: "ProviderInvoiceItem",
type: "varchar(255)",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<string>(
name: "ClientName",
table: "ProviderInvoiceItem",
type: "longtext",
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(50)",
oldMaxLength: 50,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AlterColumn<int>(
name: "Id",
table: "Grant",
type: "int",
nullable: false,
oldClrType: typeof(int),
oldType: "int")
.OldAnnotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn);
migrationBuilder.AlterColumn<string>(
name: "Discriminator",
table: "AccessPolicy",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(34)",
oldMaxLength: 34)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ProviderInvoiceItem_Id_InvoiceId",
table: "ProviderInvoiceItem",
columns: new[] { "Id", "InvoiceId" },
unique: true);
}
}

View File

@ -3,6 +3,7 @@ using System;
using Bit.Infrastructure.EntityFramework.Repositories;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
@ -16,9 +17,11 @@ namespace Bit.MySqlMigrations.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.16")
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("Bit.Infrastructure.EntityFramework.AdminConsole.Models.Organization", b =>
{
b.Property<Guid>("Id")
@ -496,6 +499,8 @@ namespace Bit.MySqlMigrations.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientId")
.IsRequired()
.HasMaxLength(200)
@ -555,6 +560,8 @@ namespace Bit.MySqlMigrations.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
@ -583,6 +590,8 @@ namespace Bit.MySqlMigrations.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime(6)");
@ -682,19 +691,23 @@ namespace Bit.MySqlMigrations.Migrations
.HasColumnType("int");
b.Property<string>("ClientName")
.HasColumnType("longtext");
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<DateTime>("Created")
.HasColumnType("datetime(6)");
b.Property<string>("InvoiceId")
.HasColumnType("varchar(255)");
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("InvoiceNumber")
.HasColumnType("longtext");
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<string>("PlanName")
.HasColumnType("longtext");
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.Property<Guid>("ProviderId")
.HasColumnType("char(36)");
@ -709,9 +722,6 @@ namespace Bit.MySqlMigrations.Migrations
b.HasIndex("ProviderId");
b.HasIndex("Id", "InvoiceId")
.IsUnique();
b.ToTable("ProviderInvoiceItem", (string)null);
});
@ -1547,7 +1557,8 @@ namespace Bit.MySqlMigrations.Migrations
b.Property<string>("Discriminator")
.IsRequired()
.HasColumnType("longtext");
.HasMaxLength(34)
.HasColumnType("varchar(34)");
b.Property<bool>("Read")
.HasColumnType("tinyint(1)");