diff --git a/backend/api/Migrations/20221018071827_add-robot-name.Designer.cs b/backend/api/Migrations/20221018071827_add-robot-name.Designer.cs new file mode 100644 index 000000000..6d0ac5a0e --- /dev/null +++ b/backend/api/Migrations/20221018071827_add-robot-name.Designer.cs @@ -0,0 +1,375 @@ +// +using System; +using Api.Database.Context; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Api.Migrations +{ + [DbContext(typeof(FlotillaDbContext))] + [Migration("20221018071827_add-robot-name")] + partial class addrobotname + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.7") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + + modelBuilder.Entity("Api.Database.Models.Mission", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b.Property("AssetCode") + .HasColumnType("nvarchar(max)"); + + b.Property("EchoMissionId") + .HasMaxLength(128) + .HasColumnType("int"); + + b.Property("EndTime") + .HasColumnType("datetimeoffset"); + + b.Property("IsarMissionId") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("MissionStatus") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("RobotId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("StartTime") + .HasColumnType("datetimeoffset"); + + b.HasKey("Id"); + + b.HasIndex("RobotId"); + + b.ToTable("Missions"); + }); + + modelBuilder.Entity("Api.Database.Models.Robot", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b.Property("BatteryLevel") + .HasColumnType("real"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("Host") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Logs") + .HasColumnType("nvarchar(max)"); + + b.Property("Model") + .HasMaxLength(128) + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Port") + .HasColumnType("int"); + + b.Property("SerialNumber") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Robots"); + }); + + modelBuilder.Entity("Api.Database.Models.Mission", b => + { + b.HasOne("Api.Database.Models.Robot", "Robot") + .WithMany() + .HasForeignKey("RobotId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Api.Database.Models.IsarTask", "Tasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b1.Property("IsarTaskId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("MissionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b1.Property("TagId") + .HasColumnType("nvarchar(max)"); + + b1.Property("TaskStatus") + .HasColumnType("int"); + + b1.Property("Time") + .HasColumnType("datetimeoffset"); + + b1.HasKey("Id"); + + b1.HasIndex("MissionId"); + + b1.ToTable("IsarTask"); + + b1.WithOwner("Mission") + .HasForeignKey("MissionId"); + + b1.OwnsMany("Api.Database.Models.IsarStep", "Steps", b2 => + { + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b2.Property("FileLocation") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b2.Property("InspectionType") + .HasColumnType("int"); + + b2.Property("IsarStepId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b2.Property("StepStatus") + .HasColumnType("int"); + + b2.Property("StepType") + .HasColumnType("int"); + + b2.Property("TagId") + .HasColumnType("nvarchar(max)"); + + b2.Property("TaskId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b2.Property("Time") + .HasColumnType("datetimeoffset"); + + b2.HasKey("Id"); + + b2.HasIndex("TaskId"); + + b2.ToTable("IsarStep"); + + b2.WithOwner("Task") + .HasForeignKey("TaskId"); + + b2.Navigation("Task"); + }); + + b1.Navigation("Mission"); + + b1.Navigation("Steps"); + }); + + b.OwnsMany("Api.Database.Models.PlannedTask", "PlannedTasks", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b1.Property("MissionId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b1.Property("TagId") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b1.Property("URL") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b1.HasKey("Id"); + + b1.HasIndex("MissionId"); + + b1.ToTable("PlannedTask"); + + b1.WithOwner() + .HasForeignKey("MissionId"); + + b1.OwnsMany("Api.Database.Models.PlannedInspection", "Inspections", b2 => + { + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b2.Property("InspectionType") + .HasColumnType("int"); + + b2.Property("PlannedTaskId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b2.Property("TimeInSeconds") + .HasColumnType("real"); + + b2.HasKey("Id"); + + b2.HasIndex("PlannedTaskId"); + + b2.ToTable("PlannedInspection"); + + b2.WithOwner() + .HasForeignKey("PlannedTaskId"); + }); + + b1.Navigation("Inspections"); + }); + + b.Navigation("PlannedTasks"); + + b.Navigation("Robot"); + + b.Navigation("Tasks"); + }); + + modelBuilder.Entity("Api.Database.Models.Robot", b => + { + b.OwnsOne("Api.Database.Models.Pose", "Pose", b1 => + { + b1.Property("RobotId") + .HasColumnType("nvarchar(450)"); + + b1.Property("Frame") + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b1.HasKey("RobotId"); + + b1.ToTable("Robots"); + + b1.WithOwner() + .HasForeignKey("RobotId"); + + b1.OwnsOne("Api.Database.Models.Orientation", "Orientation", b2 => + { + b2.Property("PoseRobotId") + .HasColumnType("nvarchar(450)"); + + b2.Property("W") + .HasColumnType("real"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.Property("Z") + .HasColumnType("real"); + + b2.HasKey("PoseRobotId"); + + b2.ToTable("Robots"); + + b2.WithOwner() + .HasForeignKey("PoseRobotId"); + }); + + b1.OwnsOne("Api.Database.Models.Position", "Position", b2 => + { + b2.Property("PoseRobotId") + .HasColumnType("nvarchar(450)"); + + b2.Property("X") + .HasColumnType("real"); + + b2.Property("Y") + .HasColumnType("real"); + + b2.Property("Z") + .HasColumnType("real"); + + b2.HasKey("PoseRobotId"); + + b2.ToTable("Robots"); + + b2.WithOwner() + .HasForeignKey("PoseRobotId"); + }); + + b1.Navigation("Orientation") + .IsRequired(); + + b1.Navigation("Position") + .IsRequired(); + }); + + b.OwnsMany("Api.Database.Models.VideoStream", "VideoStreams", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("nvarchar(450)"); + + b1.Property("Name") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b1.Property("RobotId") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b1.Property("Url") + .IsRequired() + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b1.HasKey("Id"); + + b1.HasIndex("RobotId"); + + b1.ToTable("VideoStream"); + + b1.WithOwner() + .HasForeignKey("RobotId"); + }); + + b.Navigation("Pose") + .IsRequired(); + + b.Navigation("VideoStreams"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/api/Migrations/20221018071827_add-robot-name.cs b/backend/api/Migrations/20221018071827_add-robot-name.cs new file mode 100644 index 000000000..c1bf6a652 --- /dev/null +++ b/backend/api/Migrations/20221018071827_add-robot-name.cs @@ -0,0 +1,25 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Api.Migrations +{ + public partial class addrobotname : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Name", + table: "Missions", + type: "nvarchar(max)", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Name", + table: "Missions"); + } + } +} diff --git a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs index 081d9d57e..b38463d00 100644 --- a/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs +++ b/backend/api/Migrations/FlotillaDbContextModelSnapshot.cs @@ -45,6 +45,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("MissionStatus") .HasColumnType("int"); + b.Property("Name") + .HasColumnType("nvarchar(max)"); + b.Property("RobotId") .IsRequired() .HasColumnType("nvarchar(450)");