Миграции, инициализация, поправил файл конфигурации

1. Расширил DbContext
2. Накатил миграции
3. Добавил новые значения для инициализации
This commit is contained in:
parent cd279b925f
commit 0a0f242da2
12 changed files with 24767 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,47 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_HelpPage : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "t_help_page",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
url_page = table.Column<string>(type: "text", nullable: false, comment: "Url страницы"),
id_category = table.Column<int>(type: "integer", nullable: false, comment: "id категории файла"),
name = table.Column<string>(type: "text", nullable: false, comment: "Название файла"),
file_size = table.Column<long>(type: "bigint", nullable: false, comment: "Размер файла")
},
constraints: table =>
{
table.PrimaryKey("PK_t_help_page", x => x.id);
table.ForeignKey(
name: "FK_t_help_page_t_file_category_id_category",
column: x => x.id_category,
principalTable: "t_file_category",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
},
comment: "Справки");
migrationBuilder.CreateIndex(
name: "IX_t_help_page_id_category",
table: "t_help_page",
column: "id_category");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "t_help_page");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_New_Init_Value_For_FileCategory : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_file_category",
columns: new[] { "id", "name", "short_name" },
values: new object[] { 20000, "Справки по страницам", null });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_file_category",
keyColumn: "id",
keyValue: 20000);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_New_Init_Value_For_Permission : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.InsertData(
table: "t_permission",
columns: new[] { "id", "description", "name" },
values: new object[] { 519, "Разрешить создание справок по страницам", "HelpPage.create" });
migrationBuilder.InsertData(
table: "t_relation_user_role_permission",
columns: new[] { "id_permission", "id_user_role" },
values: new object[] { 519, 1 });
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_relation_user_role_permission",
keyColumns: new[] { "id_permission", "id_user_role" },
keyValues: new object[] { 519, 1 });
migrationBuilder.DeleteData(
table: "t_permission",
keyColumn: "id",
keyValue: 519);
}
}
}

View File

@ -19,7 +19,7 @@ namespace AsbCloudDb.Migrations
#pragma warning disable 612, 618
modelBuilder
.UseCollation("Russian_Russia.1251")
.HasAnnotation("ProductVersion", "6.0.7")
.HasAnnotation("ProductVersion", "6.0.19")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "adminpack");
@ -773,6 +773,11 @@ namespace AsbCloudDb.Migrations
{
Id = 10043,
Name = "Фактические данные бурения (вставляются в паспорт скважины)"
},
new
{
Id = 20000,
Name = "Справки по страницам"
});
});
@ -972,6 +977,46 @@ namespace AsbCloudDb.Migrations
b.HasComment("таблица данных ГТИ с типом значения string");
});
modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<int>("IdCategory")
.HasColumnType("integer")
.HasColumnName("id_category")
.HasComment("id категории файла");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("text")
.HasColumnName("name")
.HasComment("Название файла");
b.Property<long>("Size")
.HasColumnType("bigint")
.HasColumnName("file_size")
.HasComment("Размер файла");
b.Property<string>("UrlPage")
.IsRequired()
.HasColumnType("text")
.HasColumnName("url_page")
.HasComment("Url страницы");
b.HasKey("Id");
b.HasIndex("IdCategory");
b.ToTable("t_help_page");
b.HasComment("Справки");
});
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
{
b.Property<int>("Id")
@ -2002,6 +2047,12 @@ namespace AsbCloudDb.Migrations
Id = 518,
Description = "Разрешение удалять вопрос",
Name = "FaqStatistics.delete"
},
new
{
Id = 519,
Description = "Разрешить создание справок по страницам",
Name = "HelpPage.create"
});
});
@ -3569,6 +3620,11 @@ namespace AsbCloudDb.Migrations
{
IdUserRole = 1,
IdPermission = 518
},
new
{
IdUserRole = 1,
IdPermission = 519
});
});
@ -7440,6 +7496,17 @@ namespace AsbCloudDb.Migrations
b.Navigation("Telemetry");
});
modelBuilder.Entity("AsbCloudDb.Model.HelpPage", b =>
{
b.HasOne("AsbCloudDb.Model.FileCategory", "FileCategory")
.WithMany()
.HasForeignKey("IdCategory")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("FileCategory");
});
modelBuilder.Entity("AsbCloudDb.Model.LimitingParameter", b =>
{
b.HasOne("AsbCloudDb.Model.Telemetry", "Telemetry")

View File

@ -75,6 +75,8 @@ namespace AsbCloudDb.Model
public DbSet<Faq> Faqs => Set<Faq>();
public DbSet<HelpPage> HelpPages => Set<HelpPage>();
public AsbCloudDbContext() : base()
{
Interlocked.Increment(ref referenceCount);

View File

@ -72,6 +72,8 @@
new () {Id = 10041, Name = "Паспорт ОУС (заполняется геологами)"},
new () {Id = 10042, Name = "Паспорт скважины (заполняется геологами)"},
new () {Id = 10043, Name = "Фактические данные бурения (вставляются в паспорт скважины)"},
new () {Id = 20000, Name = "Справки по страницам"}
};
}
}

View File

@ -149,6 +149,8 @@
new (){ Id = 516, Name="FaqStatistics.get", Description="Разрешение просматривать статистику вопросов"},
new (){ Id = 517, Name="FaqStatistics.edit", Description="Разрешение редактировать вопрос"},
new (){ Id = 518, Name="FaqStatistics.delete", Description="Разрешение удалять вопрос"},
new() { Id = 519, Name = "HelpPage.create", Description = "Разрешить создание справок по страницам" }
};
}
}

View File

@ -66,6 +66,7 @@ namespace AsbCloudDb.Model
DbSet<Record50> Record50 { get; }
DbSet<Record60> Record60 { get; }
DbSet<Record61> Record61 { get; }
DbSet<HelpPage> HelpPages { get; }
DatabaseFacade Database { get; }

View File

@ -26,6 +26,9 @@
"companyName": "ООО \"Цифровое бурение\"",
"supportMail": "support@digitaldrilling.ru"
},
"HelpPageOptions": {
"DirectoryNameHelpPageFiles": "helpPages"
},
"Urls": "http://0.0.0.0:5000" //;https://0.0.0.0:5001" //,
// See https man: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0
//"Kestrel": {