added a Migration

docker_db
Jukoga 2024-11-26 22:14:28 +01:00
parent 7e70ca87f6
commit a7cd03d64d
3 changed files with 333 additions and 25 deletions

View File

@ -0,0 +1,92 @@
// <auto-generated />
using BHServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace BHServer.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20241126211247_working state naming")]
partial class workingstatenaming
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("BHServer.Models.AssaultTroop", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<int>("faction")
.HasColumnType("integer");
b.Property<string>("name")
.IsRequired()
.HasColumnType("text");
b.Property<string>("orders")
.IsRequired()
.HasColumnType("text");
b.Property<int>("owner")
.HasColumnType("integer");
b.Property<int>("province")
.HasColumnType("integer");
b.Property<int>("type")
.HasColumnType("integer");
b.HasKey("id");
b.ToTable("assault_troop");
});
modelBuilder.Entity("BHServer.Models.Province", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("ats")
.IsRequired()
.HasColumnType("text");
b.Property<int>("faction")
.HasColumnType("integer");
b.Property<int>("multiplier")
.HasColumnType("integer");
b.Property<string>("name")
.IsRequired()
.HasColumnType("text");
b.Property<int>("state")
.HasColumnType("integer");
b.HasKey("id");
b.ToTable("province");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,222 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BHServer.Migrations
{
/// <inheritdoc />
public partial class workingstatenaming : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_Province",
table: "Province");
migrationBuilder.DropPrimaryKey(
name: "PK_AssaultTroop",
table: "AssaultTroop");
migrationBuilder.DropColumn(
name: "ProvinceId",
table: "Province");
migrationBuilder.DropColumn(
name: "ATId",
table: "AssaultTroop");
migrationBuilder.RenameTable(
name: "Province",
newName: "province");
migrationBuilder.RenameTable(
name: "AssaultTroop",
newName: "assault_troop");
migrationBuilder.RenameColumn(
name: "State",
table: "province",
newName: "state");
migrationBuilder.RenameColumn(
name: "Name",
table: "province",
newName: "name");
migrationBuilder.RenameColumn(
name: "Multiplier",
table: "province",
newName: "multiplier");
migrationBuilder.RenameColumn(
name: "Faction",
table: "province",
newName: "faction");
migrationBuilder.RenameColumn(
name: "ATs",
table: "province",
newName: "ats");
migrationBuilder.RenameColumn(
name: "Id",
table: "province",
newName: "id");
migrationBuilder.RenameColumn(
name: "Type",
table: "assault_troop",
newName: "type");
migrationBuilder.RenameColumn(
name: "Province",
table: "assault_troop",
newName: "province");
migrationBuilder.RenameColumn(
name: "Owner",
table: "assault_troop",
newName: "owner");
migrationBuilder.RenameColumn(
name: "Orders",
table: "assault_troop",
newName: "orders");
migrationBuilder.RenameColumn(
name: "Name",
table: "assault_troop",
newName: "name");
migrationBuilder.RenameColumn(
name: "Faction",
table: "assault_troop",
newName: "faction");
migrationBuilder.RenameColumn(
name: "Id",
table: "assault_troop",
newName: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_province",
table: "province",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_assault_troop",
table: "assault_troop",
column: "id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_province",
table: "province");
migrationBuilder.DropPrimaryKey(
name: "PK_assault_troop",
table: "assault_troop");
migrationBuilder.RenameTable(
name: "province",
newName: "Province");
migrationBuilder.RenameTable(
name: "assault_troop",
newName: "AssaultTroop");
migrationBuilder.RenameColumn(
name: "state",
table: "Province",
newName: "State");
migrationBuilder.RenameColumn(
name: "name",
table: "Province",
newName: "Name");
migrationBuilder.RenameColumn(
name: "multiplier",
table: "Province",
newName: "Multiplier");
migrationBuilder.RenameColumn(
name: "faction",
table: "Province",
newName: "Faction");
migrationBuilder.RenameColumn(
name: "ats",
table: "Province",
newName: "ATs");
migrationBuilder.RenameColumn(
name: "id",
table: "Province",
newName: "Id");
migrationBuilder.RenameColumn(
name: "type",
table: "AssaultTroop",
newName: "Type");
migrationBuilder.RenameColumn(
name: "province",
table: "AssaultTroop",
newName: "Province");
migrationBuilder.RenameColumn(
name: "owner",
table: "AssaultTroop",
newName: "Owner");
migrationBuilder.RenameColumn(
name: "orders",
table: "AssaultTroop",
newName: "Orders");
migrationBuilder.RenameColumn(
name: "name",
table: "AssaultTroop",
newName: "Name");
migrationBuilder.RenameColumn(
name: "faction",
table: "AssaultTroop",
newName: "Faction");
migrationBuilder.RenameColumn(
name: "id",
table: "AssaultTroop",
newName: "Id");
migrationBuilder.AddColumn<int>(
name: "ProvinceId",
table: "Province",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "ATId",
table: "AssaultTroop",
type: "integer",
nullable: false,
defaultValue: 0);
migrationBuilder.AddPrimaryKey(
name: "PK_Province",
table: "Province",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_AssaultTroop",
table: "AssaultTroop",
column: "Id");
}
}
}

View File

@ -23,71 +23,65 @@ namespace BHServer.Migrations
modelBuilder.Entity("BHServer.Models.AssaultTroop", b => modelBuilder.Entity("BHServer.Models.AssaultTroop", b =>
{ {
b.Property<int>("Id") b.Property<int>("id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<int>("ATId") b.Property<int>("faction")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Faction") b.Property<string>("name")
.HasColumnType("integer");
b.Property<string>("Name")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<string>("Orders") b.Property<string>("orders")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("Owner") b.Property<int>("owner")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Province") b.Property<int>("province")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Type") b.Property<int>("type")
.HasColumnType("integer"); .HasColumnType("integer");
b.HasKey("Id"); b.HasKey("id");
b.ToTable("AssaultTroop"); b.ToTable("assault_troop");
}); });
modelBuilder.Entity("BHServer.Models.Province", b => modelBuilder.Entity("BHServer.Models.Province", b =>
{ {
b.Property<int>("Id") b.Property<int>("id")
.ValueGeneratedOnAdd() .ValueGeneratedOnAdd()
.HasColumnType("integer"); .HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id")); NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("ATs") b.Property<string>("ats")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("Faction") b.Property<int>("faction")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("Multiplier") b.Property<int>("multiplier")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<string>("Name") b.Property<string>("name")
.IsRequired() .IsRequired()
.HasColumnType("text"); .HasColumnType("text");
b.Property<int>("ProvinceId") b.Property<int>("state")
.HasColumnType("integer"); .HasColumnType("integer");
b.Property<int>("State") b.HasKey("id");
.HasColumnType("integer");
b.HasKey("Id"); b.ToTable("province");
b.ToTable("Province");
}); });
#pragma warning restore 612, 618 #pragma warning restore 612, 618
} }