Skip to content

Commit

Permalink
feat: Resize address fields according to customer address fields
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyshibanov committed May 31, 2024
1 parent 223443b commit 6337006
Show file tree
Hide file tree
Showing 10 changed files with 2,148 additions and 44 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace VirtoCommerce.QuoteModule.Data.MySql.Migrations
{
/// <inheritdoc />
public partial class ResizeAddressFields : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Organization",
table: "QuoteAddress",
type: "varchar(512)",
maxLength: 512,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(64)",
oldMaxLength: 64,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "QuoteAddress",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(64)",
oldMaxLength: 64)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "QuoteAddress",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(64)",
oldMaxLength: 64)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "Email",
table: "QuoteAddress",
type: "varchar(256)",
maxLength: 256,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(254)",
oldMaxLength: 254,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "CountryName",
table: "QuoteAddress",
type: "varchar(128)",
maxLength: 128,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(64)",
oldMaxLength: 64)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "AddressType",
table: "QuoteAddress",
type: "varchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(32)",
oldMaxLength: 32,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Organization",
table: "QuoteAddress",
type: "varchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(512)",
oldMaxLength: 512,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "LastName",
table: "QuoteAddress",
type: "varchar(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "FirstName",
table: "QuoteAddress",
type: "varchar(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "Email",
table: "QuoteAddress",
type: "varchar(254)",
maxLength: 254,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(256)",
oldMaxLength: 256,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "CountryName",
table: "QuoteAddress",
type: "varchar(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(128)",
oldMaxLength: 128)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");

migrationBuilder.AlterColumn<string>(
name: "AddressType",
table: "QuoteAddress",
type: "varchar(32)",
maxLength: 32,
nullable: true,
oldClrType: typeof(string),
oldType: "varchar(64)",
oldMaxLength: 64,
oldNullable: true)
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using VirtoCommerce.QuoteModule.Data.Repositories;

Expand All @@ -16,9 +17,11 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("ProductVersion", "8.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 64);

MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);

modelBuilder.Entity("VirtoCommerce.QuoteModule.Data.Model.AddressEntity", b =>
{
b.Property<string>("Id")
Expand All @@ -27,8 +30,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("varchar(128)");
b.Property<string>("AddressType")
.HasMaxLength(32)
.HasColumnType("varchar(32)");
.HasMaxLength(64)
.HasColumnType("varchar(64)");
b.Property<string>("City")
.IsRequired()
Expand All @@ -41,22 +44,22 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Property<string>("CountryName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Email")
.HasMaxLength(254)
.HasColumnType("varchar(254)");
.HasMaxLength(256)
.HasColumnType("varchar(256)");
b.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("LastName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("varchar(64)");
.HasMaxLength(128)
.HasColumnType("varchar(128)");
b.Property<string>("Line1")
.HasMaxLength(2048)
Expand All @@ -67,8 +70,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("varchar(2048)");
b.Property<string>("Organization")
.HasMaxLength(64)
.HasColumnType("varchar(64)");
.HasMaxLength(512)
.HasColumnType("varchar(512)");
b.Property<string>("OuterId")
.HasMaxLength(128)
Expand Down
Loading

0 comments on commit 6337006

Please sign in to comment.