limiting some field lengths

This commit is contained in:
Hamid Reza Mohammadi 2025-01-25 16:51:30 +03:30
parent 0906933cc8
commit 2099633429
4 changed files with 6205 additions and 14 deletions

View File

@ -250,12 +250,12 @@ namespace RMuseum.DbContext
.Property(e => e.PoemSummary)
.HasMaxLength(3000);
/*
Phase 2:
//Phase 2:
builder.Entity<RArtifactMasterRecord>()
.Property(e => e.FriendlyUrl)
.HasMaxLength(40);
.HasMaxLength(64);
builder.Entity<RArtifactMasterRecord>()
.Property(e => e.Name)
@ -292,7 +292,7 @@ namespace RMuseum.DbContext
builder.Entity<RTag>()
.Property(e => e.PluralNameInEnglish)
.HasMaxLength(128);
*/
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,218 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class LimitFieldLengths : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "PluralNameInEnglish",
table: "Tags",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "PluralName",
table: "Tags",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Tags",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Tags",
type: "nvarchar(128)",
maxLength: 128,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Items",
type: "nvarchar(1200)",
maxLength: 1200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Items",
type: "nvarchar(1200)",
maxLength: 1200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FriendlyUrl",
table: "Items",
type: "nvarchar(16)",
maxLength: 16,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Artifacts",
type: "nvarchar(1200)",
maxLength: 1200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Artifacts",
type: "nvarchar(1200)",
maxLength: 1200,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FriendlyUrl",
table: "Artifacts",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "PluralNameInEnglish",
table: "Tags",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "PluralName",
table: "Tags",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Tags",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Tags",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(128)",
oldMaxLength: 128,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Items",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1200)",
oldMaxLength: 1200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Items",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1200)",
oldMaxLength: 1200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FriendlyUrl",
table: "Items",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(16)",
oldMaxLength: 16,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "NameInEnglish",
table: "Artifacts",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1200)",
oldMaxLength: 1200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "Artifacts",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1200)",
oldMaxLength: 1200,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "FriendlyUrl",
table: "Artifacts",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
}
}
}

View File

@ -235,16 +235,19 @@ namespace RMuseum.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("FriendlyUrl")
.HasColumnType("nvarchar(450)");
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<DateTime>("LastModified")
.HasColumnType("datetime2");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
.HasMaxLength(1200)
.HasColumnType("nvarchar(1200)");
b.Property<string>("NameInEnglish")
.HasColumnType("nvarchar(max)");
.HasMaxLength(1200)
.HasColumnType("nvarchar(1200)");
b.Property<int>("Order")
.HasColumnType("int");
@ -286,7 +289,8 @@ namespace RMuseum.Migrations
.HasColumnType("nvarchar(max)");
b.Property<string>("FriendlyUrl")
.HasColumnType("nvarchar(450)");
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("ItemCount")
.HasColumnType("int");
@ -295,10 +299,12 @@ namespace RMuseum.Migrations
.HasColumnType("datetime2");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
.HasMaxLength(1200)
.HasColumnType("nvarchar(1200)");
b.Property<string>("NameInEnglish")
.HasColumnType("nvarchar(max)");
.HasMaxLength(1200)
.HasColumnType("nvarchar(1200)");
b.Property<int>("Status")
.HasColumnType("int");
@ -331,19 +337,23 @@ namespace RMuseum.Migrations
.HasColumnType("bit");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NameInEnglish")
.HasColumnType("nvarchar(max)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<int>("Order")
.HasColumnType("int");
b.Property<string>("PluralName")
.HasColumnType("nvarchar(max)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PluralNameInEnglish")
.HasColumnType("nvarchar(max)");
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<int>("Status")
.HasColumnType("int");