Skip to content

Commit 0451c68

Browse files
committed
Correcting Migratioms
1 parent 4f16b2a commit 0451c68

6 files changed

+106
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,4 @@ __pycache__/
261261
*.pyc
262262
/PapyrusCs/UnicornClicker2.db
263263
/PapyrusCs/UnicornClicker.db
264+
/PapyrusCs/Properties/PublishProfiles/FolderProfile.pubxml

PapyrusCs/Database/Settings.cs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class Settings
1111
public string Format { get; set; }
1212
public int Quality { get; set; }
1313

14+
public int ChunksPerDimension { get; set; }
15+
1416
public int MaxZoom { get; set; }
1517
public int MinZoom { get; set; }
1618
}

PapyrusCs/Migrations/20190801161220_chunksperdimension.Designer.cs

+65
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace PapyrusCs.Migrations
4+
{
5+
public partial class chunksperdimension : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
10+
11+
migrationBuilder.AddColumn<int>(
12+
name: "ChunksPerDimension",
13+
table: "Settings",
14+
nullable: false,
15+
defaultValue: 2);
16+
17+
18+
}
19+
20+
protected override void Down(MigrationBuilder migrationBuilder)
21+
{
22+
migrationBuilder.DropColumn(
23+
name: "ChunksPerDimension",
24+
table: "Settings");
25+
26+
27+
}
28+
}
29+
}

PapyrusCs/Migrations/PapyrusContextModelSnapshot.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
2525

2626
b.Property<byte[]>("LevelDbKey");
2727

28-
b.Property<string>("Profile").HasDefaultValue("");
28+
b.Property<string>("Profile");
2929

3030
b.HasKey("Id");
3131

@@ -39,16 +39,18 @@ protected override void BuildModel(ModelBuilder modelBuilder)
3939
b.Property<int>("Id")
4040
.ValueGeneratedOnAdd();
4141

42-
b.Property<int>("Dimension");
42+
b.Property<int>("ChunksPerDimension");
4343

44-
b.Property<string>("Profile").HasDefaultValue("");
44+
b.Property<int>("Dimension");
4545

4646
b.Property<string>("Format");
4747

4848
b.Property<int>("MaxZoom");
4949

5050
b.Property<int>("MinZoom");
5151

52+
b.Property<string>("Profile");
53+
5254
b.Property<int>("Quality");
5355

5456
b.HasKey("Id");

PapyrusCs/Strategies/Dataflow/DataFlowStrategy.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ public void Init()
399399
{
400400
this.FileFormat = settings.Format;
401401
this.FileQuality = settings.Quality;
402-
Console.WriteLine("Overriding settings with: Format {0}, Quality {1}", FileFormat, FileQuality);
402+
this.ChunksPerDimension = settings.ChunksPerDimension;
403+
Console.WriteLine("Overriding settings with: Format {0}, Quality {1} ChunksPerDimension {2}", FileFormat, FileQuality, ChunksPerDimension);
403404

404405
settings.MaxZoom = NewInitialZoomLevel;
405406
settings.MinZoom = NewLastZoomLevel;
@@ -408,6 +409,7 @@ public void Init()
408409
}
409410
else
410411
{
412+
411413
settings = new Settings()
412414
{
413415
Dimension = Dimension,
@@ -416,6 +418,7 @@ public void Init()
416418
Format = FileFormat,
417419
MaxZoom = this.NewInitialZoomLevel,
418420
MinZoom = this.NewLastZoomLevel,
421+
ChunksPerDimension = db.Settings.FirstOrDefault()?.ChunksPerDimension ?? this.ChunksPerDimension
419422
};
420423
db.Add(settings);
421424
db.SaveChanges();

0 commit comments

Comments
 (0)