DbTariffRow: removed id

This commit is contained in:
pavelbannov 2022-09-23 15:26:26 +03:00
parent 2a090bea6c
commit 4f3831ac16
7 changed files with 19 additions and 43 deletions

View File

@ -26,13 +26,17 @@
namespace ASC.Core.Common.EF;
public class DbTariffRow
{
public int Id { get; set; }
public class DbTariffRow : BaseEntity
{
public int TariffId { get; set; }
public int Quota { get; set; }
public int Quantity { get; set; }
public int Tenant { get; set; }
public int Tenant { get; set; }
public override object[] GetKeys()
{
return new object[] { Tenant, TariffId, Quota };
}
}
public static class DbTariffRowExtension
{
@ -49,11 +53,8 @@ public static class DbTariffRowExtension
{
entity.ToTable("tenants_tariffrow");
entity.HasKey(e => e.Id)
.HasName("PRIMARY");
entity.Property(e => e.Id)
.HasColumnName("id");
entity.HasKey(e => new { e.Tenant, e.TariffId, e.Quota })
.HasName("PRIMARY");
entity.Property(e => e.TariffId)
.HasColumnName("tariff_id")

View File

@ -1,5 +1,7 @@
// <auto-generated />
using System;
using ASC.Core.Billing;
using ASC.Core.Common.EF;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
@ -188,11 +190,6 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
modelBuilder.Entity("ASC.Core.Common.EF.DbTariffRow", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
b.Property<int>("Quantity")
.HasColumnType("int")
.HasColumnName("quantity");
@ -209,7 +206,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
.HasColumnType("int")
.HasColumnName("tenant");
b.HasKey("Id")
b.HasKey("Tenant", "TariffId", "Quota")
.HasName("PRIMARY");
b.ToTable("tenants_tariffrow", (string)null);

View File

@ -24,7 +24,6 @@
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
@ -74,8 +73,6 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
name: "tenants_tariffrow",
columns: table => new
{
id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
tariff_id = table.Column<int>(type: "int", nullable: false),
quota = table.Column<int>(type: "int", nullable: false),
quantity = table.Column<int>(type: "int", nullable: false),
@ -83,7 +80,7 @@ namespace ASC.Migrations.MySql.Migrations.CoreDb
},
constraints: table =>
{
table.PrimaryKey("PRIMARY", x => x.id);
table.PrimaryKey("PRIMARY", x => new { x.tenant, x.tariff_id, x.quota });
})
.Annotation("MySql:CharSet", "utf8mb4");

View File

@ -177,11 +177,6 @@ namespace ASC.Migrations.MySql.Migrations
modelBuilder.Entity("ASC.Core.Common.EF.DbTariffRow", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasColumnName("id");
b.Property<int>("Quantity")
.HasColumnType("int")
.HasColumnName("quantity");
@ -198,8 +193,8 @@ namespace ASC.Migrations.MySql.Migrations
.HasColumnType("int")
.HasColumnName("tenant");
b.HasKey("Id")
.HasName("PRIMARY");
b.HasKey("Tenant", "TariffId", "Quota")
.HasName("PRIMARY");
b.ToTable("tenants_tariffrow", (string)null);
});

View File

@ -185,11 +185,6 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
modelBuilder.Entity("ASC.Core.Common.EF.DbTariffRow", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Quantity")
.HasColumnType("integer");
@ -202,7 +197,7 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
b.Property<int>("Tenant")
.HasColumnType("integer");
b.HasKey("Id");
b.HasKey("Tenant", "TariffId", "Quota");
b.ToTable("TariffRows");
});

View File

@ -26,8 +26,6 @@
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
@ -80,8 +78,6 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
name: "TariffRows",
columns: table => new
{
Id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
TariffId = table.Column<int>(type: "integer", nullable: false),
Quota = table.Column<int>(type: "integer", nullable: false),
Quantity = table.Column<int>(type: "integer", nullable: false),
@ -89,7 +85,7 @@ namespace ASC.Migrations.PostgreSql.Migrations.CoreDb
},
constraints: table =>
{
table.PrimaryKey("PK_TariffRows", x => x.Id);
table.PrimaryKey("PK_TariffRows", x => new { x.Tenant, x.TariffId, x.Quota });
});
migrationBuilder.UpdateData(

View File

@ -174,11 +174,6 @@ namespace ASC.Migrations.PostgreSql.Migrations
modelBuilder.Entity("ASC.Core.Common.EF.DbTariffRow", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);
b.Property<int>("Quantity")
.HasColumnType("integer");
@ -191,7 +186,7 @@ namespace ASC.Migrations.PostgreSql.Migrations
b.Property<int>("Tenant")
.HasColumnType("integer");
b.HasKey("Id");
b.HasKey("Tenant", "TariffId", "Quota");
b.ToTable("TariffRows");
});