Add migration

This commit is contained in:
ngfrolov 2022-05-31 16:36:24 +05:00
parent c568fafa8f
commit 4791ab6db1
5 changed files with 5934 additions and 12 deletions

View File

@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Data
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Описание данных для бурильщика
/// </summary>
@ -15,17 +10,21 @@ namespace AsbCloudApp.Data
/// Идентификатор в БД
/// </summary>
public int Id { get; set; }
/// <summary>
/// Имя
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// Фамилия
/// </summary>
public string Surname { get; set; }
public string Surname { get; set; } = null!;
/// <summary>
/// Отчество
/// </summary>
public string Patronymic { get; set; }
public string? Patronymic { get; set; }
}
#nullable disable
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Make_Driller_patronimic_nullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "patronymic",
table: "t_driller",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "Отчество",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldComment: "Отчество");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "patronymic",
table: "t_driller",
type: "character varying(255)",
maxLength: 255,
nullable: false,
defaultValue: "",
comment: "Отчество",
oldClrType: typeof(string),
oldType: "character varying(255)",
oldMaxLength: 255,
oldNullable: true,
oldComment: "Отчество");
}
}
}

View File

@ -268,7 +268,6 @@ namespace AsbCloudDb.Migrations
.HasComment("Имя");
b.Property<string>("Patronymic")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("patronymic")

View File

@ -23,7 +23,7 @@ namespace AsbCloudDb.Model
[Column("patronymic"), Comment("Отчество")]
[StringLength(255)]
public string Patronymic { get; set; } = null!;
public string? Patronymic { get; set; }
[JsonIgnore]
[InverseProperty(nameof(Model.Schedule.Driller))]