Enable nullable on Permission Measure LimitingParameter

This commit is contained in:
ngfrolov 2023-02-17 17:58:07 +05:00
parent 2b0e36d68c
commit 1f8b7b7451
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
11 changed files with 7118 additions and 22 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// инфо о результатах замера
/// </summary>
@ -22,7 +23,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// название категории замера
/// </summary>
public string CategoryName { get; set; }
public string CategoryName { get; set; } = string.Empty;
/// <summary>
/// отметка времени замера
@ -32,6 +33,6 @@ namespace AsbCloudApp.Data
/// <summary>
/// данные замера
/// </summary>
public Dictionary<string, object> Data { get; set; }
public Dictionary<string, object> Data { get; set; } = new();
}
}

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Разрешение для группы пользователей сделать что-либо через web-api. <br/>
/// применяется как возможность доступа к Endpoint. <br/>
@ -12,11 +13,11 @@
/// <summary>
/// Название
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
/// <summary>
/// Описание
/// </summary>
public string Description { get; set; }
public string? Description { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,85 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Enable_nullable_on_Permission_Measure : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
comment: "Название",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true,
oldComment: "Название");
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_measure_category",
type: "text",
nullable: false,
defaultValue: "",
comment: "Название категории",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true,
oldComment: "Название категории");
migrationBuilder.AlterColumn<string>(
name: "data",
table: "t_measure",
type: "jsonb",
nullable: false,
defaultValue: "{}",
comment: "Данные таблицы последних данных",
oldClrType: typeof(string),
oldType: "jsonb",
oldNullable: true,
oldComment: "Данные таблицы последних данных");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_permission",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Название",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldComment: "Название");
migrationBuilder.AlterColumn<string>(
name: "name",
table: "t_measure_category",
type: "text",
nullable: true,
comment: "Название категории",
oldClrType: typeof(string),
oldType: "text",
oldComment: "Название категории");
migrationBuilder.AlterColumn<string>(
name: "data",
table: "t_measure",
type: "jsonb",
nullable: true,
comment: "Данные таблицы последних данных",
oldClrType: typeof(string),
oldType: "jsonb",
oldComment: "Данные таблицы последних данных");
}
}
}

View File

@ -852,6 +852,7 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Data")
.IsRequired()
.HasColumnType("jsonb")
.HasColumnName("data")
.HasComment("Данные таблицы последних данных");
@ -897,6 +898,7 @@ namespace AsbCloudDb.Migrations
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasColumnName("name")
.HasComment("Название категории");
@ -1000,6 +1002,7 @@ namespace AsbCloudDb.Migrations
.HasComment("Краткое описание");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name")

View File

@ -6,7 +6,6 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
#nullable disable
[Table("t_limiting_parameter"), Comment("Ограничения по параметрам телеметрии")]
public class LimitingParameter : IId
{
@ -35,5 +34,4 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdTelemetry))]
public virtual Telemetry Telemetry { get; set; } = null!;
}
#nullable disable
}

View File

@ -6,7 +6,6 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
#nullable disable
[Table("t_measure"), Comment("Таблица c данными для вкладки \'Последние данные\'")]
public class Measure : IId
{
@ -24,18 +23,18 @@ namespace AsbCloudDb.Model
public DateTimeOffset Timestamp { get; set; }
[Column("data", TypeName = "jsonb"), Comment("Данные таблицы последних данных")]
public RawData Data { get; set; }
public RawData Data { get; set; } = new ();
[Column("is_deleted"), Comment("Пометка удаленным")]
public bool IsDeleted { get; set; }
[JsonIgnore]
[ForeignKey(nameof(IdWell))]
public virtual Well Well { get; set; }
public virtual Well Well { get; set; } = null!;
[JsonIgnore]
[ForeignKey(nameof(IdCategory))]
[InverseProperty(nameof(Model.MeasureCategory.Measures))]
public virtual MeasureCategory Category { get; set; }
public virtual MeasureCategory Category { get; set; } = null!;
}
}

View File

@ -5,7 +5,6 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{
#nullable disable
[Table("t_measure_category"), Comment("Категория последних данных")]
public class MeasureCategory : IId
{
@ -14,12 +13,12 @@ namespace AsbCloudDb.Model
public int Id { get; set; }
[Column("name"), Comment("Название категории")]
public string Name { get; set; }
public string Name { get; set; } = null!;
[Column("short_name"), Comment("Короткое название категории")]
public string ShortName { get; set; }
public string? ShortName { get; set; }
[InverseProperty(nameof(Model.Measure.Category))]
public virtual ICollection<Measure> Measures { get; set; }
public virtual ICollection<Measure> Measures { get; set; } = null!;
}
}

View File

@ -5,7 +5,6 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{
#nullable disable
[Table("t_permission"), Comment("Разрешения на доступ к данным")]
public class Permission : IId
{
@ -15,13 +14,13 @@ namespace AsbCloudDb.Model
[Column("name"), Comment("Название")]
[StringLength(255)]
public string Name { get; set; }
public string Name { get; set; } = null!;
[Column("description"), Comment("Краткое описание")]
[StringLength(255)]
public string Description { get; set; }
public string? Description { get; set; }
[InverseProperty(nameof(RelationUserRolePermission.Permission))]
public virtual ICollection<RelationUserRolePermission> RelationUserRolePermissions { get; set; }
public virtual ICollection<RelationUserRolePermission> RelationUserRolePermissions { get; set; } = null!;
}
}

View File

@ -5,7 +5,6 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace AsbCloudDb.Model
{
#nullable enable
[Table("t_planned_trajectory"), Comment("Загрузка плановой траектории")]
public class PlannedTrajectory : IId, IWellRelated
{
@ -72,5 +71,4 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdUser))]
public virtual User User { get; set; } = null!;
}
#nullable disable
}

View File

@ -6,7 +6,6 @@ using System.Text.Json.Serialization;
namespace AsbCloudDb.Model
{
#nullable enable
[Table("t_process_map"), Comment("Операции по скважине РТК")]
public class ProcessMap : IId, IWellRelated
{
@ -73,5 +72,4 @@ namespace AsbCloudDb.Model
[ForeignKey(nameof(IdWellSectionType))]
public virtual WellSectionType WellSectionType { get; set; } = null!;
}
#nullable disable
}