WIP: copy process

This commit is contained in:
Michał Zieliński
2023-09-18 11:29:25 +02:00
parent 5cb362b5e0
commit 716ed532f1
11 changed files with 809 additions and 61 deletions

View File

@@ -0,0 +1,302 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebAPI;
#nullable disable
namespace WebAPI.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20230917110252_Layer.parent")]
partial class Layerparent
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Number")
.HasColumnType("int");
b.Property<string>("Source")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("parentId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ModifiedById");
b.HasIndex("parentId");
b.ToTable("Layers");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<float?>("Value1")
.HasColumnType("real");
b.Property<float?>("Value10")
.HasColumnType("real");
b.Property<float?>("Value11")
.HasColumnType("real");
b.Property<float?>("Value12")
.HasColumnType("real");
b.Property<float?>("Value13")
.HasColumnType("real");
b.Property<float?>("Value14")
.HasColumnType("real");
b.Property<float?>("Value15")
.HasColumnType("real");
b.Property<float?>("Value16")
.HasColumnType("real");
b.Property<float?>("Value17")
.HasColumnType("real");
b.Property<float?>("Value18")
.HasColumnType("real");
b.Property<float?>("Value19")
.HasColumnType("real");
b.Property<float?>("Value2")
.HasColumnType("real");
b.Property<float?>("Value20")
.HasColumnType("real");
b.Property<float?>("Value21")
.HasColumnType("real");
b.Property<float?>("Value22")
.HasColumnType("real");
b.Property<float?>("Value23")
.HasColumnType("real");
b.Property<float?>("Value24")
.HasColumnType("real");
b.Property<float?>("Value25")
.HasColumnType("real");
b.Property<float?>("Value26")
.HasColumnType("real");
b.Property<float?>("Value27")
.HasColumnType("real");
b.Property<float?>("Value28")
.HasColumnType("real");
b.Property<float?>("Value29")
.HasColumnType("real");
b.Property<float?>("Value3")
.HasColumnType("real");
b.Property<float?>("Value30")
.HasColumnType("real");
b.Property<float?>("Value31")
.HasColumnType("real");
b.Property<float?>("Value4")
.HasColumnType("real");
b.Property<float?>("Value5")
.HasColumnType("real");
b.Property<float?>("Value6")
.HasColumnType("real");
b.Property<float?>("Value7")
.HasColumnType("real");
b.Property<float?>("Value8")
.HasColumnType("real");
b.Property<float?>("Value9")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("LayerId");
b.HasIndex("ModifiedById");
b.ToTable("Records");
});
modelBuilder.Entity("WebAPI.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", "parent")
.WithMany()
.HasForeignKey("parentId");
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
b.Navigation("parent");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", null)
.WithMany("Records")
.HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Navigation("Records");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebAPI.Migrations
{
/// <inheritdoc />
public partial class Layerparent : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "parentId",
table: "Layers",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateIndex(
name: "IX_Layers_parentId",
table: "Layers",
column: "parentId");
migrationBuilder.AddForeignKey(
name: "FK_Layers_Layers_parentId",
table: "Layers",
column: "parentId",
principalTable: "Layers",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Layers_Layers_parentId",
table: "Layers");
migrationBuilder.DropIndex(
name: "IX_Layers_parentId",
table: "Layers");
migrationBuilder.DropColumn(
name: "parentId",
table: "Layers");
}
}
}

View File

@@ -0,0 +1,330 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using WebAPI;
#nullable disable
namespace WebAPI.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20230918090621_ProcessSource")]
partial class ProcessSource
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.10")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Number")
.HasColumnType("int");
b.Property<string>("Source")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("parentId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ModifiedById");
b.HasIndex("parentId");
b.ToTable("Layers");
});
modelBuilder.Entity("WebAPI.Models.ProcessSource", b =>
{
b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("SourceId")
.HasColumnType("uniqueidentifier");
b.HasKey("LayerId", "SourceId");
b.HasIndex("SourceId");
b.ToTable("ProcessSources");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("Code")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<Guid>("CreatedById")
.HasColumnType("uniqueidentifier");
b.Property<string>("Desc1")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc2")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc3")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc4")
.HasColumnType("nvarchar(max)");
b.Property<string>("Desc5")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("ModifiedAt")
.HasColumnType("datetime2");
b.Property<Guid>("ModifiedById")
.HasColumnType("uniqueidentifier");
b.Property<float?>("Value1")
.HasColumnType("real");
b.Property<float?>("Value10")
.HasColumnType("real");
b.Property<float?>("Value11")
.HasColumnType("real");
b.Property<float?>("Value12")
.HasColumnType("real");
b.Property<float?>("Value13")
.HasColumnType("real");
b.Property<float?>("Value14")
.HasColumnType("real");
b.Property<float?>("Value15")
.HasColumnType("real");
b.Property<float?>("Value16")
.HasColumnType("real");
b.Property<float?>("Value17")
.HasColumnType("real");
b.Property<float?>("Value18")
.HasColumnType("real");
b.Property<float?>("Value19")
.HasColumnType("real");
b.Property<float?>("Value2")
.HasColumnType("real");
b.Property<float?>("Value20")
.HasColumnType("real");
b.Property<float?>("Value21")
.HasColumnType("real");
b.Property<float?>("Value22")
.HasColumnType("real");
b.Property<float?>("Value23")
.HasColumnType("real");
b.Property<float?>("Value24")
.HasColumnType("real");
b.Property<float?>("Value25")
.HasColumnType("real");
b.Property<float?>("Value26")
.HasColumnType("real");
b.Property<float?>("Value27")
.HasColumnType("real");
b.Property<float?>("Value28")
.HasColumnType("real");
b.Property<float?>("Value29")
.HasColumnType("real");
b.Property<float?>("Value3")
.HasColumnType("real");
b.Property<float?>("Value30")
.HasColumnType("real");
b.Property<float?>("Value31")
.HasColumnType("real");
b.Property<float?>("Value4")
.HasColumnType("real");
b.Property<float?>("Value5")
.HasColumnType("real");
b.Property<float?>("Value6")
.HasColumnType("real");
b.Property<float?>("Value7")
.HasColumnType("real");
b.Property<float?>("Value8")
.HasColumnType("real");
b.Property<float?>("Value9")
.HasColumnType("real");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("LayerId");
b.HasIndex("ModifiedById");
b.ToTable("Records");
});
modelBuilder.Entity("WebAPI.Models.User", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime2");
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", "parent")
.WithMany()
.HasForeignKey("parentId");
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
b.Navigation("parent");
});
modelBuilder.Entity("WebAPI.Models.ProcessSource", b =>
{
b.HasOne("WebAPI.Models.Layer", "Source")
.WithMany("Sources")
.HasForeignKey("SourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Source");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.HasOne("WebAPI.Models.User", "CreatedBy")
.WithMany()
.HasForeignKey("CreatedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", null)
.WithMany("Records")
.HasForeignKey("LayerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.User", "ModifiedBy")
.WithMany()
.HasForeignKey("ModifiedById")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
});
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Navigation("Records");
b.Navigation("Sources");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace WebAPI.Migrations
{
/// <inheritdoc />
public partial class ProcessSource : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ProcessSources",
columns: table => new
{
LayerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SourceId = table.Column<Guid>(type: "uniqueidentifier", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_ProcessSources", x => new { x.LayerId, x.SourceId });
table.ForeignKey(
name: "FK_ProcessSources_Layers_SourceId",
column: x => x.SourceId,
principalTable: "Layers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_ProcessSources_SourceId",
table: "ProcessSources",
column: "SourceId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ProcessSources");
}
}
}

View File

@@ -57,15 +57,35 @@ namespace WebAPI.Migrations
b.Property<int>("Type")
.HasColumnType("int");
b.Property<Guid?>("parentId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("CreatedById");
b.HasIndex("ModifiedById");
b.HasIndex("parentId");
b.ToTable("Layers");
});
modelBuilder.Entity("WebAPI.Models.ProcessSource", b =>
{
b.Property<Guid>("LayerId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("SourceId")
.HasColumnType("uniqueidentifier");
b.HasKey("LayerId", "SourceId");
b.HasIndex("SourceId");
b.ToTable("ProcessSources");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
{
b.Property<Guid>("Id")
@@ -248,9 +268,26 @@ namespace WebAPI.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("WebAPI.Models.Layer", "parent")
.WithMany()
.HasForeignKey("parentId");
b.Navigation("CreatedBy");
b.Navigation("ModifiedBy");
b.Navigation("parent");
});
modelBuilder.Entity("WebAPI.Models.ProcessSource", b =>
{
b.HasOne("WebAPI.Models.Layer", "Source")
.WithMany("Sources")
.HasForeignKey("SourceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Source");
});
modelBuilder.Entity("WebAPI.Models.Record", b =>
@@ -281,6 +318,8 @@ namespace WebAPI.Migrations
modelBuilder.Entity("WebAPI.Models.Layer", b =>
{
b.Navigation("Records");
b.Navigation("Sources");
});
#pragma warning restore 612, 618
}