Skip to content

Commit

Permalink
Fix migrations (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
yonilerner authored Jan 16, 2024
1 parent f98654f commit d5b0473
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 36 deletions.
3 changes: 2 additions & 1 deletion RetakesAllocatorCore/Db/UserSetting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ public class UserSetting
[Key]
[Required]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Column(TypeName = "bigint")]
public ulong UserId { get; set; }

[Column(TypeName = "TEXT"), MaxLength(10000)]
[Column(TypeName = "text"), MaxLength(10000)]
public WeaponPreferencesType WeaponPreferences { get; set; } = new();

public static void Configure(ModelConfigurationBuilder configurationBuilder)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions RetakesAllocatorCore/Migrations/20240116025022_BigIntTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace RetakesAllocator.Migrations
{
/// <inheritdoc />
public partial class BigIntTime : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "WeaponPreferences",
table: "UserSettings",
type: "text",
maxLength: 10000,
nullable: true,
oldClrType: typeof(string),
oldType: "TEXT",
oldMaxLength: 10000,
oldNullable: true);

migrationBuilder.AlterColumn<ulong>(
name: "UserId",
table: "UserSettings",
type: "bigint",
nullable: false,
oldClrType: typeof(int),
oldType: "INTEGER");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "WeaponPreferences",
table: "UserSettings",
type: "TEXT",
maxLength: 10000,
nullable: true,
oldClrType: typeof(string),
oldType: "text",
oldMaxLength: 10000,
oldNullable: true);

migrationBuilder.AlterColumn<int>(
name: "UserId",
table: "UserSettings",
type: "INTEGER",
nullable: false,
oldClrType: typeof(ulong),
oldType: "bigint");
}
}
}
70 changes: 35 additions & 35 deletions RetakesAllocatorCore/Migrations/DbModelSnapshot.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RetakesAllocatorCore.Db;

#nullable disable

namespace RetakesAllocator.Migrations
{
[DbContext(typeof(Db))]
partial class DbModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.14");

modelBuilder.Entity("RetakesAllocator.db.UserSetting", b =>
{
b.Property<int>("UserId")
.HasColumnType("INTEGER");

b.Property<string>("WeaponPreferences")
.HasMaxLength(10000)
.HasColumnType("TEXT");

b.HasKey("UserId");

b.ToTable("UserSettings", (string)null);
});
#pragma warning restore 612, 618
}
}
}
// <auto-generated />
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using RetakesAllocatorCore.Db;

#nullable disable

namespace RetakesAllocator.Migrations
{
[DbContext(typeof(Db))]
partial class DbModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "7.0.14");

modelBuilder.Entity("RetakesAllocatorCore.Db.UserSetting", b =>
{
b.Property<ulong>("UserId")
.HasColumnType("bigint");

b.Property<string>("WeaponPreferences")
.HasMaxLength(10000)
.HasColumnType("text");

b.HasKey("UserId");

b.ToTable("UserSettings");
});
#pragma warning restore 612, 618
}
}
}

0 comments on commit d5b0473

Please sign in to comment.