Skip to content

Commit babb80c

Browse files
author
Ovan Crone
committed
Added a SchematicName column in EF provider for query capability
1 parent fa71e00 commit babb80c

File tree

6 files changed

+154
-1
lines changed

6 files changed

+154
-1
lines changed

src/REstate.Engine.Repositories.EntityFrameworkCore/Machine.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class Machine
1515

1616
public List<MetadataEntry> MetadataEntries { get; set; }
1717

18+
public string SchematicName { get; set; }
19+
1820
public byte[] SchematicBytes { get; set; }
1921

2022
public List<StateBagEntry> StateBagEntries { get; set; }

src/REstate.Engine.Repositories.EntityFrameworkCore/REstateDbContext.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
4747
.Property(status => status.CommitNumber)
4848
.IsRequired()
4949
.IsConcurrencyToken();
50-
50+
51+
modelBuilder.Entity<Machine>()
52+
.Property(machine => machine.SchematicName)
53+
.IsUnicode(false)
54+
.HasMaxLength(450)
55+
.IsRequired(false);
56+
5157
modelBuilder.Entity<Machine>()
5258
.Property(status => status.UpdatedTime)
5359
.IsRequired();

src/REstate.Engine.Repositories.EntityFrameworkCore/Repository.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ public async Task<MachineStatus<TState, TInput>> CreateMachineAsync(
104104
var record = new Machine
105105
{
106106
MachineId = id,
107+
SchematicName = schematic.SchematicName,
107108
SchematicBytes = schematicBytes,
108109
StateJson = stateJson,
109110
CommitNumber = commitNumber,

src/REstate.EntityFrameworkCore.Migrations.SqlServer/Migrations/20190103225907_AddSchematicNameToMachines.Designer.cs

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace REstate.EntityFrameworkCore.Migrations.SqlServer.Migrations
4+
{
5+
public partial class AddSchematicNameToMachines : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
migrationBuilder.AddColumn<string>(
10+
name: "SchematicName",
11+
table: "Machines",
12+
unicode: false,
13+
maxLength: 450,
14+
nullable: true);
15+
}
16+
17+
protected override void Down(MigrationBuilder migrationBuilder)
18+
{
19+
migrationBuilder.DropColumn(
20+
name: "SchematicName",
21+
table: "Machines");
22+
}
23+
}
24+
}

src/REstate.EntityFrameworkCore.Migrations.SqlServer/Migrations/REstateDbContextModelSnapshot.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ protected override void BuildModel(ModelBuilder modelBuilder)
3131

3232
b.Property<byte[]>("SchematicBytes");
3333

34+
b.Property<string>("SchematicName")
35+
.HasMaxLength(450)
36+
.IsUnicode(false);
37+
3438
b.Property<string>("StateJson")
3539
.IsRequired()
3640
.IsUnicode(false);

0 commit comments

Comments
 (0)