Merge branch 'dev' into feature/8636739

This commit is contained in:
ngfrolov 2023-02-20 15:28:54 +05:00
commit 01e94fc489
Signed by untrusted user who does not match committer: ng.frolov
GPG Key ID: E99907A0357B29A7
315 changed files with 41946 additions and 397167 deletions

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
@ -6,29 +7,12 @@ namespace AsbCloudApp.Data
/// <summary>
/// DTO кустов
/// </summary>
public class ClusterDto : IMapPoint, IId
public class ClusterDto : MapPointBaseDto
{
/// <inheritdoc/>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Caption { get; set; } = null!;
/// <inheritdoc/>
public double? Latitude { get; set; }
/// <inheritdoc/>
public double? Longitude { get; set; }
/// <inheritdoc/>
public SimpleTimezoneDto? Timezone { get; set; }
/// <summary>
/// ИД месторождения, необязательный
/// </summary>
public int? IdDeposit { get; set; }
public int IdDeposit { get; set; }
/// <summary>
/// DTO месторождения
@ -38,7 +22,17 @@ namespace AsbCloudApp.Data
/// <summary>
/// Список скважин куста
/// </summary>
public IEnumerable<WellDto>? Wells { get; set; } = null!;
public IEnumerable<WellDto> Wells { get; set; } = Enumerable.Empty<WellDto>();
}
/// <summary>
/// DTO кустов
/// </summary>
public class ClusterBranchDto : MapPointBaseDto
{
/// <summary>
/// Список скважин куста
/// </summary>
public IEnumerable<WellMapInfoDto> Wells { get; set; } = Enumerable.Empty<WellMapInfoDto>();
}
#nullable disable
}

View File

@ -1,5 +1,8 @@
namespace AsbCloudApp.Data
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO компании
/// </summary>
@ -11,7 +14,8 @@
/// <summary>
/// Название
/// </summary>
public string Caption { get; set; }
[Required]
public string Caption { get; set; } = null!;
/// <summary>
/// ИД типа компании
@ -21,6 +25,6 @@
/// <summary>
/// Название типа компании
/// </summary>
public string CompanyTypeCaption { get; set; }
public string CompanyTypeCaption { get; set; } = null!;
}
}

View File

@ -1,38 +1,37 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO Месторождения
/// </summary>
public class DepositBaseDto : IMapPoint, IId
public class DepositBaseDto : MapPointBaseDto
{
/// <inheritdoc/>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Caption { get; set; }
/// <inheritdoc/>
public double? Latitude { get; set; }
/// <inheritdoc/>
public double? Longitude { get; set; }
/// <inheritdoc/>
public SimpleTimezoneDto Timezone { get; set; }
}
/// <summary>
/// DTO Месторождения с кустами
/// </summary>
public class DepositDto : DepositBaseDto
public class DepositDto : MapPointBaseDto
{
/// <summary>
/// Кусты месторождения
/// </summary>
public IEnumerable<ClusterDto> Clusters { get; set; }
public IEnumerable<ClusterDto> Clusters { get; set; } = Enumerable.Empty<ClusterDto>();
}
/// <summary>
/// DTO Месторождения с кустами
/// </summary>
public class DepositBranchDto : MapPointBaseDto
{
/// <summary>
/// Кусты месторождения
/// </summary>
public IEnumerable<ClusterBranchDto> Clusters { get; set; } = Enumerable.Empty<ClusterBranchDto>();
}
}

View File

@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data.DetectedOperation
{
#nullable enable
/// <summary>
/// Автоматически определяемая операция
/// </summary>
@ -11,12 +13,12 @@ namespace AsbCloudApp.Data.DetectedOperation
/// <summary>
/// Список всех операций
/// </summary>
public IEnumerable<DetectedOperationDto> Operations { get; set; }
public IEnumerable<DetectedOperationDto> Operations { get; set; } = Enumerable.Empty<DetectedOperationDto>();
/// <summary>
/// Статистика по бурильщикам
/// </summary>
public IEnumerable<DetectedOperationDrillersStatDto> Stats { get; set; }
public IEnumerable<DetectedOperationDrillersStatDto> Stats { get; set; } = Enumerable.Empty<DetectedOperationDrillersStatDto>();
}
#nullable disable
}

View File

@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Часть программы бурения
/// </summary>
@ -10,7 +12,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// Название
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
/// <summary>
/// ИД категории файла
@ -27,12 +29,12 @@ namespace AsbCloudApp.Data
/// <summary>
/// Публикаторы. Могут загружать файл этой категории
/// </summary>
public IEnumerable<UserDto> Publishers { get; set; }
public IEnumerable<UserDto> Publishers { get; set; } = Enumerable.Empty<UserDto>();
/// <summary>
/// Согласованты. Могут согласовывать загруженные файлы этой категории
/// </summary>
public IEnumerable<UserDto> Approvers { get; set; }
public IEnumerable<UserDto> Approvers { get; set; } = Enumerable.Empty<UserDto>();
/// <summary>
/// Разрешение для текущего пользователя согласовывать документ
@ -47,6 +49,6 @@ namespace AsbCloudApp.Data
/// <summary>
/// Ссылка на документ.
/// </summary>
public FileInfoDto File { get; set; }
public FileInfoDto? File { get; set; }
}
}

View File

@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO состояния формирования программы бурения
/// </summary>
@ -18,12 +20,12 @@ namespace AsbCloudApp.Data
/// <summary>
/// Ошибка при формировании
/// </summary>
public DrillingProgramCreateError Error { get; set; }
public DrillingProgramCreateError? Error { get; set; }
/// <summary>
/// Файл сформированной программы бурения
/// </summary>
public FileInfoDto Program { get; set; }
public FileInfoDto? Program { get; set; }
/// <summary>
/// Разрешение редактировать части программы бурения
@ -33,7 +35,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// Список частей программы бурения
/// </summary>
public IEnumerable<DrillingProgramPartDto> Parts { get; set; }
public IEnumerable<DrillingProgramPartDto> Parts { get; set; } = Enumerable.Empty<DrillingProgramPartDto>();
}
/// <summary>
@ -44,11 +46,11 @@ namespace AsbCloudApp.Data
/// <summary>
/// Текст ошибки для отображения пользователю
/// </summary>
public string Message { get; set; }
public string Message { get; set; } = string.Empty;
/// <summary>
/// Текст ошибки для разработчика
/// </summary>
public string Exception { get; set; }
public string Exception { get; set; } = string.Empty;
}
}

View File

@ -1,8 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO информации о файле. Используется для загрузки файла.
/// </summary>
@ -27,7 +29,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// имя файла
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// дата загрузки
@ -47,11 +49,11 @@ namespace AsbCloudApp.Data
/// <summary>
/// DTO автора
/// </summary>
public UserDto Author { get; set; }
public UserDto? Author { get; set; }
/// <summary>
/// список отметок файла
/// </summary>
public IEnumerable<FileMarkDto> FileMarks { get; set; }
public IEnumerable<FileMarkDto> FileMarks { get; set; } = Enumerable.Empty<FileMarkDto>();
}
}

View File

@ -2,6 +2,7 @@ using System;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Отметка для файла
/// </summary>
@ -30,17 +31,17 @@ namespace AsbCloudApp.Data
/// <summary>
/// Полезный комментарий
/// </summary>
public string Comment { get; set; }
public string? Comment { get; set; }
/// <summary>
/// признак удаления отметки
/// </summary>
public bool IsDeleted { get; set; }
/// <summary>
/// Пользователь создающий отметку.
/// Необязательно указывать в запросе на создание.
/// </summary>
public UserDto User { get; set; }
public UserDto? User { get; set; }
}
}

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Интерфейс данных с Id
/// </summary>

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// точка на карте
/// </summary>

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Well related DTO
/// </summary>

View File

@ -0,0 +1,25 @@
namespace AsbCloudApp.Data
{
/// <summary>
/// Точка на карте с названием
/// </summary>
public class MapPointBaseDto : IMapPoint, IId
{
/// <inheritdoc/>
public int Id { get; set; }
/// <summary>
/// Название
/// </summary>
public string Caption { get; set; }
/// <inheritdoc/>
public double? Latitude { get; set; }
/// <inheritdoc/>
public double? Longitude { get; set; }
/// <inheritdoc/>
public SimpleTimezoneDto Timezone { get; set; }
}
}

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; }
}
}

View File

@ -2,6 +2,7 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO формирования рапорта
/// </summary>
@ -12,17 +13,17 @@ namespace AsbCloudApp.Data
/// <inheritdoc/>
public int IdWell { get; set; }
/// <summary>
/// название
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// <see cref="FileInfoDto"/>
/// </summary>
public FileInfoDto File { get; set; }
public FileInfoDto File { get; set; } = null!;
/// <summary>
/// Дата формирования
/// </summary>
@ -46,6 +47,6 @@ namespace AsbCloudApp.Data
/// <summary>
/// формат файла
/// </summary>
public string Format { get; set; }
public string Format { get; set; } = string.Empty;
}
}

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// Описание шаблона события панели оператора
/// </summary>
@ -13,7 +14,7 @@
/// <summary>
/// шаблон текста сообщения
/// </summary>
public string Message { get; set; }
public string Message { get; set; } = string.Empty;
/// <summary>
/// id категории события
@ -23,7 +24,7 @@
/// <summary>
/// переменная сервера обмена информацией с полевым оборудованием
/// </summary>
public string Tag { get; set; }
public string Tag { get; set; } = string.Empty;
/// <summary>
/// тип определения наступления события

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// DTO рекомендации уставок передаваемых на панель оператора
/// </summary>
@ -8,31 +9,31 @@
/// <summary>
/// отображаемое название уставки
/// </summary>
public string DisplayName { get; set; }
public string DisplayName { get; set; } = string.Empty;
/// <summary>
/// настоящее название уставки (имя переменной в панели оператора)
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = null!;
/// <summary>
/// единицы измерения
/// </summary>
public string Units { get; set; }
public string? Units { get; set; }
/// <summary>
/// комментарий
/// </summary>
public string Comment { get; set; }
public string? Comment { get; set; }
/// <summary>
/// макс. значение
/// </summary>
public double Max { get; set; }
public double Max { get; set; } = double.MaxValue;
/// <summary>
/// мин значение
/// </summary>
public double Min { get; set; }
public double Min { get; set; } = double.MinValue;
}
}

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// DTO запроса для предложения по изменению уставок на панели оператора
/// </summary>
@ -27,7 +28,7 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// отметка времени создания запроса
/// </summary>
public DateTime UploadDate { get; set; }
public DateTime UploadDate { get; set; } = DateTime.Now;
/// <summary>
/// время в секундах актуальности этого запроса
@ -37,21 +38,21 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// набор уставок: {"название переменной панели"; "рекомендуемое значение"}
/// </summary>
public Dictionary<string, double> Setpoints { get; set; }
public Dictionary<string, double> Setpoints { get; set; } = new();
/// <summary>
/// Комментарий для оператора панели
/// </summary>
public string Comment { get; set; }
public string? Comment { get; set; }
/// <summary>
/// DTO скважины
/// </summary>
public WellDto Well { get; set; }
public WellDto? Well { get; set; }
/// <summary>
/// DTO автора
/// </summary>
public UserDto Author { get; set; }
public UserDto? Author { get; set; }
}
}

View File

@ -1,5 +1,5 @@
using System;
#nullable enable
namespace AsbCloudApp.Data.SAUB
{
/// <summary>
@ -42,7 +42,7 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// telemetry user
/// </summary>
public string User { get; set; }
public string? User { get; set; }
/// <summary>
/// Глубина забоя

View File

@ -2,6 +2,7 @@
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// общая информация о панели оператора
/// </summary>
@ -15,7 +16,7 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// идентификатор временной зоны
/// </summary>
public string TimeZoneId { get; set; }
public string? TimeZoneId { get; set; }
/// <summary>
/// смещение в часах относительно UTC
@ -25,41 +26,41 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// название скважины
/// </summary>
public string Well { get; set; }
public string Well { get; set; } = string.Empty;
/// <summary>
/// название куста
/// </summary>
public string Cluster { get; set; }
public string Cluster { get; set; } = string.Empty;
/// <summary>
/// название месторождения
/// </summary>
public string Deposit { get; set; } = string.Empty;
/// <summary>
/// название заказчика
/// </summary>
public string Customer { get; set; }
public string? Customer { get; set; }
/// <summary>
/// название месторождения
/// </summary>
public string Deposit { get; set; }
/// <summary>
/// версия ПО панели оператора
/// </summary>
public string HmiVersion { get; set; }
public string? HmiVersion { get; set; }
/// <summary>
/// версия ПО ПЛК САУБ
/// </summary>
public string SaubPlcVersion { get; set; }
public string? SaubPlcVersion { get; set; }
/// <summary>
/// версия ПО ПЛК Спин мастер
/// </summary>
public string SpinPlcVersion { get; set; }
public string? SpinPlcVersion { get; set; }
/// <summary>
/// комментарий
/// </summary>
public string Comment { get; set; }
public string? Comment { get; set; }
}
}

View File

@ -2,6 +2,7 @@
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// Сообщение получаемое от телеметрии с буровой
/// </summary>
@ -35,21 +36,21 @@ namespace AsbCloudApp.Data.SAUB
/// <summary>
/// аргумент №0 для подстановки в шаблон сообщения
/// </summary>
public string Arg0 { get; set; }
public string? Arg0 { get; set; }
/// <summary>
/// аргумент №1 для подстановки в шаблон сообщения
/// </summary>
public string Arg1 { get; set; }
public string? Arg1 { get; set; }
/// <summary>
/// аргумент №2 для подстановки в шаблон сообщения
/// </summary>
public string Arg2 { get; set; }
public string? Arg2 { get; set; }
/// <summary>
/// аргумент №3 для подстановки в шаблон сообщения
/// </summary>
public string Arg3 { get; set; }
public string? Arg3 { get; set; }
}
}

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data.SAUB
{
#nullable enable
/// <summary>
/// Пользователь панели оператора
/// </summary>
@ -11,22 +12,22 @@
/// <summary>
/// Имя
/// </summary>
public string Name { get; set; }
public string? Name { get; set; }
/// <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; }
/// <summary>
/// Уровень доступа
/// </summary>
public int Level { get; set; }
public int? Level { get; set; }
/// <summary>
/// Собрать отображаемое имя пользователя

View File

@ -1,5 +1,6 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// âðåìåííàÿ çîíà
/// </summary>
@ -13,7 +14,7 @@ namespace AsbCloudApp.Data
/// <summary>
/// èäåíòèôèêàòîð ÷àñîâîé çîíû
/// </summary>
public string TimezoneId { get; set; }
public string? TimezoneId { get; set; }
/// <summary>
/// çàïðåò íà ïåðåîïðåäåëåíèå
@ -21,7 +22,7 @@ namespace AsbCloudApp.Data
public bool IsOverride { get; set; }
/// <inheritdoc/>
public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (obj is SimpleTimezoneDto tTimeZone
&& tTimeZone.Hours == Hours
@ -34,7 +35,7 @@ namespace AsbCloudApp.Data
/// <inheritdoc/>
public override int GetHashCode()
=> Hours.GetHashCode()
| TimezoneId.GetHashCode()
| TimezoneId?.GetHashCode()??-1
| IsOverride.GetHashCode();
/// <inheritdoc/>

View File

@ -1,5 +1,8 @@
namespace AsbCloudApp.Data
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO пользователя платформы
/// </summary>
@ -11,43 +14,47 @@
/// <summary>
/// логин
/// </summary>
public string Login { get; set; }
[Required]
[StringLength(255, MinimumLength = 2)]
public string Login { get; set; } = null!;
/// <summary>
/// Имя
/// </summary>
public string Name { get; set; }
public string? Name { get; set; }
/// <summary>
/// Фамилия
/// </summary>
public string Surname { get; set; }
public string? Surname { get; set; }
/// <summary>
/// Отчество
/// </summary>
public string Patronymic { get; set; }
public string? Patronymic { get; set; }
/// <summary>
/// Email
/// </summary>
public string Email { get; set; }
[Required]
[StringLength(255, MinimumLength = 6)]
public string Email { get; set; } = null!;
/// <summary>
/// Phone
/// </summary>
public string Phone { get; set; }
public string? Phone { get; set; }
/// <summary>
/// Должность
/// </summary>
public string Position { get; set; }
public string? Position { get; set; }
/// <summary>
/// Id компании
/// </summary>
public int? IdCompany { get; set; }
[Required]
public int IdCompany { get; set; }
/// <summary>
/// Id состояния пользователя
@ -57,7 +64,7 @@
/// <summary>
/// DTO компании
/// </summary>
public CompanyDto Company { get; set; }
public CompanyDto? Company { get; set; }
/// <summary>
/// Получение отображаемого имени

View File

@ -1,13 +1,15 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <inheritdoc/>
public class UserExtendedDto : UserDto
{
/// <summary>
/// Роли пользователя
/// </summary>
public IEnumerable<string> RoleNames { get; set; }
public IEnumerable<string> RoleNames { get; set; } = Enumerable.Empty<string>();
}
}

View File

@ -1,11 +1,12 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <inheritdoc/>
public class UserRegistrationDto : UserDto
{
/// <summary>
/// пароль, используется только при регистрации.
/// </summary>
public string Password { get; set; }
public string Password { get; set; } = null!;
}
}

View File

@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Text.Json.Serialization;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Роль пользователя платформы
/// </summary>
@ -14,7 +16,8 @@ namespace AsbCloudApp.Data
/// <summary>
/// название
/// </summary>
public string Caption { get; set; }
[Required]
public string Caption { get; set; } = null!;
/// <summary>
/// id типа роли
@ -24,18 +27,11 @@ namespace AsbCloudApp.Data
/// <summary>
/// список разрешений
/// </summary>
public IEnumerable<PermissionDto> Permissions { get; set; }
public IEnumerable<PermissionDto> Permissions { get; set; } = Enumerable.Empty<PermissionDto>();
/// <summary>
/// Включенные роли
/// </summary>
public virtual IEnumerable<UserRoleDto> Roles { get; set; }
/// <summary>
/// Пользователи в роли
/// </summary>
[JsonIgnore]
public virtual ICollection<UserDto> Users { get; set; }
public virtual IEnumerable<UserRoleDto> Roles { get; set; } = Enumerable.Empty<UserRoleDto>();
}
}

View File

@ -1,18 +1,20 @@
using System.Collections.Generic;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <inheritdoc/>
public class UserTokenDto : UserExtendedDto
{
/// <summary>
/// все разрешения пользователя
/// </summary>
public IEnumerable<PermissionDto> Permissions { get; set; }
public IEnumerable<PermissionDto> Permissions { get; set; } = Enumerable.Empty<PermissionDto>();
/// <summary>
/// bearer token (для работы с web-api)
/// </summary>
public string Token { get; set; }
public string Token { get; set; } = null!;
}
}

View File

@ -1,8 +1,11 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Скважина
/// </summary>
@ -15,22 +18,23 @@ namespace AsbCloudApp.Data
public double? Longitude { get; set; }
/// <inheritdoc/>
public SimpleTimezoneDto Timezone { get; set; }
[Required]
public SimpleTimezoneDto Timezone { get; set; } = null!;
/// <summary>
/// Название типа скважины
/// </summary>
public string WellType { get; set; }
public string WellType { get; set; } = null!;
/// <summary>
/// ID типа скважины
/// </summary>
public int? IdWellType { get; set; }
public int IdWellType { get; set; }
/// <summary>
/// ID куста
/// </summary>
public int? IdCluster { get; set; }
public int IdCluster { get; set; }
/// <summary>
/// 0 - неизвестно,
@ -57,11 +61,11 @@ namespace AsbCloudApp.Data
/// <summary>
/// Объект телеметрии (инфо от панели оператора)
/// </summary>
public TelemetryBaseDto Telemetry { get; set; }
public TelemetryBaseDto? Telemetry { get; set; }
/// <summary>
/// Компании участвующие в работах на скважине
/// </summary>
public IEnumerable<CompanyDto> Companies { get; set; }
public IEnumerable<CompanyDto> Companies { get; set; } = Enumerable.Empty<CompanyDto>();
}
}

View File

@ -1,5 +1,8 @@
namespace AsbCloudApp.Data
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// базовая информация о скважине
/// </summary>
@ -11,16 +14,17 @@
/// <summary>
/// Название
/// </summary>
public string Caption { get; set; }
[Required]
public string Caption { get; set; } = null!;
/// <summary>
/// Название куста
/// </summary>
public string Cluster { get; set; }
public string Cluster { get; set; } = null!;
/// <summary>
/// Название месторождения
/// </summary>
public string Deposit { get; set; }
public string Deposit { get; set; } = null!;
}
}

View File

@ -0,0 +1,54 @@
using System;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Инфо о скважине для отображения на карте
/// </summary>
public class WellMapInfoDto: MapPointBaseDto
{
/// <summary>
/// 0 - неизвестно,
/// 1 - в работе,
/// 2 - завершена
/// </summary>
public int IdState { get; set; }
/// <summary>
/// Дата/время кода приходили данные последний раз
/// </summary>
public DateTime LastTelemetryDate { get; set; }
/// <summary>
/// Плановая и текущая глубина
/// </summary>
public PlanFactBase<double?> WellDepth { get; set; } = null!;
/// <summary>
/// Отставание от ГГД, %
/// </summary>
public double TvdLagPercent { get; set; }
/// <summary>
/// Механическая скорость проходки, последней операции бурения
/// </summary>
public PlanFactBase<double?> ROP { get; set; } = null!;
/// <summary>
/// Рейсовая скорость проходки, последнего рейса
/// </summary>
public PlanFactBase<double?> RaceSpeed { get; set; } = null!;
/// <summary>
/// Процент использования АКБ
/// </summary>
public double SaubUsage { get; set; }
/// <summary>
/// Процент использования Спин мастера
/// </summary>
public double SpinUsage { get; set; }
}
#nullable disable
}

View File

@ -2,6 +2,7 @@
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// DTO категория операции
/// </summary>
@ -13,7 +14,9 @@ namespace AsbCloudApp.Data
/// <summary>
/// название
/// </summary>
public string Name { get; set; }
[Required]
[StringLength(512)]
public string Name { get; set; } = null!;
/// <summary>
/// Идентификатор родительской категории
@ -24,12 +27,12 @@ namespace AsbCloudApp.Data
/// Название ключевого показателя операции
/// </summary>
[StringLength(32)]
public string KeyValueName { get; set; }
public string? KeyValueName { get; set; }
/// <summary>
/// Единицы измерения ключевого показателя операции
/// </summary>
[StringLength(16)]
public string KeyValueUnits { get; set; }
public string? KeyValueUnits { get; set; }
}
}

View File

@ -1,9 +1,9 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace AsbCloudApp.Data
{
//todo: добавить валидацию
#nullable enable
/// <summary>
/// Операции на скважине (заведенные пользователем)
/// </summary>
@ -13,46 +13,58 @@ namespace AsbCloudApp.Data
public int Id { get; set; }
/// <inheritdoc/>
[Required]
public int IdWell { get; set; }
/// <summary>
/// id секции скважины
/// </summary>
[Required]
public int IdWellSectionType { get; set; }
/// <summary>
/// название секции скважины
/// </summary>
public string WellSectionTypeName { get; set; }
public string WellSectionTypeName { get; set; } = null!;
/// <summary>
/// id категории операции
/// </summary>
[Required]
public int IdCategory { get; set; }
/// <summary>
/// id плановой операции для сопоставления
/// </summary>
public int? IdPlan { get; set; }
/// <summary>
/// название категории операции
/// </summary>
public string CategoryName { get; set; }
public string CategoryName { get; set; } = null!;
/// <summary>
/// дополнительная информация по операции
/// </summary>
public string CategoryInfo { get; set; }
[StringLength(8192)]
public string? CategoryInfo { get; set; }
/// <summary>
/// 0 = план или 1 = факт или прогноз = 2
/// </summary>
[Required]
public int IdType { get; set; }
/// <summary>
/// Глубина на начало операции, м
/// </summary>
[Range(0, 50_000)]
public double DepthStart { get; set; }
/// <summary>
/// Глубина после завершения операции, м
/// </summary>
[Range(0, 50_000)]
public double DepthEnd { get; set; }
/// <summary>
@ -73,11 +85,14 @@ namespace AsbCloudApp.Data
/// <summary>
/// Продолжительность, часы
/// </summary>
[Range(0, 50)]
public double DurationHours { get; set; }
/// <summary>
/// Полезный комментарий
/// </summary>
public string Comment { get; set; }
[StringLength(8192)]
public string? Comment { get; set; }
}
#nullable disable
}

View File

@ -17,7 +17,7 @@ namespace AsbCloudApp.Repositories
/// список названий операций
/// </summary>
/// <returns></returns>
IEnumerable<WellOperationCategoryDto> GetCategories();
IEnumerable<WellOperationCategoryDto> GetCategories(bool includeParents);
/// <summary>
/// Список секций
@ -25,6 +25,14 @@ namespace AsbCloudApp.Repositories
/// <returns></returns>
IDictionary<int, string> GetSectionTypes();
/// <summary>
/// список плановых операций для сопоставления
/// <param name="idWell"></param>
/// <param name="token"></param>
/// </summary>
/// <returns></returns>
Task<IEnumerable<WellOperationDto>> GetOperationsPlanAsync(int idWell, CancellationToken token);
/// <summary>
/// дата/время первой операции по скважине
/// </summary>

View File

@ -0,0 +1,27 @@
using System.Collections.Generic;
namespace AsbCloudApp.Requests
{
#nullable enable
/// <summary>
/// Запрос на получение скважин
/// </summary>
public class WellRequest
{
/// <summary>
/// id компании
/// </summary>
public int? IdCompany { get; set; }
/// <summary>
/// id состояния
/// </summary>
public int? IdState { get; set; }
/// <summary>
/// Идентификаторы скважин
/// </summary>
public IEnumerable<int>? Ids { get; set; }
}
#nullable disable
}

View File

@ -20,7 +20,7 @@ namespace AsbCloudApp.Services
/// <param name="idWell">id скважины</param>
/// <param name="token"></param>
/// <returns>emptyList if nothing found</returns>
Task<IEnumerable<Tdto>?> GetByIdWellAsync(int idWell, CancellationToken token);
Task<IEnumerable<Tdto>> GetByIdWellAsync(int idWell, CancellationToken token);
/// <summary>
/// Получение всех записей по нескольким скважинам
@ -28,7 +28,7 @@ namespace AsbCloudApp.Services
/// <param name="idsWells">id скважин</param>
/// <param name="token"></param>
/// <returns>emptyList if nothing found</returns>
Task<IEnumerable<Tdto>?> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token);
Task<IEnumerable<Tdto>> GetByIdWellAsync(IEnumerable<int> idsWells, CancellationToken token);
}
#nullable disable
}

View File

@ -5,6 +5,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
#nullable enable
/// <summary>
/// Сервис рекомендаций новых уставок для панели оператора САУБ
/// </summary>

View File

@ -1,4 +1,5 @@
using AsbCloudApp.Data;
using AsbCloudApp.Requests;
using System;
using System.Collections.Generic;
using System.Threading;
@ -6,6 +7,7 @@ using System.Threading.Tasks;
namespace AsbCloudApp.Services
{
#nullable enable
/// <summary>
/// сервис скважин
/// </summary>
@ -19,10 +21,10 @@ namespace AsbCloudApp.Services
/// <summary>
/// Список скважин доступных компании
/// </summary>
/// <param name="idCompany"></param>
/// <param name="request"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellDto>> GetWellsByCompanyAsync(int idCompany, CancellationToken token);
Task<IEnumerable<WellDto>> GetAsync(WellRequest request, CancellationToken token);
/// <summary>
/// проверяет доступ к скважине для компании
@ -33,14 +35,6 @@ namespace AsbCloudApp.Services
/// <returns></returns>
Task<bool> IsCompanyInvolvedInWellAsync(int idCompany, int idWell, CancellationToken token);
/// <summary>
/// проверяет доступ к скважине для компании
/// </summary>
/// <param name="idCompany"></param>
/// <param name="idWell"></param>
/// <returns></returns>
bool IsCompanyInvolvedInWell(int idCompany, int idWell);
/// <summary>
/// получить название скважины по id
/// </summary>
@ -101,5 +95,14 @@ namespace AsbCloudApp.Services
/// <param name="token"></param>
/// <returns></returns>
Task EnshureTimezonesIsSetAsync(CancellationToken token);
/// <summary>
/// ВРЕМЕННЫЙ метод
/// </summary>
/// <param name="idCompany"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<DepositBranchDto>> GetWellTreeAsync(int idCompany, CancellationToken token);
}
#nullable disable
}

View File

@ -47,6 +47,7 @@ namespace AsbCloudApp.Services.Subsystems
/// <param name="token"></param>
/// <returns></returns>
Task<DatesRangeDto?> GetDateRangeOperationTimeAsync(SubsystemOperationTimeRequest request, CancellationToken token);
/// <summary>
/// Получение статистики по наработке подсистем по активным скважинам
/// </summary>
@ -56,6 +57,14 @@ namespace AsbCloudApp.Services.Subsystems
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<SubsystemActiveWellStatDto>> GetStatByActiveWells(int idCompany, DateTime? gtDate, DateTime? ltDate, CancellationToken token);
/// <summary>
/// Получение статистики по наработке подсистем по активным скважинам
/// </summary>
/// <param name="wellIds"></param>
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<SubsystemActiveWellStatDto>> GetStatByActiveWells(IEnumerable<int> wellIds, CancellationToken token);
}
#nullable disable
}

File diff suppressed because it is too large Load Diff

View File

@ -1,957 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
using System.Collections.Generic;
namespace AsbCloudDb.Migrations
{
#nullable disable
public partial class Init : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterDatabase()
.Annotation("Npgsql:PostgresExtension:adminpack", ",,");
migrationBuilder.CreateTable(
name: "t_company_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_company_type", x => x.id);
});
migrationBuilder.CreateTable(
name: "t_deposit",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_deposit", x => x.id);
},
comment: "Месторождение");
migrationBuilder.CreateTable(
name: "t_file_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории"),
short_name = table.Column<string>(type: "text", nullable: true, comment: "Короткое название категории")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_category", x => x.id);
},
comment: "Категории файлов");
migrationBuilder.CreateTable(
name: "t_measure_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории"),
short_name = table.Column<string>(type: "text", nullable: true, comment: "Короткое название категории")
},
constraints: table =>
{
table.PrimaryKey("PK_t_measure_category", x => x.id);
},
comment: "Категория последних данных");
migrationBuilder.CreateTable(
name: "t_telemetry",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
remote_uid = table.Column<string>(type: "text", nullable: true, comment: "Идентификатор передающего устройства. Может повторяться в списке, так как комплекты оборудования переезжают от скв. к скв."),
info = table.Column<TelemetryInfo>(type: "jsonb", nullable: true, comment: "Информация с панели о скважине")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry", x => x.id);
},
comment: "таблица привязки телеметрии от комплектов к конкретной скважине.");
migrationBuilder.CreateTable(
name: "t_user_role",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_user_role", x => x.id);
},
comment: "Роли пользователей в системе");
migrationBuilder.CreateTable(
name: "t_well_operation_category",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "text", nullable: true, comment: "Название категории операции"),
code = table.Column<int>(type: "integer", nullable: false, comment: "Код операции")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_operation_category", x => x.id);
},
comment: "Справочник операций на скважине");
migrationBuilder.CreateTable(
name: "t_well_section_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_section_type", x => x.id);
},
comment: "конструкция секции скважины");
migrationBuilder.CreateTable(
name: "t_well_type",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_type", x => x.id);
},
comment: "конструкция скважины");
migrationBuilder.CreateTable(
name: "t_company",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
id_company_type = table.Column<int>(type: "integer", maxLength: 255, nullable: false, comment: "вид деятельности")
},
constraints: table =>
{
table.PrimaryKey("PK_t_company", x => x.id);
table.ForeignKey(
name: "FK_t_company_t_company_type_id_company_type",
column: x => x.id_company_type,
principalTable: "t_company_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "t_cluster",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
id_deposit = table.Column<int>(type: "integer", nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_cluster", x => x.id);
table.ForeignKey(
name: "t_cluster_t_deposit_id_fk",
column: x => x.id_deposit,
principalTable: "t_deposit",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Кусты");
migrationBuilder.CreateTable(
name: "t_data_saub_base",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
mode = table.Column<int>(type: "integer", nullable: true, comment: "Режим САУБ"),
id_user = table.Column<int>(type: "integer", nullable: true, comment: "Пользователь САУБ"),
well_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина забоя"),
bit_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Положение инструмента"),
block_position = table.Column<double>(type: "double precision", nullable: true, comment: "Высота талевого блока"),
block_position_min = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Мин положение"),
block_position_max = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Макс положение"),
block_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Скорость талевого блока"),
block_speed_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Скорости талевого блока. Задание"),
block_speed_sp_rotor = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для роторного бурения"),
block_speed_sp_slide = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для режима слайда"),
block_speed_sp_develop = table.Column<double>(type: "double precision", nullable: true, comment: "Талевый блок. Задание скорости для проработки"),
pressure = table.Column<double>(type: "double precision", nullable: true, comment: "Давление"),
pressure_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Холостой ход"),
pressure_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание"),
pressure_sp_rotor = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для роторного бурения"),
pressure_sp_slide = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для режима слайда"),
pressure_sp_develop = table.Column<double>(type: "double precision", nullable: true, comment: "Давление. Задание для проработки"),
pressure_delta_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Давление дифф. Аварийное макс."),
axial_load = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка"),
axial_load_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка. Задание"),
axial_load_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Осевая нагрузка. Аварийная макс."),
hook_weight = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке"),
hook_weight_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Холостой ход"),
hook_weight_limit_min = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Посадка"),
hook_weight_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Вес на крюке. Затяжка"),
rotor_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе"),
rotor_torque_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Холостой ход"),
rotor_torque_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Задание"),
rotor_torque_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Момент на роторе. Аварийный макс."),
rotor_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Обороты ротора"),
flow = table.Column<double>(type: "double precision", nullable: true, comment: "Расход"),
flow_idle = table.Column<double>(type: "double precision", nullable: true, comment: "Расход. Холостой ход"),
flow_delta_limit_max = table.Column<double>(type: "double precision", nullable: true, comment: "Расход. Аварийный макс."),
id_feed_regulator = table.Column<double>(type: "double precision", nullable: true, comment: "Текущий критерий бурения"),
mse_state = table.Column<double>(type: "double precision", nullable: true, comment: "Текущее состояние работы MSE")
},
constraints: table =>
{
table.PrimaryKey("PK_t_data_saub_base", x => x.id);
table.ForeignKey(
name: "t_data_saub_base_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "набор основных данных по SAUB");
migrationBuilder.CreateTable(
name: "t_telemetry_event",
columns: table => new
{
id_event = table.Column<int>(type: "integer", nullable: false),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_category = table.Column<int>(type: "integer", nullable: false),
message_template = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_event", x => new { x.id_telemetry, x.id_event });
table.ForeignKey(
name: "t_event_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Справочник событий. События формируют сообщения. Разделено по версиям посылок от телеметрии.");
migrationBuilder.CreateTable(
name: "t_telemetry_message",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_event = table.Column<int>(type: "integer", nullable: false),
id_telemetry_user = table.Column<int>(type: "integer", nullable: true, comment: "Пользователь панели отправляющей телеметрию. не пользователь облака."),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
arg0 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Аргумент №0 для вставки в шаблон сообщения"),
arg1 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
arg2 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
arg3 = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_message", x => x.id);
table.ForeignKey(
name: "t_messages_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Сообщения на буровых");
migrationBuilder.CreateTable(
name: "t_telemetry_user",
columns: table => new
{
id_user = table.Column<int>(type: "integer", nullable: false),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
surname = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
patronymic = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
level = table.Column<int>(type: "integer", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_user", x => new { x.id_telemetry, x.id_user });
table.ForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Пользователи панели САУБ. Для сообщений.");
migrationBuilder.CreateTable(
name: "t_telemetry_analysis",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
id_operation = table.Column<int>(type: "integer", nullable: false),
unix_date = table.Column<long>(type: "bigint", nullable: false, comment: "Unix timestamp для Linq запросов с вычислением дат"),
duration_sec = table.Column<int>(type: "integer", nullable: false, comment: "Кол-во секунд после предыдущей операции"),
operation_start_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой началась операция"),
operation_end_depth = table.Column<double>(type: "double precision", nullable: true, comment: "Глубина, на которой закончилась операция"),
is_well_depth_increasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя увеличивается"),
is_well_depth_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Глубина забоя не увеличивается"),
is_bit_position_increasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Долото спускается"),
is_bit_position_decreasing = table.Column<bool>(type: "boolean", nullable: false, comment: "Долото поднимается"),
is_bit_posision_lt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Положение долота меньше 20м"),
is_block_posision_incresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок спускается"),
is_block_posision_decresing = table.Column<bool>(type: "boolean", nullable: false, comment: "Талевый блок поднимается"),
is_rotor_speed_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора ниже 3"),
is_rotor_speed_gt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Обороты ротора выше 3"),
is_pressure_lt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давление менее 20"),
is_pressure_gt_20 = table.Column<bool>(type: "boolean", nullable: false, comment: "Давоение более 20"),
is_hook_weight_not_changes = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке не меняется"),
is_hook_weight_lt_3 = table.Column<bool>(type: "boolean", nullable: false, comment: "Вес на крюке менее 3т")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_analysis", x => x.id);
table.ForeignKey(
name: "t_analysis_t_operation_id_fk",
column: x => x.id_operation,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "t_analysis_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "События на скважине");
migrationBuilder.CreateTable(
name: "t_user",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_company = table.Column<int>(type: "integer", nullable: true),
id_role = table.Column<int>(type: "integer", nullable: true),
login = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
password_hash = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "соленый хэш пароля.\nпервые 5 символов - соль"),
state = table.Column<short>(type: "smallint", nullable: true, comment: "состояние:\n100 - удален"),
level = table.Column<int>(type: "integer", nullable: true),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "имя"),
surname = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "фамилия"),
patronymic = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "отчество")
},
constraints: table =>
{
table.PrimaryKey("PK_t_user", x => x.id);
table.ForeignKey(
name: "FK_t_user_t_user_role_id_role",
column: x => x.id_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_user_t_company_id_fk",
column: x => x.id_company,
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "Пользователи облака");
migrationBuilder.CreateTable(
name: "t_well",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true),
id_cluster = table.Column<int>(type: "integer", nullable: true),
id_telemetry = table.Column<int>(type: "integer", nullable: true),
id_well_type = table.Column<int>(type: "integer", nullable: true),
latitude = table.Column<double>(type: "double precision", nullable: true),
longitude = table.Column<double>(type: "double precision", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_t_well", x => x.id);
table.ForeignKey(
name: "FK_t_well_t_well_type_id_well_type",
column: x => x.id_well_type,
principalTable: "t_well_type",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_well_t_cluster_id_fk",
column: x => x.id_cluster,
principalTable: "t_cluster",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "t_well_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "скважины");
migrationBuilder.CreateTable(
name: "t_file_info",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_author = table.Column<int>(type: "integer", nullable: true, comment: "Id пользователя, загрузившего файл"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории файла"),
name = table.Column<string>(type: "text", nullable: true, comment: "Название файла"),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
file_size = table.Column<long>(type: "bigint", nullable: false, comment: "Размер файла"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Удален ли файл")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_info", x => x.id);
table.ForeignKey(
name: "FK_t_file_info_t_file_category_id_category",
column: x => x.id_category,
principalTable: "t_file_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_file_info_t_user_id_author",
column: x => x.id_author,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_t_file_info_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Файлы всех категорий");
migrationBuilder.CreateTable(
name: "t_measure",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории"),
timestamp = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "время добавления"),
data = table.Column<Dictionary<string, object>>(type: "jsonb", nullable: true, comment: "Данные таблицы последних данных"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Пометка удаленным")
},
constraints: table =>
{
table.PrimaryKey("PK_t_measure", x => x.id);
table.ForeignKey(
name: "FK_t_measure_t_measure_category_id_category",
column: x => x.id_category,
principalTable: "t_measure_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_measure_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Таблица c данными для вкладки 'Последние данные'");
migrationBuilder.CreateTable(
name: "t_relation_company_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false),
id_company = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_company_well", x => new { x.id_company, x.id_well });
table.ForeignKey(
name: "t_relation_company_well_t_company_id_fk",
column: x => x.id_company,
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_relation_company_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "отношение скважин и компаний");
migrationBuilder.CreateTable(
name: "t_well_operation",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции скважины"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "Id категории операции"),
id_type = table.Column<int>(type: "integer", nullable: false, comment: "0 = План или 1 = Факт"),
depth = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина, на которой производилась операция"),
date = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата начала операции"),
duration_hours = table.Column<double>(type: "double precision", nullable: false, comment: "Продолжительность в часах"),
category_info = table.Column<string>(type: "text", nullable: true, comment: "Доп. информация к выбраной категории"),
comment = table.Column<string>(type: "text", nullable: true, comment: "Комментарий")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_operation", x => x.id);
table.ForeignKey(
name: "FK_t_well_operation_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_operation_t_well_operation_category_id_category",
column: x => x.id_category,
principalTable: "t_well_operation_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_well_operation_t_well_section_type_id_well_section_type",
column: x => x.id_well_section_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Данные по операциям на скважине");
migrationBuilder.CreateTable(
name: "t_report_property",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_well = table.Column<int>(type: "integer", nullable: false, comment: "id скважины"),
id_file = table.Column<int>(type: "integer", nullable: false, comment: "id файла-родителя"),
begin = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
end = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false, comment: "timestamp with time zone"),
step = table.Column<int>(type: "integer", nullable: false, comment: "размер шага в секундах"),
format = table.Column<int>(type: "integer", nullable: false, comment: "Формат отчета")
},
constraints: table =>
{
table.PrimaryKey("PK_t_report_property", x => x.id);
table.ForeignKey(
name: "FK_t_report_property_t_file_info_id_file",
column: x => x.id_file,
principalTable: "t_file_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_report_property_t_well_id_well",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отчеты с данными по буровым");
migrationBuilder.InsertData(
table: "t_company_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Недрапользователь" },
{ 2, "Буровой подрядчик" },
{ 3, "Сервис автоматизации бурения" }
});
migrationBuilder.InsertData(
table: "t_file_category",
columns: new[] { "id", "name", "short_name" },
values: new object[,]
{
{ 13, "Программа бурения, части", "ПБч" },
{ 12, "Рапорт", "report" },
{ 11, "Последние данные ННБ", "nnbLastData" },
{ 10, "Последние данные Шламограммы", "mudLastData" },
{ 9, "Последний замер бурового раствора ФАКТ", "fluidFactLastData" },
{ 8, "Последний замер бурового раствора ПЛАН", "fluidPlanLastData" },
{ 6, "Супервайзер", "supervisor" },
{ 14, "Программа бурения", "ПБ" },
{ 5, "Документы по скважине", "wellDocuments" },
{ 4, "ГТИ", "gti" },
{ 3, "ННБ", "nnb" },
{ 2, "Цементирование", "cement" },
{ 1, "Растворный сервис", "fluidService" },
{ 7, "Мастер", "master" }
});
migrationBuilder.InsertData(
table: "t_measure_category",
columns: new[] { "id", "name", "short_name" },
values: new object[,]
{
{ 3, "ННБ", "ННБ" },
{ 2, "Шламограмма", "Шламограмма" },
{ 1, "Показатели бурового раствора", "Раствор" }
});
migrationBuilder.InsertData(
table: "t_user_role",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Администратор" },
{ 2, "Пользователь" }
});
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[,]
{
{ 1031, 0, "Ремонт" },
{ 1030, 0, "Разбуривание тех.оснастки" },
{ 1029, 0, "Прокачка пачек" },
{ 1028, 0, "Промежуточная промывка" },
{ 1027, 0, "Промывка" },
{ 1026, 0, "Разборка КНБК" },
{ 1024, 0, "Подготовительные работы" },
{ 1032, 0, "Спуск инструмента" },
{ 1023, 0, "Сборка инструмента" },
{ 1022, 0, "Обратная проработка" },
{ 1021, 0, "Подъем инструмента с промывкой" },
{ 1020, 0, "Подъем инструмента" },
{ 1019, 0, "Перетяжка тальканата" },
{ 1025, 0, "Сборка КНБК" },
{ 1033, 0, "Спуск инструмента с промывкой" },
{ 1044, 0, "ВМР" },
{ 1035, 0, "Принудительная проработка" },
{ 1036, 0, "Спуск обсадной колонны" },
{ 1037, 0, "Тех СПО-подъем" },
{ 1038, 0, "Тех СПО-спуск" },
{ 1039, 0, "Техническое обслуживание" },
{ 1040, 0, "Цементаж" },
{ 1041, 0, "Шаблонировка ствола" },
{ 1042, 0, "Геологическое осложнение" },
{ 1043, 0, "НПВ" },
{ 1018, 0, "Перетяжка талевого каната" },
{ 1045, 0, "Прочее" },
{ 1046, 0, "Спуск КНБК" },
{ 1047, 0, "Подъем КНБК" },
{ 1048, 0, "Спуск ОК" },
{ 1034, 0, "Прямая проработка" },
{ 1017, 0, "Перезапись каротажа" },
{ 1009, 0, "Оборудование устья" },
{ 1015, 0, "Опрессовка ВЗД" },
{ 1, 0, "Невозможно определить операцию" },
{ 2, 0, "Роторное бурение" },
{ 3, 0, "Слайдирование" },
{ 4, 0, "Подъем с проработкой" },
{ 5, 0, "Спуск с проработкой" },
{ 6, 0, "Подъем с промывкой" },
{ 7, 0, "Спуск с промывкой" },
{ 8, 0, "Спуск в скважину" },
{ 9, 0, "Спуск с вращением" },
{ 10, 0, "Подъем из скважины" },
{ 11, 0, "Подъем с вращением" },
{ 12, 0, "Промывка в покое" },
{ 1016, 0, "Перевод скв на другой тип промывочной жидкости" },
{ 14, 0, "Удержание в клиньях" },
{ 15, 0, "Неподвижное состояние" },
{ 13, 0, "Промывка с вращением" },
{ 17, 0, "На поверхности" },
{ 1014, 0, "Опресовка Ц.К." },
{ 1013, 0, "Опрессовка ПВО" },
{ 1012, 0, "Окончание цикла строительства скважины" },
{ 16, 0, "Вращение без циркуляции" },
{ 1010, 0, "ОЗЦ" },
{ 1008, 0, "ОЗЦ" },
{ 1011, 0, "Начало цикла строительства скважины" },
{ 1006, 0, "Установка ФА" },
{ 1005, 0, "Демонтаж ПВО" },
{ 1004, 0, "Монтаж ПВО" },
{ 1003, 0, "ГФР" },
{ 1002, 0, "ГИС" },
{ 1001, 0, "Бурение в интервале" },
{ 1007, 0, "Оборудование устья" }
});
migrationBuilder.InsertData(
table: "t_well_section_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Пилотный ствол" },
{ 2, "Направление" },
{ 3, "Кондуктор" },
{ 4, "Эксплуатационная колонна" },
{ 5, "Транспортный ствол" },
{ 6, "Хвостовик" }
});
migrationBuilder.InsertData(
table: "t_well_type",
columns: new[] { "id", "caption" },
values: new object[,]
{
{ 1, "Наклонно-направленная" },
{ 2, "Горизонтальная" }
});
migrationBuilder.InsertData(
table: "t_company",
columns: new[] { "id", "caption", "id_company_type" },
values: new object[] { 1, "ООО \"АСБ\"", 3 });
migrationBuilder.InsertData(
table: "t_user",
columns: new[] { "id", "id_company", "id_role", "level", "login", "name", "password_hash", "patronymic", "state", "surname" },
values: new object[] { 1, 1, 1, 2147483647, "dev", "Разработчик", "Vlcj|4fa529103dde7ff72cfe76185f344d4aa87931f8e1b2044e8a7739947c3d18923464eaad93843e4f809c5e126d013072", null, null, null });
migrationBuilder.CreateIndex(
name: "IX_t_cluster_id_deposit",
table: "t_cluster",
column: "id_deposit");
migrationBuilder.CreateIndex(
name: "IX_t_company_id_company_type",
table: "t_company",
column: "id_company_type");
migrationBuilder.CreateIndex(
name: "IX_t_data_saub_base_id_telemetry",
table: "t_data_saub_base",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_author",
table: "t_file_info",
column: "id_author");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_category",
table: "t_file_info",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_file_info_id_well",
table: "t_file_info",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_measure_id_category",
table: "t_measure",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_measure_id_well",
table: "t_measure",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_relation_company_well_id_well",
table: "t_relation_company_well",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_report_property_id_file",
table: "t_report_property",
column: "id_file");
migrationBuilder.CreateIndex(
name: "IX_t_report_property_id_well",
table: "t_report_property",
column: "id_well");
migrationBuilder.CreateIndex(
name: "t_telemetry_remote_uid_index",
table: "t_telemetry",
column: "remote_uid");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_analysis_id_operation",
table: "t_telemetry_analysis",
column: "id_operation");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_analysis_id_telemetry",
table: "t_telemetry_analysis",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_message_id_telemetry",
table: "t_telemetry_message",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_user_id_company",
table: "t_user",
column: "id_company");
migrationBuilder.CreateIndex(
name: "IX_t_user_id_role",
table: "t_user",
column: "id_role");
migrationBuilder.CreateIndex(
name: "IX_t_user_login",
table: "t_user",
column: "login",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_t_well_id_cluster",
table: "t_well",
column: "id_cluster");
migrationBuilder.CreateIndex(
name: "IX_t_well_id_telemetry",
table: "t_well",
column: "id_telemetry",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_t_well_id_well_type",
table: "t_well",
column: "id_well_type");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_date",
table: "t_well_operation",
column: "date");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_depth",
table: "t_well_operation",
column: "depth");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_category",
table: "t_well_operation",
column: "id_category");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_well",
table: "t_well_operation",
column: "id_well");
migrationBuilder.CreateIndex(
name: "IX_t_well_operation_id_well_section_type",
table: "t_well_operation",
column: "id_well_section_type");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_data_saub_base");
migrationBuilder.DropTable(
name: "t_measure");
migrationBuilder.DropTable(
name: "t_relation_company_well");
migrationBuilder.DropTable(
name: "t_report_property");
migrationBuilder.DropTable(
name: "t_telemetry_analysis");
migrationBuilder.DropTable(
name: "t_telemetry_event");
migrationBuilder.DropTable(
name: "t_telemetry_message");
migrationBuilder.DropTable(
name: "t_telemetry_user");
migrationBuilder.DropTable(
name: "t_well_operation");
migrationBuilder.DropTable(
name: "t_measure_category");
migrationBuilder.DropTable(
name: "t_file_info");
migrationBuilder.DropTable(
name: "t_well_operation_category");
migrationBuilder.DropTable(
name: "t_well_section_type");
migrationBuilder.DropTable(
name: "t_file_category");
migrationBuilder.DropTable(
name: "t_user");
migrationBuilder.DropTable(
name: "t_well");
migrationBuilder.DropTable(
name: "t_user_role");
migrationBuilder.DropTable(
name: "t_company");
migrationBuilder.DropTable(
name: "t_well_type");
migrationBuilder.DropTable(
name: "t_cluster");
migrationBuilder.DropTable(
name: "t_telemetry");
migrationBuilder.DropTable(
name: "t_company_type");
migrationBuilder.DropTable(
name: "t_deposit");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddUserColumns : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "email",
table: "t_user",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "должность");
migrationBuilder.AddColumn<string>(
name: "phone",
table: "t_user",
type: "character varying(50)",
maxLength: 50,
nullable: true,
comment: "номер телефона");
migrationBuilder.AddColumn<string>(
name: "position",
table: "t_user",
type: "character varying(255)",
maxLength: 255,
nullable: true,
comment: "email");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "email",
table: "t_user");
migrationBuilder.DropColumn(
name: "phone",
table: "t_user");
migrationBuilder.DropColumn(
name: "position",
table: "t_user");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddDefaultData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1050, 0, "Промывка при спуске ОК" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1050);
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1019, 0, "Перетяжка тальканата" });
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,141 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class RefactorTelemetryData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(name: "t_data_saub_base_t_telemetry_id_fk", table: "t_data_saub_base");
migrationBuilder.DropPrimaryKey(name: "PK_t_data_saub_base", table: "t_data_saub_base");
migrationBuilder.RenameTable(name: "t_data_saub_base", newName: "t_telemetry_data_saub");
migrationBuilder.RenameIndex(name: "IX_t_data_saub_base_id_telemetry", newName: "IX_t_telemetry_data_saub_id_telemetry");
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub", column: "id");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.CreateTable(
name: "t_telemetry_data_spin",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_telemetry = table.Column<int>(type: "integer", nullable: false),
date = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, comment: "'2021-10-19 18:23:54+05'"),
top_drive_speed = table.Column<double>(type: "double precision", nullable: true, comment: "Скорость СВП"),
top_drive_speed_min = table.Column<double>(type: "double precision", nullable: true, comment: "нижний предел"),
top_drive_speed_max = table.Column<double>(type: "double precision", nullable: true, comment: "верхний предел"),
top_drive_speed_offset = table.Column<double>(type: "double precision", nullable: true, comment: "смещение"),
top_drive_speed_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Момент СВП"),
top_drive_torque_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_err = table.Column<int>(type: "integer", nullable: true),
top_drive_speed_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость c СВП"),
top_drive_speed_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_from_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque_sp_from = table.Column<double>(type: "double precision", nullable: true, comment: "Заданный момент c СВП"),
top_drive_torque_sp_from_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_from_err = table.Column<int>(type: "integer", nullable: true),
top_drive_speed_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание скорости на СВП"),
top_drive_speed_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_speed_sp_to_err = table.Column<int>(type: "integer", nullable: true),
top_drive_torque_sp_to = table.Column<double>(type: "double precision", nullable: true, comment: "Задание момента на СВП"),
top_drive_torque_sp_to_min = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_max = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_offset = table.Column<double>(type: "double precision", nullable: true),
top_drive_torque_sp_to_err = table.Column<int>(type: "integer", nullable: true),
w2800 = table.Column<int>(type: "integer", nullable: true, comment: "Установка нуля энкодера"),
w2810 = table.Column<int>(type: "integer", nullable: true, comment: " автоматический сброс блокировки"),
mode = table.Column<int>(type: "integer", nullable: true, comment: "Выбранный режим управления"),
w2808 = table.Column<int>(type: "integer", nullable: true, comment: "Неисправность энкодера"),
torque_starting = table.Column<double>(type: "double precision", nullable: true, comment: " Страгивающий момент"),
rotor_torque_avg = table.Column<double>(type: "double precision", nullable: true, comment: " Момент в роторе средний"),
encoder_resolution = table.Column<double>(name: "encoder_resolution ", type: "double precision", nullable: true, comment: " Разрешение энкодера"),
ratio = table.Column<double>(type: "double precision", nullable: true, comment: " Коэффициент редукции редектора"),
torque_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента вправо"),
torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение крутящего момента влево"),
revols_right_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов вправо"),
revols_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: "Ограничение числа оборотов влево"),
speed_right_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения вправо"),
speed_left_sp = table.Column<double>(type: "double precision", nullable: true, comment: "Заданная скорость вращения влево"),
revols_right_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов вправо"),
revols_left_total = table.Column<double>(type: "double precision", nullable: true, comment: "Суммарное количество оборотов влево"),
turn_right_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды вправо"),
turn_left_once_by_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по моменту единожды влево"),
turn_right_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды вправо"),
turn_left_once_by_angle = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по градусам единожды влево"),
turn_right_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды вправо"),
turn_left_once_by_revols = table.Column<double>(type: "double precision", nullable: true, comment: "Доворот по оборотам единожды влево"),
break_angle_k = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент для расчёта за какой угол нужно тормозить"),
reverse_k_torque = table.Column<double>(type: "double precision", nullable: true, comment: "Коэффициент на который умножается момент, для того чтобы система поняла что мы движемся в обратную сторону"),
position_zero = table.Column<double>(type: "double precision", nullable: true, comment: "Нулевая позиция осциляции"),
position_right = table.Column<double>(type: "double precision", nullable: true, comment: "Крайний правый угол осциляции"),
torque_ramp_time = table.Column<double>(type: "double precision", nullable: true, comment: "Время нарастания момента"),
ver = table.Column<double>(type: "double precision", nullable: true, comment: "Версия ПО ПЛК"),
reverse_speed_sp_zero_time = table.Column<int>(type: "integer", nullable: true, comment: "Время выдачи сигнала нулевой скорости на при смене направления"),
unlock_by_sector_out = table.Column<double>(type: "double precision", nullable: true, comment: " Градус отклонения от сектора для автоматического сброса блокировки"),
pid_mux_torque_left_limit = table.Column<double>(type: "double precision", nullable: true, comment: " Момент при котором определяется ехать назад по моменту или по скорости"),
state = table.Column<int>(type: "integer", nullable: true, comment: "Переменная этапа"),
break_angle_left = table.Column<double>(type: "double precision", nullable: true, comment: "Угол торможения влево при работе по моменту")
},
constraints: table =>
{
table.PrimaryKey("PK_t_telemetry_data_spin", x => x.id);
table.ForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
column: x => x.id_telemetry,
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
},
comment: "набор основных данных по SpinMaster");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin",
column: "id_telemetry");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(name: "t_telemetry_data_saub_t_telemetry_id_fk", table: "t_telemetry_data_saub");
migrationBuilder.DropPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_telemetry_data_saub");
migrationBuilder.RenameTable(name: "t_telemetry_data_saub", newName: "t_data_saub_base");
migrationBuilder.RenameIndex(name: "IX_t_telemetry_data_saub_id_telemetry", newName: "IX_t_data_saub_base_id_telemetry");
migrationBuilder.AddPrimaryKey(name: "PK_t_telemetry_data_saub", table: "t_data_saub_base", column: "id");
migrationBuilder.AddForeignKey(
name: "t_data_saub_t_telemetry_id_fk",
table: "t_data_saub_base",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class AddWellDepthToMessage : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<double>(
name: "well_depth",
table: "t_telemetry_message",
type: "double precision",
nullable: false,
defaultValue: 0.0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "well_depth",
table: "t_telemetry_message");
}
}
}

View File

@ -1,133 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Set_Telemetry_FKs_OnDelete_Cascade : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub");
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user");
migrationBuilder.DropForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user");
migrationBuilder.DropForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user",
column: "id_company",
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.SetNull);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub");
migrationBuilder.DropForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin");
migrationBuilder.DropForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user");
migrationBuilder.DropForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user");
migrationBuilder.DropForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well");
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_saub_t_telemetry_id_fk",
table: "t_telemetry_data_saub",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_telemetry_data_spin_t_telemetry_id_fk",
table: "t_telemetry_data_spin",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_telemetry_user_t_telemetry_id_fk",
table: "t_telemetry_user",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_user_t_company_id_fk",
table: "t_user",
column: "id_company",
principalTable: "t_company",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "t_well_t_telemetry_id_fk",
table: "t_well",
column: "id_telemetry",
principalTable: "t_telemetry",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

View File

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Update_WellOperationsCategory_by_new_initial_values : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_well_operation_category",
columns: new[] { "id", "code", "name" },
values: new object[] { 1019, 0, "Наращивание, промывка" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1019);
}
}
}

View File

@ -1,53 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_WellOperation_WellDepth_to_WellDepthEnd : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth",
table: "t_well_operation",
newName: "depth_end");
migrationBuilder.RenameColumn(
name: "date",
table: "t_well_operation",
newName: "date_start");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth",
table: "t_well_operation",
newName: "IX_t_well_operation_depth_end");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date",
table: "t_well_operation",
newName: "IX_t_well_operation_date_start");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "depth_end",
table: "t_well_operation",
newName: "depth");
migrationBuilder.RenameColumn(
name: "date_start",
table: "t_well_operation",
newName: "date");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_depth_end",
table: "t_well_operation",
newName: "IX_t_well_operation_depth");
migrationBuilder.RenameIndex(
name: "IX_t_well_operation_date_start",
table: "t_well_operation",
newName: "IX_t_well_operation_date");
}
}
}

View File

@ -1,65 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_WellOperation_WellDepthStart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность, часы",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность в часах");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина, на которой производилась операция");
migrationBuilder.AddColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
defaultValue: 0.0,
comment: "Глубина забоя на начало операции, м");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "depth_start",
table: "t_well_operation");
migrationBuilder.AlterColumn<double>(
name: "duration_hours",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Продолжительность в часах",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Продолжительность, часы");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина, на которой производилась операция",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя после завершения операции, м");
}
}
}

View File

@ -1,111 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillingParam_Consumption_to_Flow : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина на начало операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя на начало операции, м");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина забоя после завершения операции, м");
migrationBuilder.CreateTable(
name: "t_drill_params",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
well_id = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Стартовая глубина"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина окончания интервала"),
id_wellsection_type = table.Column<int>(type: "integer", nullable: false, comment: "Id с типом секции скважины"),
axial_load_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальная нагрузка"),
axial_load_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средняя нагрузка"),
axial_load_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальная нагрузка"),
pressure_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальное давление"),
pressure_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Среднее давление"),
pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальное давление"),
top_drive_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный момент на ВСП"),
top_drive_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средний момент на ВСП"),
top_drive_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный момент на ВСП"),
top_drive_speed_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП"),
top_drive_speed_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средние обороты на ВСП"),
top_drive_speed_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальные обороты на ВСП"),
flow_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный расход"),
flow_avg = table.Column<double>(type: "double precision", nullable: false, comment: "Средний расход"),
flow_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный расход")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_params", x => x.id);
table.ForeignKey(
name: "FK_t_drill_params_t_well_well_id",
column: x => x.well_id,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_drill_params_t_well_section_type_id_fk",
column: x => x.id_wellsection_type,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Режим бурения в секции (диапазоны параметров бурения)");
migrationBuilder.CreateIndex(
name: "IX_t_drill_params_id_wellsection_type",
table: "t_drill_params",
column: "id_wellsection_type");
migrationBuilder.CreateIndex(
name: "IX_t_drill_params_well_id",
table: "t_drill_params",
column: "well_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_drill_params");
migrationBuilder.AlterColumn<double>(
name: "depth_start",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя на начало операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина на начало операции, м");
migrationBuilder.AlterColumn<double>(
name: "depth_end",
table: "t_well_operation",
type: "double precision",
nullable: false,
comment: "Глубина забоя после завершения операции, м",
oldClrType: typeof(double),
oldType: "double precision",
oldComment: "Глубина после завершения операции, м");
}
}
}

View File

@ -1,73 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillingParam_TopDrive_to_Rotor : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "top_drive_speed_min",
table: "t_drill_params",
newName: "rotor_speed_min");
migrationBuilder.RenameColumn(
name: "top_drive_speed_max",
table: "t_drill_params",
newName: "rotor_speed_max");
migrationBuilder.RenameColumn(
name: "top_drive_speed_avg",
table: "t_drill_params",
newName: "rotor_speed_avg");
migrationBuilder.RenameColumn(
name: "top_drive_min",
table: "t_drill_params",
newName: "rotor_torque_min");
migrationBuilder.RenameColumn(
name: "top_drive_max",
table: "t_drill_params",
newName: "rotor_torque_max");
migrationBuilder.RenameColumn(
name: "top_drive_avg",
table: "t_drill_params",
newName: "rotor_torque_avg");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "rotor_torque_min",
table: "t_drill_params",
newName: "top_drive_min");
migrationBuilder.RenameColumn(
name: "rotor_torque_max",
table: "t_drill_params",
newName: "top_drive_max");
migrationBuilder.RenameColumn(
name: "rotor_torque_avg",
table: "t_drill_params",
newName: "top_drive_avg");
migrationBuilder.RenameColumn(
name: "rotor_speed_min",
table: "t_drill_params",
newName: "top_drive_speed_min");
migrationBuilder.RenameColumn(
name: "rotor_speed_max",
table: "t_drill_params",
newName: "top_drive_speed_max");
migrationBuilder.RenameColumn(
name: "rotor_speed_avg",
table: "t_drill_params",
newName: "top_drive_speed_avg");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,54 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_CompositeWell : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_сomposite_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита"),
Id = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_сomposite_well_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_сomposite_well_id_well_src",
table: "t_сomposite_well",
column: "id_well_src");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_сomposite_well");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,93 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_CompositeWell_to_WellComposite : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_сomposite_well");
migrationBuilder.CreateTable(
name: "t_well_сomposite",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
},
constraints: table =>
{
table.PrimaryKey("PK_t_well_сomposite", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_well_сomposite_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_well_сomposite_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_well_сomposite_id_well_src",
table: "t_well_сomposite",
column: "id_well_src");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_well_сomposite");
migrationBuilder.CreateTable(
name: "t_сomposite_well",
columns: table => new
{
id_well = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины получателя"),
id_well_src = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины композита"),
id_well_section_type = table.Column<int>(type: "integer", nullable: false, comment: "Id тип секции композита")
},
constraints: table =>
{
table.PrimaryKey("PK_t_сomposite_well", x => new { x.id_well, x.id_well_src, x.id_well_section_type });
table.ForeignKey(
name: "t_сomposite_well_src_t_well_id_fk",
column: x => x.id_well_src,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_id_fk",
column: x => x.id_well,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_сomposite_well_t_well_section_type_id_fk",
column: x => x.id_well_src,
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Композитная скважина");
migrationBuilder.CreateIndex(
name: "IX_t_сomposite_well_id_well_src",
table: "t_сomposite_well",
column: "id_well_src");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,56 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class Add_Drill_Flow_Chart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_drill_flow_chart_params",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
well_id = table.Column<int>(type: "integer", nullable: false, comment: "Id скважины"),
last_update = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата последнего изменения"),
depth_start = table.Column<double>(type: "double precision", nullable: false, comment: "Стартовая глубина"),
depth_end = table.Column<double>(type: "double precision", nullable: false, comment: "Глубина окончания интервала"),
axial_load_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальная нагрузка"),
axial_load_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальная нагрузка"),
pressure_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальное давление"),
pressure_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальное давление"),
rotor_torque_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный момент на ВСП"),
rotor_torque_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный момент на ВСП"),
rotor_speed_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальные обороты на ВСП"),
rotor_speed_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальные обороты на ВСП"),
flow_min = table.Column<double>(type: "double precision", nullable: false, comment: "Минимальный расход"),
flow_max = table.Column<double>(type: "double precision", nullable: false, comment: "Максимальный расход")
},
constraints: table =>
{
table.PrimaryKey("PK_t_drill_flow_chart_params", x => x.id);
table.ForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
column: x => x.well_id,
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Параметры корридоров бурения (диапазоны параметров бурения)");
migrationBuilder.CreateIndex(
name: "IX_t_drill_flow_chart_params_well_id",
table: "t_drill_flow_chart_params",
column: "well_id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_drill_flow_chart_params");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,46 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Fix_WellComposite_FK : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite");
migrationBuilder.CreateIndex(
name: "IX_t_well_сomposite_id_well_section_type",
table: "t_well_сomposite",
column: "id_well_section_type");
migrationBuilder.AddForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite",
column: "id_well_section_type",
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite");
migrationBuilder.DropIndex(
name: "IX_t_well_сomposite_id_well_section_type",
table: "t_well_сomposite");
migrationBuilder.AddForeignKey(
name: "t_well_сomposite_t_well_section_type_id_fk",
table: "t_well_сomposite",
column: "id_well_src",
principalTable: "t_well_section_type",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,73 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_DrillFlowChartParams_to_DrillFlowChart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
table: "t_drill_flow_chart_params");
migrationBuilder.DropPrimaryKey(
name: "PK_t_drill_flow_chart_params",
table: "t_drill_flow_chart_params");
migrationBuilder.RenameTable(
name: "t_drill_flow_chart_params",
newName: "t_drill_flow_chart");
migrationBuilder.RenameIndex(
name: "IX_t_drill_flow_chart_params_well_id",
table: "t_drill_flow_chart",
newName: "IX_t_drill_flow_chart_well_id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_drill_flow_chart",
table: "t_drill_flow_chart",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_drill_flow_chart_t_well_well_id",
table: "t_drill_flow_chart",
column: "well_id",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_drill_flow_chart_t_well_well_id",
table: "t_drill_flow_chart");
migrationBuilder.DropPrimaryKey(
name: "PK_t_drill_flow_chart",
table: "t_drill_flow_chart");
migrationBuilder.RenameTable(
name: "t_drill_flow_chart",
newName: "t_drill_flow_chart_params");
migrationBuilder.RenameIndex(
name: "IX_t_drill_flow_chart_well_id",
table: "t_drill_flow_chart_params",
newName: "IX_t_drill_flow_chart_params_well_id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_drill_flow_chart_params",
table: "t_drill_flow_chart_params",
column: "id");
migrationBuilder.AddForeignKey(
name: "FK_t_drill_flow_chart_params_t_well_well_id",
table: "t_drill_flow_chart_params",
column: "well_id",
principalTable: "t_well",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -1,34 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Added_DrillFlowChart_OperationCategory_Index : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "id_operation_category",
table: "t_drill_flow_chart",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "Id типа операции");
migrationBuilder.CreateIndex(
name: "IX_t_drill_flow_chart_id_operation_category",
table: "t_drill_flow_chart",
column: "id_operation_category");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_t_drill_flow_chart_id_operation_category",
table: "t_drill_flow_chart");
migrationBuilder.DropColumn(
name: "id_operation_category",
table: "t_drill_flow_chart");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_Well_State : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "state",
table: "t_well",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - неизвестно, 1 - в работе, 2 - завершена");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "state",
table: "t_well");
}
}
}

View File

@ -1,27 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Edit_WellOperationCategory_DefaultData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001,
column: "name",
value: "Бурение");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.UpdateData(
table: "t_well_operation_category",
keyColumn: "id",
keyValue: 1001,
column: "name",
value: "Бурение в интервале");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_Well_State_to_IdState : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_WebUrl_In_FileInfo : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "web_storage_url",
table: "t_file_info",
type: "text",
nullable: true,
comment: "Ссылка для просмотра файла в облаке");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "web_storage_url",
table: "t_file_info");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_PublishInfo_To_FileInfo : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "web_storage_url",
table: "t_file_info");
migrationBuilder.AddColumn<FilePublishInfo>(
name: "publish_info",
table: "t_file_info",
type: "jsonb",
nullable: true,
comment: "Информация о файле в облаке");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "publish_info",
table: "t_file_info");
migrationBuilder.AddColumn<string>(
name: "web_storage_url",
table: "t_file_info",
type: "text",
nullable: true,
comment: "Ссылка для просмотра файла в облаке");
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,59 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using System;
namespace AsbCloudDb.Migrations
{
public partial class Add_File_Marks : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_file_mark",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_mark = table.Column<int>(type: "integer", nullable: false, comment: "0 - Согласован, \n1 - Отредактирован"),
date_created = table.Column<DateTime>(type: "timestamp without time zone", nullable: false, comment: "Дата совершенного действия"),
id_file = table.Column<int>(type: "integer", nullable: false, comment: "id файла"),
id_user = table.Column<int>(type: "integer", nullable: false, comment: "id пользователя"),
comment = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Комментарий"),
is_deleted = table.Column<bool>(type: "boolean", nullable: false, comment: "Помечен ли файл как удаленный")
},
constraints: table =>
{
table.PrimaryKey("PK_t_file_mark", x => x.id);
table.ForeignKey(
name: "t_file_mark_t_file_info_fk",
column: x => x.id_file,
principalTable: "t_file_info",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "t_user_t_file_mark_fk",
column: x => x.id_user,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Действия с файлами.");
migrationBuilder.CreateIndex(
name: "IX_t_file_mark_id_file",
table: "t_file_mark",
column: "id_file");
migrationBuilder.CreateIndex(
name: "IX_t_file_mark_id_user",
table: "t_file_mark",
column: "id_user");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_file_mark");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Change_File_Mark_Comment : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
comment: "0 - Согласован, \n1 - Уже внесен в программу бурения",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "0 - Согласован, \n1 - Отредактирован");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
comment: "0 - Согласован, \n1 - Отредактирован",
oldClrType: typeof(int),
oldType: "integer",
oldComment: "0 - Согласован, \n1 - Уже внесен в программу бурения");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Rename_IdMark_To_IdMarkType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id_mark",
table: "t_file_mark");
migrationBuilder.AddColumn<int>(
name: "id_mark_type",
table: "t_file_mark",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - Согласован");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "id_mark_type",
table: "t_file_mark");
migrationBuilder.AddColumn<int>(
name: "id_mark",
table: "t_file_mark",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0 - Согласован, \n1 - Уже внесен в программу бурения");
}
}
}

View File

@ -1,92 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Replace_PK_of_telemetryData_to_compositeKey : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub");
migrationBuilder.DropIndex(
name: "IX_t_telemetry_data_saub_id_telemetry",
table: "t_telemetry_data_saub");
migrationBuilder.DropColumn(
name: "id",
table: "t_telemetry_data_spin");
migrationBuilder.DropColumn(
name: "id",
table: "t_telemetry_data_saub");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin",
columns: new[] { "id_telemetry", "date" });
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub",
columns: new[] { "id_telemetry", "date" });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin");
migrationBuilder.DropPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub");
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_telemetry_data_spin",
type: "integer",
nullable: false,
defaultValue: 0)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddColumn<int>(
name: "id",
table: "t_telemetry_data_saub",
type: "integer",
nullable: false,
defaultValue: 0)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_spin",
table: "t_telemetry_data_spin",
column: "id");
migrationBuilder.AddPrimaryKey(
name: "PK_t_telemetry_data_saub",
table: "t_telemetry_data_saub",
column: "id");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_spin_id_telemetry",
table: "t_telemetry_data_spin",
column: "id_telemetry");
migrationBuilder.CreateIndex(
name: "IX_t_telemetry_data_saub_id_telemetry",
table: "t_telemetry_data_saub",
column: "id_telemetry");
}
}
}

View File

@ -1,23 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Fix_telemetrydataspin_field_name : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "encoder_resolution ",
table: "t_telemetry_data_spin",
newName: "encoder_resolution");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "encoder_resolution",
table: "t_telemetry_data_spin",
newName: "encoder_resolution ");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +0,0 @@
using AsbCloudDb.Model;
using Microsoft.EntityFrameworkCore.Migrations;
namespace AsbCloudDb.Migrations
{
public partial class Add_Telemetry_TimeZone : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<SimpleTimezone>(
name: "timezone",
table: "t_telemetry",
type: "jsonb",
nullable: true,
comment: "Смещение часового пояса от UTC");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "timezone",
table: "t_telemetry");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,185 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace AsbCloudDb.Migrations
{
public partial class Add_UserRoles_Permissions : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_t_user_t_user_role_id_role",
table: "t_user");
migrationBuilder.DropIndex(
name: "IX_t_user_id_role",
table: "t_user");
migrationBuilder.DropColumn(
name: "id_role",
table: "t_user");
migrationBuilder.DropColumn(
name: "level",
table: "t_user");
migrationBuilder.AddColumn<int>(
name: "id_parent",
table: "t_user_role",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "От какой роли унаследована данная роль");
migrationBuilder.AddColumn<int>(
name: "role_type",
table: "t_user_role",
type: "integer",
nullable: false,
defaultValue: 0,
comment: "0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя");
migrationBuilder.CreateTable(
name: "t_permission",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
caption = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: true, comment: "Название"),
type = table.Column<int>(type: "integer", nullable: false, comment: "1-чтение, 2-запись, 3-чтение и запись")
},
constraints: table =>
{
table.PrimaryKey("PK_t_permission", x => x.id);
},
comment: "Разрешения на доступ к данным");
migrationBuilder.CreateTable(
name: "t_relation_user_user_role",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_user = table.Column<int>(type: "integer", nullable: false),
id_user_role = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_user_role", x => x.id);
table.ForeignKey(
name: "FK_t_relation_user_user_role_t_user_id_user",
column: x => x.id_user,
principalTable: "t_user",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_user_role_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение пользователей и ролей");
migrationBuilder.CreateTable(
name: "t_relation_user_role_permission",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
id_user_role = table.Column<int>(type: "integer", nullable: false),
id_permission = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_t_relation_user_role_permission", x => x.id);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_permission_id_permission",
column: x => x.id_permission,
principalTable: "t_permission",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_t_relation_user_role_permission_t_user_role_id_user_role",
column: x => x.id_user_role,
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Отношение ролей пользователей и разрешений доступа");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_permission",
table: "t_relation_user_role_permission",
column: "id_permission");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_role_permission_id_user_role",
table: "t_relation_user_role_permission",
column: "id_user_role");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_user_role_id_user",
table: "t_relation_user_user_role",
column: "id_user");
migrationBuilder.CreateIndex(
name: "IX_t_relation_user_user_role_id_user_role",
table: "t_relation_user_user_role",
column: "id_user_role");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_relation_user_role_permission");
migrationBuilder.DropTable(
name: "t_relation_user_user_role");
migrationBuilder.DropTable(
name: "t_permission");
migrationBuilder.DropColumn(
name: "id_parent",
table: "t_user_role");
migrationBuilder.DropColumn(
name: "role_type",
table: "t_user_role");
migrationBuilder.AddColumn<int>(
name: "id_role",
table: "t_user",
type: "integer",
nullable: true);
migrationBuilder.AddColumn<int>(
name: "level",
table: "t_user",
type: "integer",
nullable: true);
migrationBuilder.UpdateData(
table: "t_user",
keyColumn: "id",
keyValue: 1,
columns: new[] { "id_role", "level" },
values: new object[] { 1, 2147483647 });
migrationBuilder.CreateIndex(
name: "IX_t_user_id_role",
table: "t_user",
column: "id_role");
migrationBuilder.AddForeignKey(
name: "FK_t_user_t_user_role_id_role",
table: "t_user",
column: "id_role",
principalTable: "t_user_role",
principalColumn: "id",
onDelete: ReferentialAction.Restrict);
}
}
}

Some files were not shown because too many files have changed in this diff Show More