1. Миграция по изменению заголовка поля в таблице t_company_type: IsContact -> is_contact

2. Добавление / обновление данных в таблицу t_company_type
This commit is contained in:
Olga Nemt 2023-11-02 10:47:09 +05:00
parent 319967c00c
commit e7f9ac4c4f
7 changed files with 17856 additions and 6 deletions

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 Rename_Field_IsContact_In_CompanyType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "IsContact",
table: "t_company_type",
newName: "is_contact");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.RenameColumn(
name: "is_contact",
table: "t_company_type",
newName: "IsContact");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,101 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace AsbCloudDb.Migrations
{
public partial class Add_Or_Update_Data_In_CompanyType : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
//migrationBuilder.UpdateData(
// table: "t_company_type",
// keyColumn: "id",
// keyValue: 1,
// columns: new[] { "caption", "order" },
// values: new object[] { "Недропользователь", 3 });
//migrationBuilder.UpdateData(
// table: "t_company_type",
// keyColumn: "id",
// keyValue: 2,
// columns: new[] { "is_contact", "order" },
// values: new object[] { true, 2 });
//migrationBuilder.UpdateData(
// table: "t_company_type",
// keyColumn: "id",
// keyValue: 3,
// columns: new[] { "is_contact", "order" },
// values: new object[] { true, 0 });
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (4, 'Сервис по ГТИ', true, 6) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Сервис по ГТИ', is_contact=true, ""order""=6;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (5, 'Растворный сервис', true, 4) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Растворный сервис', is_contact=true, ""order""=4;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (6, 'Сервис по ННБ', true, 5) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Сервис по ННБ', is_contact=true, ""order""=5;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (7, 'Служба супервайзинга', true, 1) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Служба супервайзинга', is_contact=true, ""order""=1;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (9, 'Сервис по цементированию', true, 7) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Сервис по цементированию', is_contact=true, ""order""=7;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (11, 'Дизельный сервис', false, 9) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Дизельный сервис', is_contact=false, ""order""=9;");
migrationBuilder.Sql(@"INSERT INTO public.t_company_type (id, caption, is_contact, ""order"") " +
@"VALUES (12, 'Сервис по обслуживанию верхних силовых приводов', true, 8) " +
@"ON CONFLICT (id) DO UPDATE SET caption='Сервис по обслуживанию верхних силовых приводов', is_contact=false, ""order""=8;");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 4);
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 5);
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 6);
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 7);
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 9);
migrationBuilder.DeleteData(
table: "t_company_type",
keyColumn: "id",
keyValue: 12);
migrationBuilder.UpdateData(
table: "t_company_type",
keyColumn: "id",
keyValue: 1,
columns: new[] { "caption", "order" },
values: new object[] { "Недрапользователь", 1 });
}
}
}

View File

@ -120,7 +120,8 @@ namespace AsbCloudDb.Migrations
.HasColumnName("caption");
b.Property<bool>("IsContact")
.HasColumnType("boolean");
.HasColumnType("boolean")
.HasColumnName("is_contact");
b.Property<int>("Order")
.HasColumnType("integer")
@ -134,9 +135,9 @@ namespace AsbCloudDb.Migrations
new
{
Id = 1,
Caption = "Недрапользователь",
Caption = "Недропользователь",
IsContact = false,
Order = 1
Order = 3
},
new
{
@ -151,6 +152,48 @@ namespace AsbCloudDb.Migrations
Caption = "Сервис автоматизации бурения",
IsContact = false,
Order = 0
},
new
{
Id = 4,
Caption = "Сервис по ГТИ",
IsContact = true,
Order = 6
},
new
{
Id = 5,
Caption = "Растворный сервис",
IsContact = true,
Order = 4
},
new
{
Id = 6,
Caption = "Сервис по ННБ",
IsContact = true,
Order = 5
},
new
{
Id = 7,
Caption = "Служба супервайзинга",
IsContact = true,
Order = 1
},
new
{
Id = 9,
Caption = "Сервис по цементированию",
IsContact = true,
Order = 7
},
new
{
Id = 12,
Caption = "Сервис по обслуживанию верхних силовых приводов",
IsContact = true,
Order = 7
});
});

View File

@ -14,6 +14,8 @@ namespace AsbCloudDb.Model
[Column("caption")]
[StringLength(255)]
public string Caption { get; set; } = null!;
[Column("is_contact")]
public bool IsContact { get; set; }
[Column("order")]

View File

@ -3,9 +3,16 @@
internal class EntityFillerCompanyType : EntityFiller<CompanyType>
{
public override CompanyType[] GetData() => new CompanyType[] {
new (){ Id = 1, Caption = "Недрапользователь", Order = 1 },
new (){ Id = 2, Caption = "Буровой подрядчик", Order = 2 },
new (){ Id = 3, Caption = "Сервис автоматизации бурения", Order = 0 }
new (){ Id = 1, Caption = "Недропользователь", IsContact = true, Order = 3 },
new (){ Id = 2, Caption = "Буровой подрядчик", IsContact = true, Order = 2 },
new (){ Id = 3, Caption = "Сервис автоматизации бурения", IsContact = true, Order = 0 },
new (){ Id = 4, Caption = "Сервис по ГТИ", IsContact = true, Order = 6 },
new (){ Id = 5, Caption = "Растворный сервис", IsContact = true, Order = 4 },
new (){ Id = 6, Caption = "Сервис по ННБ", IsContact = true, Order = 5 },
new (){ Id = 7, Caption = "Служба супервайзинга", Order = 1 },
new (){ Id = 9, Caption = "Сервис по цементированию", IsContact = true, Order = 7 },
new (){ Id = 11, Caption = "Дизельный сервис", IsContact = false, Order = 9 },
new (){ Id = 12, Caption = "Сервис по обслуживанию верхних силовых приводов", IsContact = true, Order = 8 },
};
}
}