Skip to content

Commit

Permalink
Added migrations to shorten keys
Browse files Browse the repository at this point in the history
- also updates to license expression, NO LICENSE CHANGE
  • Loading branch information
Ovan Crone committed Jan 3, 2019
1 parent d4dd0c0 commit 40d6b24
Show file tree
Hide file tree
Showing 12 changed files with 336 additions and 8 deletions.
3 changes: 3 additions & 0 deletions src/Directory.build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<Project>
<PropertyGroup>

<PackageLicenseExpression>MIT</PackageLicenseExpression>

<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<Company>Psibernetic Solutions</Company>
<Description>Concurrency primitives such as Semaphores and mutexes build on REstate Machines.</Description>
<Copyright>Ovan Crone 2016</Copyright>
<PackageLicenseUrl>https://github.com/psibr/REstate/blob/v6.0/LICENSE</PackageLicenseUrl>
<Version>3.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<Company>Psibernetic Solutions</Company>
<Description>Entity Framework Core repository for REstate Machines and Schematics.</Description>
<Copyright>Ovan Crone 2016</Copyright>
<PackageLicenseUrl>https://github.com/psibr/REstate/blob/v6.0/LICENSE</PackageLicenseUrl>
<Version>3.0.0</Version>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<FileVersion>3.0.0.0</FileVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<Machine>()
.Property(machine => machine.MachineId)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired();

modelBuilder.Entity<Machine>()
Expand Down Expand Up @@ -69,11 +70,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<MetadataEntry>()
.Property(entry => entry.MachineId)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired();

modelBuilder.Entity<MetadataEntry>()
.Property(entry => entry.Key)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired();

modelBuilder.Entity<StateBagEntry>()
Expand All @@ -86,11 +89,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
modelBuilder.Entity<StateBagEntry>()
.Property(entry => entry.MachineId)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired();

modelBuilder.Entity<StateBagEntry>()
.Property(entry => entry.Key)
.IsUnicode(false)
.HasMaxLength(450)
.IsRequired();

modelBuilder.Entity<Schematic>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<Product>REstate</Product>
<Description>Redis storage provider for REstate's engine.</Description>
<Copyright>Ovan Crone 2016</Copyright>
<PackageLicenseUrl>https://github.com/psibr/REstate/blob/v6.0/LICENSE</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/psibr/REstate</PackageProjectUrl>
<RepositoryUrl>https://github.com/psibr/REstate</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand Down

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
using Microsoft.EntityFrameworkCore.Migrations;

namespace REstate.EntityFrameworkCore.Migrations.SqlServer.Migrations
{
public partial class ShrinkKeys : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MetadataEntries_Machines_MachineId",
table: "MetadataEntries");

migrationBuilder.DropForeignKey(
name: "FK_StateBagEntries_Machines_MachineId",
table: "StateBagEntries");

migrationBuilder.DropPrimaryKey(
name: "PK_Machines",
table: "Machines");

migrationBuilder.DropPrimaryKey(
name: "PK_MetadataEntries",
table: "MetadataEntries");

migrationBuilder.DropPrimaryKey(
name: "PK_StateBagEntries",
table: "StateBagEntries");

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "Machines",
unicode: false,
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldUnicode: false);

migrationBuilder.AlterColumn<string>(
name: "Key",
table: "StateBagEntries",
unicode: false,
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldUnicode: false);

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "StateBagEntries",
unicode: false,
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldUnicode: false);

migrationBuilder.AlterColumn<string>(
name: "Key",
table: "MetadataEntries",
unicode: false,
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldUnicode: false);

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "MetadataEntries",
unicode: false,
maxLength: 450,
nullable: false,
oldClrType: typeof(string),
oldUnicode: false);

migrationBuilder.AddPrimaryKey(
name: "PK_Machines",
table: "Machines",
column: "MachineId");

migrationBuilder.AddPrimaryKey(
name: "PK_MetadataEntries",
table: "MetadataEntries",
columns: new[] { "MachineId", "Key" });

migrationBuilder.AddPrimaryKey(
name: "PK_StateBagEntries",
table: "StateBagEntries",
columns: new[] { "MachineId", "Key" });

migrationBuilder.AddForeignKey(
name: "FK_MetadataEntries_Machines_MachineId",
table: "MetadataEntries",
column: "MachineId",
principalTable: "Machines",
principalColumn: "MachineId",
onDelete: ReferentialAction.Cascade);

migrationBuilder.AddForeignKey(
name: "FK_StateBagEntries_Machines_MachineId",
table: "StateBagEntries",
column: "MachineId",
principalTable: "Machines",
principalColumn: "MachineId",
onDelete: ReferentialAction.Cascade);
}

protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MetadataEntries_Machines_MachineId",
table: "MetadataEntries");

migrationBuilder.DropForeignKey(
name: "FK_StateBagEntries_Machines_MachineId",
table: "StateBagEntries");

migrationBuilder.DropPrimaryKey(
name: "PK_Machines",
table: "Machines");

migrationBuilder.DropPrimaryKey(
name: "PK_MetadataEntries",
table: "MetadataEntries");

migrationBuilder.DropPrimaryKey(
name: "PK_StateBagEntries",
table: "StateBagEntries");

migrationBuilder.AlterColumn<string>(
name: "Key",
table: "StateBagEntries",
unicode: false,
nullable: false,
maxLength: 900,
oldClrType: typeof(string),
oldUnicode: false,
oldMaxLength: 450);

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "StateBagEntries",
unicode: false,
nullable: false,
maxLength: 900,
oldClrType: typeof(string),
oldUnicode: false,
oldMaxLength: 450);

migrationBuilder.AlterColumn<string>(
name: "Key",
table: "MetadataEntries",
unicode: false,
nullable: false,
maxLength: 900,
oldClrType: typeof(string),
oldUnicode: false,
oldMaxLength: 450);

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "MetadataEntries",
unicode: false,
nullable: false,
maxLength: 900,
oldClrType: typeof(string),
oldUnicode: false,
oldMaxLength: 450);

migrationBuilder.AlterColumn<string>(
name: "MachineId",
table: "Machines",
unicode: false,
nullable: false,
maxLength: 900,
oldClrType: typeof(string),
oldUnicode: false,
oldMaxLength: 450);

migrationBuilder.AddPrimaryKey(
name: "PK_Machines",
table: "Machines",
column: "MachineId");

migrationBuilder.AddPrimaryKey(
name: "PK_MetadataEntries",
table: "MetadataEntries",
columns: new[] { "MachineId", "Key" });

migrationBuilder.AddPrimaryKey(
name: "PK_StateBagEntries",
table: "StateBagEntries",
columns: new[] { "MachineId", "Key" });

migrationBuilder.AddForeignKey(
name: "FK_MetadataEntries_Machines_MachineId",
table: "MetadataEntries",
column: "MachineId",
principalTable: "Machines",
principalColumn: "MachineId",
onDelete: ReferentialAction.Cascade);

migrationBuilder.AddForeignKey(
name: "FK_StateBagEntries_Machines_MachineId",
table: "StateBagEntries",
column: "MachineId",
principalTable: "Machines",
principalColumn: "MachineId",
onDelete: ReferentialAction.Cascade);
}
}
}
Loading

0 comments on commit 40d6b24

Please sign in to comment.