question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Argument isn't an array or generic List" thrown while adding migrations

See original GitHub issue

Hi, hi have erron On Migration:

Premises: Project type: Blazor Assembly Hosted on NetCoreApi NetCore 6 preview 3 Wondows 10

Behaviour: I create the first Migration that happen without problem, I can update database without problem too. When I try to create the second migration I get following error:

add-migration Second
Build started...
Build succeeded.
System.ArgumentException: Argument isn't an array or generic List (Parameter 'memberInfo')
   at Npgsql.EntityFrameworkCore.PostgreSQL.Utilities.ReferenceNullabilityDecoder.IsArrayOrListElementNonNullable(MemberInfo memberInfo)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlTypeMappingSource.FindMapping(IProperty property)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.<>c.<get_TypeMapping>b__78_0(IProperty property)
   at Microsoft.EntityFrameworkCore.Internal.NonCapturingLazyInitializer.EnsureInitialized[TParam,TValue](TValue& target, TParam param, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.get_TypeMapping()
   at Microsoft.EntityFrameworkCore.Metadata.Internal.Property.Microsoft.EntityFrameworkCore.Metadata.IReadOnlyProperty.FindTypeMapping()
   at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.FindRelationalTypeMapping(IReadOnlyProperty property)
   at Microsoft.EntityFrameworkCore.RelationalPropertyExtensions.GetColumnType(IReadOnlyProperty property)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.AddDefaultMappings(RelationalModel databaseModel, IEntityType entityType)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Create(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider)
   at Microsoft.EntityFrameworkCore.Metadata.Internal.RelationalModel.Add(IModel model, IRelationalAnnotationProvider relationalAnnotationProvider)
   at Microsoft.EntityFrameworkCore.Infrastructure.RelationalModelRuntimeInitializer.InitializeModel(IModel model, Boolean preValidation)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelRuntimeInitializer.<>c.<Initialize>b__4_0(ValueTuple`3 args)
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase.<>c__30`2.<GetOrAddRuntimeAnnotationValue>b__30_0(String n, ValueTuple`3 t)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd[TArg](TKey key, Func`3 valueFactory, TArg factoryArgument)
   at Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase.GetOrAddRuntimeAnnotationValue[TValue,TArg](String name, Func`2 valueFactory, TArg factoryArgument)
   at Microsoft.EntityFrameworkCore.Infrastructure.ModelRuntimeInitializer.Initialize(IModel model, IDiagnosticsLogger`1 validationLogger)
   at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsScaffolder.ScaffoldMigration(String migrationName, String rootNamespace, String subNamespace, String language)
   at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType, String namespace)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType, String namespace)
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigration.<>c__DisplayClass0_0.<.ctor>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
   at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Argument isn't an array or generic List (Parameter 'memberInfo')`

This is the DataContextModelSnapshot after first Migration:

DataContextModelSnapshot
// <auto-generated />
using System;
using System.Collections.Generic;
using FidaBlazorNet6.Server.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

namespace FidaBlazorNet6.Server.Migrations
{
    [DbContext(typeof(DataContext))]
    partial class DataContextModelSnapshot : ModelSnapshot
    {
        protected override void BuildModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasPostgresEnum(null, "day_of_week", new[] { "sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday" })
                .HasAnnotation("Relational:MaxIdentifierLength", 63)
                .HasAnnotation("ProductVersion", "6.0.0-preview.3.21201.2")
                .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

            modelBuilder.Entity("FidaBlazorNet6.Shared.Email.Verification.VerifiedEmail", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("EmailAddress")
                        .HasColumnType("text");

                    b.Property<DateTime>("VerificationDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int?>("VerificationResponseId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("VerificationResponseId");

                    b.ToTable("VerifiedEmails");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.Login.OldPassword", b =>
                {
                    b.Property<int>("id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int?>("UserId")
                        .HasColumnType("integer");

                    b.Property<string>("oldPasswordHash")
                        .HasColumnType("text");

                    b.HasKey("id");

                    b.HasIndex("UserId");

                    b.ToTable("OldPassword");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.PhoneNumber", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int?>("ContactId")
                        .HasColumnType("integer");

                    b.Property<string>("CountryDialCode")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Notes")
                        .HasColumnType("text");

                    b.Property<string>("Number")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("NumberType")
                        .HasColumnType("integer");

                    b.Property<int?>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("ContactId");

                    b.HasIndex("UserId");

                    b.ToTable("PhoneNumber");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.Role", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Name")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("NormalizedName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.HasKey("Id");

                    b.HasIndex("NormalizedName")
                        .IsUnique()
                        .HasDatabaseName("RoleNameIndex");

                    b.ToTable("AspNetRoles");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.User", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("AccessFailedCount")
                        .HasColumnType("integer");

                    b.Property<DateTime>("BirthDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("ConcurrencyStamp")
                        .IsConcurrencyToken()
                        .HasColumnType("text");

                    b.Property<string>("Email")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<bool>("EmailConfirmed")
                        .HasColumnType("boolean");

                    b.Property<bool>("EnableWorkTaskSetting")
                        .HasColumnType("boolean");

                    b.Property<string>("FirstName")
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<int>("Gender")
                        .HasColumnType("integer");

                    b.Property<string>("ImapPassword")
                        .HasColumnType("text");

                    b.Property<bool>("IsDisabled")
                        .HasColumnType("boolean");

                    b.Property<int?>("LanguageId")
                        .HasColumnType("integer");

                    b.Property<string>("LastName")
                        .HasMaxLength(64)
                        .HasColumnType("character varying(64)");

                    b.Property<bool>("LockoutEnabled")
                        .HasColumnType("boolean");

                    b.Property<DateTimeOffset?>("LockoutEnd")
                        .HasColumnType("timestamp with time zone");

                    b.Property<string>("NormalizedEmail")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("NormalizedUserName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.Property<string>("PasswordHash")
                        .HasColumnType("text");

                    b.Property<string>("PhoneNumber")
                        .HasColumnType("text");

                    b.Property<bool>("PhoneNumberConfirmed")
                        .HasColumnType("boolean");

                    b.Property<string>("PhotoUrl")
                        .HasColumnType("text");

                    b.Property<string>("PlaceOfBirth")
                        .HasColumnType("text");

                    b.Property<string>("SecurityStamp")
                        .HasColumnType("text");

                    b.Property<string>("Thumbnail")
                        .HasColumnType("text");

                    b.Property<bool>("TwoFactorEnabled")
                        .HasColumnType("boolean");

                    b.Property<string>("UserName")
                        .HasMaxLength(256)
                        .HasColumnType("character varying(256)");

                    b.HasKey("Id");

                    b.HasIndex("LanguageId");

                    b.HasIndex("NormalizedEmail")
                        .HasDatabaseName("EmailIndex");

                    b.HasIndex("NormalizedUserName")
                        .IsUnique()
                        .HasDatabaseName("UserNameIndex");

                    b.ToTable("AspNetUsers");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserAddress", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("AddressType")
                        .HasColumnType("integer");

                    b.Property<string>("City")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Country")
                        .HasColumnType("integer");

                    b.Property<string>("County")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Flat")
                        .HasColumnType("text");

                    b.Property<int?>("LeadId")
                        .HasColumnType("integer");

                    b.Property<string>("NameId")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Number")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("PostalCode")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Staircase")
                        .HasColumnType("text");

                    b.Property<string>("State")
                        .HasColumnType("text");

                    b.Property<string>("Street")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int?>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("LeadId")
                        .IsUnique();

                    b.HasIndex("UserId");

                    b.ToTable("UserAddress");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserIdentityNumber", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("DocumentCopyUrl")
                        .HasColumnType("text");

                    b.Property<string>("DocumentIssuer")
                        .HasColumnType("text");

                    b.Property<string>("DocumentThumbnail")
                        .HasColumnType("text");

                    b.Property<DateTime>("ExpiringDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("IdNumber")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("IdType")
                        .HasColumnType("integer");

                    b.Property<DateTime>("IssuingDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("IssuingPlace")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("UserIdentityNumber");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserMailAddress", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Address")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("MailType")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("UserMailAddress");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserProfile", b =>
                {
                    b.Property<long>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("bigint")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("Count")
                        .HasColumnType("integer");

                    b.Property<bool>("IsNavMinified")
                        .HasColumnType("boolean");

                    b.Property<bool>("IsNavOpen")
                        .HasColumnType("boolean");

                    b.Property<string>("LastPageVisited")
                        .HasColumnType("text");

                    b.Property<DateTime>("LastUpdatedDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId")
                        .IsUnique();

                    b.ToTable("UserProfile");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserRole", b =>
                {
                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<int>("RoleId")
                        .HasColumnType("integer");

                    b.HasKey("UserId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetUserRoles");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Csv.CsvMapTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("CsvTemplateName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("CsvValuesNumber")
                        .HasColumnType("integer");

                    b.Property<bool>("Deleted")
                        .HasColumnType("boolean");

                    b.Property<string>("SheetTemplateName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.ToTable("CsvMapTemplates");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Csv.CsvTempItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("ClassPropertyName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Header")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Index")
                        .HasColumnType("integer");

                    b.Property<int>("MapTemplateId")
                        .HasColumnType("integer");

                    b.Property<string>("Value")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("MapTemplateId");

                    b.ToTable("CsvTempItem");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Contact", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("Appellative")
                        .HasColumnType("integer");

                    b.Property<int>("CompanyPosition")
                        .HasColumnType("integer");

                    b.Property<string>("FamilyName")
                        .HasColumnType("text");

                    b.Property<int>("Gender")
                        .HasColumnType("integer");

                    b.Property<int>("LeadId")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("LeadId");

                    b.ToTable("Contact");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Lead", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("CompanyName")
                        .HasColumnType("text");

                    b.Property<string>("IndustrySector")
                        .HasColumnType("text");

                    b.Property<DateTime>("LeadPurchasingDate")
                        .HasColumnType("timestamp without time zone");

                    b.HasKey("Id");

                    b.ToTable("Leads");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.ProtocolTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Prefix")
                        .HasColumnType("text");

                    b.Property<int>("ProtProgNumber")
                        .HasColumnType("integer");

                    b.Property<int>("ProtocolType")
                        .HasColumnType("integer");

                    b.Property<string>("Suffix")
                        .HasColumnType("text");

                    b.Property<int?>("TemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TemplateId");

                    b.ToTable("ProtocolTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomation", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<int>("TriggerEvent")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskId");

                    b.ToTable("TaskAutomations");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomationTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<int>("TriggerEvent")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskTemplateId");

                    b.ToTable("TaskAutomationTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.WorkTasksActions.WT_Action", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("ActionType")
                        .HasColumnType("integer");

                    b.Property<string>("ClassPropertyName")
                        .HasColumnType("text");

                    b.Property<string>("ClassPropertyValue")
                        .HasColumnType("text");

                    b.Property<string>("ClassType")
                        .HasColumnType("text");

                    b.Property<double>("Delay")
                        .HasColumnType("double precision");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<int?>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int>("EmailTemplateId")
                        .HasColumnType("integer");

                    b.Property<bool>("Executed")
                        .HasColumnType("boolean");

                    b.Property<DateTime?>("ExecutionDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime>("RegistrationDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("TaskAutomationId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskTemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskType")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageId")
                        .IsUnique();

                    b.HasIndex("TaskAutomationId");

                    b.ToTable("WT_Action");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.WorkTasksActions.WT_ActionTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("ActionType")
                        .HasColumnType("integer");

                    b.Property<string>("ClassPropertyName")
                        .HasColumnType("text");

                    b.Property<string>("ClassPropertyValue")
                        .HasColumnType("text");

                    b.Property<string>("ClassType")
                        .HasColumnType("text");

                    b.Property<double>("Delay")
                        .HasColumnType("double precision");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("EmailAddress")
                        .HasColumnType("text");

                    b.Property<int>("EmailTemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("TaskAutomationTemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskTemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkTaskType")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TaskAutomationTemplateId");

                    b.ToTable("WT_ActionTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskDropItemTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("IsDefaultValue")
                        .HasColumnType("boolean");

                    b.Property<string>("ItemName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("ItemValue")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("TaskFieldTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TaskFieldTemplateId");

                    b.ToTable("TaskDropItemTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskFieldTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("FieldName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("FieldType")
                        .HasColumnType("integer");

                    b.Property<string>("FieldValue")
                        .HasColumnType("text");

                    b.Property<bool>("FillWithCurrentUser")
                        .HasColumnType("boolean");

                    b.Property<bool>("Mandatory")
                        .HasColumnType("boolean");

                    b.Property<bool>("MandatoryForResult")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedValidEmail")
                        .HasColumnType("boolean");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<bool>("ReadOnly")
                        .HasColumnType("boolean");

                    b.Property<int>("WorkTaskTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskTemplateId");

                    b.ToTable("TaskFieldTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("TaskTemplateName")
                        .HasColumnType("text");

                    b.Property<int>("TaskType")
                        .HasColumnType("integer");

                    b.Property<int>("TmkSheetTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkSheetTemplateId");

                    b.ToTable("WorkTaskTemplates");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.TaskField", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("FieldName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("FieldType")
                        .HasColumnType("integer");

                    b.Property<string>("FieldValue")
                        .HasColumnType("text");

                    b.Property<int>("WorkTaskId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskId");

                    b.ToTable("TaskField");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Body")
                        .HasColumnType("text");

                    b.Property<bool>("Executed")
                        .HasColumnType("boolean");

                    b.Property<bool>("ExecutionCleared")
                        .HasColumnType("boolean");

                    b.Property<DateTime>("ExecutionClearedDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime>("ExecutionDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("Importance")
                        .HasColumnType("integer");

                    b.Property<string>("MessageId")
                        .HasColumnType("text");

                    b.Property<List<string>>("MessageIds")
                        .HasColumnType("text[]");

                    b.Property<bool>("NeedDeliveredReceipt")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedReadReceipt")
                        .HasColumnType("boolean");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<string>("Subject")
                        .HasColumnType("text");

                    b.Property<int>("WorkTaskId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskId")
                        .IsUnique();

                    b.ToTable("WtEmails");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<DateTime>("CreationDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime?>("DueOn")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("Duration")
                        .HasColumnType("integer");

                    b.Property<int?>("EmailTemplateId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("End")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime?>("Start")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("TaskType")
                        .HasColumnType("integer");

                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<int>("WorkSheetId")
                        .HasColumnType("integer");

                    b.Property<bool>("WtChanged")
                        .HasColumnType("boolean");

                    b.HasKey("Id");

                    b.HasIndex("TemplateId");

                    b.HasIndex("UserId");

                    b.HasIndex("WorkSheetId");

                    b.ToTable("WorkTasks");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkTaskParameter", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<int>("DurationInMinutes")
                        .HasColumnType("integer");

                    b.Property<bool>("FromAdmin")
                        .HasColumnType("boolean");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("ValidityEnd")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime>("ValidityStart")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int[]>("WeekWorkDays")
                        .HasColumnType("integer[]");

                    b.Property<int>("WorkTaskType")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("WorkTaskParameter");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkWindow", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("Day")
                        .HasColumnType("integer");

                    b.Property<TimeSpan>("End")
                        .HasColumnType("interval");

                    b.Property<TimeSpan>("Start")
                        .HasColumnType("interval");

                    b.Property<int>("WorkTaskParameterId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkTaskParameterId");

                    b.ToTable("WorkWindow");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.AssignmentReason", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("ReasonText")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("ReasonValue")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int?>("TmkSheetTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkSheetTemplateId");

                    b.ToTable("AssignmentReason");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutColumn", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("ColumnSize")
                        .HasColumnType("integer");

                    b.Property<string>("FieldName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("Index")
                        .HasColumnType("integer");

                    b.Property<int>("LayoutRowId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("LayoutRowId");

                    b.ToTable("TmkLayoutColumn");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutRow", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("Index")
                        .HasColumnType("integer");

                    b.Property<int>("TmkLayoutId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkLayoutId");

                    b.ToTable("TmkLayoutRow");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("IsDefault")
                        .HasColumnType("boolean");

                    b.Property<string>("LayoutName")
                        .HasColumnType("text");

                    b.Property<int>("TmkTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkTemplateId");

                    b.ToTable("TmkLayoutTemplates");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkFieldSelectValue", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("IsDefaultValue")
                        .HasColumnType("boolean");

                    b.Property<string>("ItemName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("ItemValue")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("TmkSheetFieldId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkSheetFieldId");

                    b.ToTable("TmkFieldSelectValue");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetField", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("DefaultValue")
                        .HasColumnType("text");

                    b.Property<string>("FieldName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("FieldType")
                        .HasColumnType("integer");

                    b.Property<bool>("FillWithCurrentUser")
                        .HasColumnType("boolean");

                    b.Property<bool>("Mandatory")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedValidEmail")
                        .HasColumnType("boolean");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<bool>("ReadOnly")
                        .HasColumnType("boolean");

                    b.Property<int?>("SheetTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("SheetTemplateId");

                    b.ToTable("TmkSheetFields");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("Deleted")
                        .HasColumnType("boolean");

                    b.Property<int>("FinalTaskType")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int?>("ProtNumTempId")
                        .HasColumnType("integer");

                    b.Property<int?>("RouteAddressMapId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("ProtNumTempId");

                    b.HasIndex("RouteAddressMapId");

                    b.ToTable("TmkSheetTemplates");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkTemplateRole", b =>
                {
                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.Property<int>("RoleId")
                        .HasColumnType("integer");

                    b.HasKey("TemplateId", "RoleId");

                    b.HasIndex("RoleId");

                    b.ToTable("TmkTemplateRole");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("Deleted")
                        .HasColumnType("boolean");

                    b.Property<string>("Protocol")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<bool>("ScheduledForMeeting")
                        .HasColumnType("boolean");

                    b.Property<int>("TemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.ToTable("WorkSheets");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetAssignment", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("AssigneeId")
                        .HasColumnType("integer");

                    b.Property<DateTime>("AssignmentDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime?>("AssignmentEnd")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("AssignmentEndReason")
                        .HasColumnType("text");

                    b.Property<string>("AssignmentReason")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<bool>("UserSelectedToWork")
                        .HasColumnType("boolean");

                    b.Property<int>("WorkSheetId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("AssigneeId");

                    b.HasIndex("WorkSheetId");

                    b.ToTable("WorkSheetAssignments");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetField", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("EmailCheckStatus")
                        .HasColumnType("integer");

                    b.Property<string>("FieldName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int>("FieldType")
                        .HasColumnType("integer");

                    b.Property<string>("FieldValue")
                        .HasColumnType("text");

                    b.Property<bool>("FillWithCurrentUser")
                        .HasColumnType("boolean");

                    b.Property<bool>("Mandatory")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedValidEmail")
                        .HasColumnType("boolean");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<int?>("WorkSheetId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkSheetId");

                    b.ToTable("WorkSheetFields");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetFieldSelectItem", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("IsDefaultValue")
                        .HasColumnType("boolean");

                    b.Property<string>("ItemName")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("ItemValue")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<int?>("WorkSheetFieldId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("WorkSheetFieldId");

                    b.ToTable("WorkSheetFieldSelectItem");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", b =>
                {
                    b.Property<int>("AppId")
                        .HasColumnType("integer");

                    b.Property<string>("Class")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<bool>("Multi")
                        .HasColumnType("boolean");

                    b.Property<string>("Style")
                        .HasColumnType("text");

                    b.HasKey("AppId");

                    b.ToTable("AppDynamicNavMenus");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.NavMenuItem", b =>
                {
                    b.Property<int>("AppId")
                        .HasColumnType("integer");

                    b.Property<bool>("AllowSection")
                        .HasColumnType("boolean");

                    b.Property<int?>("AppDynamicNavMenuAppId")
                        .HasColumnType("integer");

                    b.Property<string>("Class")
                        .HasColumnType("text");

                    b.Property<string>("Content")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<bool>("Disabled")
                        .HasColumnType("boolean");

                    b.Property<string>("Href")
                        .HasColumnType("text");

                    b.Property<string>("Icon")
                        .HasColumnType("text");

                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<string>("Style")
                        .HasColumnType("text");

                    b.Property<int?>("SubMenuListAppId")
                        .HasColumnType("integer");

                    b.HasKey("AppId");

                    b.HasIndex("AppDynamicNavMenuAppId");

                    b.HasIndex("SubMenuListAppId");

                    b.ToTable("NavMenuItems");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenu", b =>
                {
                    b.Property<int>("AppId")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int?>("AppDynamicNavMenuAppId")
                        .HasColumnType("integer");

                    b.Property<string>("Class")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<bool>("Expanded")
                        .HasColumnType("boolean");

                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<bool>("Selected")
                        .HasColumnType("boolean");

                    b.Property<string>("Style")
                        .HasColumnType("text");

                    b.Property<int?>("SubMenuListAppId1")
                        .HasColumnType("integer");

                    b.HasKey("AppId");

                    b.HasIndex("AppDynamicNavMenuAppId");

                    b.HasIndex("SubMenuListAppId1");

                    b.ToTable("SubMenus");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuHeader", b =>
                {
                    b.Property<int>("AppId")
                        .HasColumnType("integer");

                    b.Property<string>("Class")
                        .HasColumnType("text");

                    b.Property<string>("Content")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<string>("Style")
                        .HasColumnType("text");

                    b.HasKey("AppId");

                    b.ToTable("SubMenuHeaders");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", b =>
                {
                    b.Property<int>("AppId")
                        .HasColumnType("integer");

                    b.Property<string>("Class")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<string>("Style")
                        .HasColumnType("text");

                    b.HasKey("AppId");

                    b.ToTable("SubMenuLists");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.FidaUserRouteToken", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<string>("Token")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId")
                        .IsUnique();

                    b.ToTable("FidaUserRouteToken");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.FidaVehicle", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("BreakDuration")
                        .HasColumnType("integer");

                    b.Property<TimeSpan>("BreakEnd")
                        .HasColumnType("interval");

                    b.Property<TimeSpan>("BreakStart")
                        .HasColumnType("interval");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.Property<int>("EndAddressId")
                        .HasColumnType("integer");

                    b.Property<double[]>("EndCoordinates")
                        .HasColumnType("double precision[]");

                    b.Property<bool>("Selected")
                        .HasColumnType("boolean");

                    b.Property<int>("StartAddressId")
                        .HasColumnType("integer");

                    b.Property<double[]>("StartCoordinates")
                        .HasColumnType("double precision[]");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<DateTime?>("ValidityEnd")
                        .HasColumnType("timestamp without time zone");

                    b.Property<DateTime?>("ValidityStart")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int>("VehicleProfile")
                        .HasColumnType("integer");

                    b.Property<TimeSpan>("WorkEnd")
                        .HasColumnType("interval");

                    b.Property<TimeSpan>("WorkStart")
                        .HasColumnType("interval");

                    b.HasKey("Id");

                    b.HasIndex("EndAddressId")
                        .IsUnique();

                    b.HasIndex("StartAddressId")
                        .IsUnique();

                    b.HasIndex("UserId");

                    b.ToTable("FidaVehicles");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.RouteAddress", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Address")
                        .HasColumnType("text");

                    b.Property<string>("Country")
                        .HasColumnType("text");

                    b.Property<int?>("FidaVeichleId")
                        .HasColumnType("integer");

                    b.Property<string>("Locality")
                        .HasColumnType("text");

                    b.Property<string>("Postalcode")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("FidaVeichleId");

                    b.ToTable("RouteAddress");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.RouteAddressMap", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("AddressMapFieldName")
                        .HasColumnType("text");

                    b.Property<string>("CountryMapFieldName")
                        .HasColumnType("text");

                    b.Property<string>("LocalityMapFieldName")
                        .HasColumnType("text");

                    b.Property<string>("PostalcodeMapFieldName")
                        .HasColumnType("text");

                    b.Property<int?>("TmkTemplateId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("TmkTemplateId")
                        .IsUnique();

                    b.ToTable("RouteAddressMap");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.System.Tracer", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<DateTime?>("CreationDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("CreatorName")
                        .HasColumnType("text");

                    b.Property<int?>("CsvMapTemplateId")
                        .HasColumnType("integer");

                    b.Property<string>("ModifierName")
                        .HasColumnType("text");

                    b.Property<DateTime?>("ModifyDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<int?>("TmkSheetTemplateId")
                        .HasColumnType("integer");

                    b.Property<int?>("WorkSheetAssignmentId")
                        .HasColumnType("integer");

                    b.Property<int?>("WorkSheetId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("CsvMapTemplateId");

                    b.HasIndex("TmkSheetTemplateId");

                    b.HasIndex("WorkSheetAssignmentId");

                    b.HasIndex("WorkSheetId");

                    b.ToTable("Tracer");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailAddress", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Address")
                        .HasColumnType("text");

                    b.Property<int?>("BccEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("BccWtEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("CcEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("CcWtEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("ContactId")
                        .HasColumnType("integer");

                    b.Property<int?>("FromEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("FromWtEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.Property<int?>("ReplyToEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("ToEmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("ToWtEmailMessageId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("BccEmailMessageId");

                    b.HasIndex("BccWtEmailMessageId");

                    b.HasIndex("CcEmailMessageId");

                    b.HasIndex("CcWtEmailMessageId");

                    b.HasIndex("ContactId");

                    b.HasIndex("FromEmailMessageId");

                    b.HasIndex("FromWtEmailMessageId");

                    b.HasIndex("ReplyToEmailMessageId");

                    b.HasIndex("ToEmailMessageId");

                    b.HasIndex("ToWtEmailMessageId");

                    b.ToTable("EmailAddress");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailAttachment", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int?>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int?>("EmailTemplateId")
                        .HasColumnType("integer");

                    b.Property<byte[]>("FileDataBytes")
                        .HasColumnType("bytea");

                    b.Property<string>("FileFullPath")
                        .HasColumnType("text");

                    b.Property<string>("FileName")
                        .HasColumnType("text");

                    b.Property<string>("FileNameUrl")
                        .HasColumnType("text");

                    b.Property<string>("FileUrl")
                        .HasColumnType("text");

                    b.Property<string>("MediaSubType")
                        .HasColumnType("text");

                    b.Property<string>("MediaType")
                        .HasColumnType("text");

                    b.Property<int?>("WtEmailId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageId");

                    b.HasIndex("EmailTemplateId");

                    b.HasIndex("WtEmailId");

                    b.ToTable("EmailAttachments");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailEvent", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Date")
                        .HasColumnType("text");

                    b.Property<string>("Email")
                        .HasColumnType("text");

                    b.Property<int>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<string>("Event")
                        .HasColumnType("text");

                    b.Property<DateTime?>("EventRegistrationDate")
                        .HasColumnType("timestamp without time zone");

                    b.Property<string>("From")
                        .HasColumnType("text");

                    b.Property<string>("Ip")
                        .HasColumnType("text");

                    b.Property<string>("Link")
                        .HasColumnType("text");

                    b.Property<string>("MessageId")
                        .HasColumnType("text");

                    b.Property<string>("Reason")
                        .HasColumnType("text");

                    b.Property<string>("Subject")
                        .HasColumnType("text");

                    b.Property<string>("Tag")
                        .HasColumnType("text");

                    b.Property<long?>("TemplateId")
                        .HasColumnType("bigint");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageId");

                    b.ToTable("EmailEvents");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailHeader", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<string>("Field")
                        .HasColumnType("text");

                    b.Property<int>("HeaderId")
                        .HasColumnType("integer");

                    b.Property<long?>("Offset")
                        .HasColumnType("bigint");

                    b.Property<byte[]>("RawField")
                        .HasColumnType("bytea");

                    b.Property<byte[]>("RawValue")
                        .HasColumnType("bytea");

                    b.Property<string>("Value")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageId");

                    b.ToTable("EmailHeaders");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessage", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Body")
                        .HasColumnType("text");

                    b.Property<DateTimeOffset>("Date")
                        .HasColumnType("timestamp with time zone");

                    b.Property<int>("Importance")
                        .HasColumnType("integer");

                    b.Property<string>("InReplyTo")
                        .HasColumnType("text");

                    b.Property<bool>("IsHtml")
                        .HasColumnType("boolean");

                    b.Property<int>("MessageDirection")
                        .HasColumnType("integer");

                    b.Property<string>("MessageId")
                        .HasColumnType("text");

                    b.Property<List<string>>("MessageIds")
                        .HasColumnType("text[]");

                    b.Property<bool>("NeedDeliveredReceipt")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedReadReceipt")
                        .HasColumnType("boolean");

                    b.Property<int>("Priority")
                        .HasColumnType("integer");

                    b.Property<string>("Sender")
                        .HasColumnType("text");

                    b.Property<string>("Subject")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("EmailMessages");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessageFlag", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<int>("MessageFlag")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageId");

                    b.ToTable("EmailMessageFlag");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessageId", b =>
                {
                    b.Property<string>("Id")
                        .HasColumnType("text");

                    b.Property<int>("EmailMessageParentId")
                        .HasColumnType("integer");

                    b.Property<string>("MessageId")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("EmailMessageParentId");

                    b.ToTable("EmailMessageId");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailTemplate", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Body")
                        .HasColumnType("text");

                    b.Property<string>("ClassDataSource")
                        .HasColumnType("text");

                    b.Property<bool>("NeedDeliveredReceipt")
                        .HasColumnType("boolean");

                    b.Property<bool>("NeedReadReceipt")
                        .HasColumnType("boolean");

                    b.Property<bool>("Shared")
                        .HasColumnType("boolean");

                    b.Property<string>("Subject")
                        .HasColumnType("text");

                    b.Property<string>("TemplateName")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("EmailTemplates");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailUid", b =>
                {
                    b.Property<int>("Id")
                        .HasColumnType("integer");

                    b.Property<int>("EmailMessageId")
                        .HasColumnType("integer");

                    b.Property<bool>("IsValid")
                        .HasColumnType("boolean");

                    b.Property<long>("UidId")
                        .HasColumnType("bigint");

                    b.Property<long>("Validity")
                        .HasColumnType("bigint");

                    b.HasKey("Id");

                    b.ToTable("EmailUid");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailVerificationResponse", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<bool>("Accept_all")
                        .HasColumnType("boolean");

                    b.Property<string>("Did_you_mean")
                        .HasColumnType("text");

                    b.Property<bool>("Disposable")
                        .HasColumnType("boolean");

                    b.Property<string>("Domain")
                        .HasColumnType("text");

                    b.Property<string>("Email")
                        .HasColumnType("text");

                    b.Property<bool>("Free")
                        .HasColumnType("boolean");

                    b.Property<string>("Message")
                        .HasColumnType("text");

                    b.Property<string>("Mx_domain")
                        .HasColumnType("text");

                    b.Property<string>("Mx_record")
                        .HasColumnType("text");

                    b.Property<string>("Reason")
                        .HasColumnType("text");

                    b.Property<string>("Result")
                        .HasColumnType("text");

                    b.Property<bool>("Role")
                        .HasColumnType("boolean");

                    b.Property<bool>("Safe_to_send")
                        .HasColumnType("boolean");

                    b.Property<bool>("Success")
                        .HasColumnType("boolean");

                    b.Property<string>("User")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.ToTable("EmailVerificationResponse");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.BaseLangCode", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("KeyText")
                        .IsRequired()
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.ToTable("BaseLangCodes");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LangTransPage", b =>
                {
                    b.Property<int>("PageId")
                        .HasColumnType("integer");

                    b.Property<int>("langTranslationId")
                        .HasColumnType("integer");

                    b.HasKey("PageId", "langTranslationId");

                    b.HasIndex("langTranslationId");

                    b.ToTable("LangTransPage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LangTranslation", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<int>("BaseLangId")
                        .HasColumnType("integer");

                    b.Property<int>("LangCodeId")
                        .HasColumnType("integer");

                    b.Property<string>("Translation")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.HasIndex("BaseLangId");

                    b.HasIndex("LangCodeId");

                    b.ToTable("LangTranslations");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LanguageCode", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Code")
                        .HasColumnType("text");

                    b.Property<string>("Description")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.ToTable("LanguageCodes");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Page", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("text");

                    b.Property<string>("Url")
                        .HasColumnType("text");

                    b.HasKey("Id");

                    b.ToTable("Pages");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("ClaimType")
                        .HasColumnType("text");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("text");

                    b.Property<int>("RoleId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("RoleId");

                    b.ToTable("AspNetRoleClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
                {
                    b.Property<int>("Id")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("integer")
                        .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn);

                    b.Property<string>("ClaimType")
                        .HasColumnType("text");

                    b.Property<string>("ClaimValue")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("Id");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserClaims");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
                {
                    b.Property<string>("LoginProvider")
                        .HasColumnType("text");

                    b.Property<string>("ProviderKey")
                        .HasColumnType("text");

                    b.Property<string>("ProviderDisplayName")
                        .HasColumnType("text");

                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.HasKey("LoginProvider", "ProviderKey");

                    b.HasIndex("UserId");

                    b.ToTable("AspNetUserLogins");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
                {
                    b.Property<int>("UserId")
                        .HasColumnType("integer");

                    b.Property<string>("LoginProvider")
                        .HasColumnType("text");

                    b.Property<string>("Name")
                        .HasColumnType("text");

                    b.Property<string>("Value")
                        .HasColumnType("text");

                    b.HasKey("UserId", "LoginProvider", "Name");

                    b.ToTable("AspNetUserTokens");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Email.Verification.VerifiedEmail", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailVerificationResponse", "VerificationResponse")
                        .WithMany()
                        .HasForeignKey("VerificationResponseId");

                    b.Navigation("VerificationResponse");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.Login.OldPassword", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany("oldPasswords")
                        .HasForeignKey("UserId");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.PhoneNumber", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Contact", "Contact")
                        .WithMany("PhoneNumbers")
                        .HasForeignKey("ContactId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("PhoneNumbers")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.Navigation("Contact");

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.User", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Language.LanguageCode", "Language")
                        .WithMany()
                        .HasForeignKey("LanguageId");

                    b.Navigation("Language");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserAddress", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Lead", "Lead")
                        .WithOne("LeadAddress")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Account.UserAddress", "LeadId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("Adresses")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.Navigation("Lead");

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserIdentityNumber", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("IdentityNumbers")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserMailAddress", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("SecondaryEMailAddresses")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserProfile", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "ApplicationUser")
                        .WithOne("Profile")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Account.UserProfile", "UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("ApplicationUser");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.UserRole", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.Role", "Role")
                        .WithMany("UserRoles")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("UserRoles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Role");

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Csv.CsvTempItem", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Csv.CsvMapTemplate", "MapTemplate")
                        .WithMany("CsvMaps")
                        .HasForeignKey("MapTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("MapTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Contact", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Lead", "Lead")
                        .WithMany("Contacts")
                        .HasForeignKey("LeadId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Lead");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.ProtocolTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "Template")
                        .WithMany()
                        .HasForeignKey("TemplateId");

                    b.Navigation("Template");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomation", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", "WorkTask")
                        .WithMany("TaskAutomations")
                        .HasForeignKey("WorkTaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTask");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomationTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", "WorkTask")
                        .WithMany("TaskAutomations")
                        .HasForeignKey("WorkTaskTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTask");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.WorkTasksActions.WT_Action", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithOne()
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.WorkTasksActions.WT_Action", "EmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomation", "TaskAutomation")
                        .WithMany("TriggeredActions")
                        .HasForeignKey("TaskAutomationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");

                    b.Navigation("TaskAutomation");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.WorkTasksActions.WT_ActionTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomationTemplate", "TaskAutomation")
                        .WithMany("TriggeredActions")
                        .HasForeignKey("TaskAutomationTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("TaskAutomation");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskDropItemTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskFieldTemplate", "TaskField")
                        .WithMany("DropSelectItems")
                        .HasForeignKey("TaskFieldTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("TaskField");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskFieldTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", "WorkTaskTemplate")
                        .WithMany("TaskFields")
                        .HasForeignKey("WorkTaskTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTaskTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "TmkSheetTemplate")
                        .WithMany("WorkTaskTemplates")
                        .HasForeignKey("TmkSheetTemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("TmkSheetTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.TaskField", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", "WorkTask")
                        .WithMany("TaskFields")
                        .HasForeignKey("WorkTaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTask");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", "WorkTask")
                        .WithOne("WtEmailMessage")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", "WorkTaskId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTask");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", "Template")
                        .WithMany("WorkTasks")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("WorkTasks")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", "WorkSheet")
                        .WithMany("WorkTasks")
                        .HasForeignKey("WorkSheetId")
                        .OnDelete(DeleteBehavior.Restrict)
                        .IsRequired();

                    b.Navigation("Template");

                    b.Navigation("User");

                    b.Navigation("WorkSheet");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkTaskParameter", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("WorkTaskParameters")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkWindow", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkTaskParameter", "WorkTaskParameter")
                        .WithMany("DayWorkWindows")
                        .HasForeignKey("WorkTaskParameterId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("WorkTaskParameter");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.AssignmentReason", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "TmkSheetTemplate")
                        .WithMany("AssignmentReasons")
                        .HasForeignKey("TmkSheetTemplateId");

                    b.Navigation("TmkSheetTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutColumn", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutRow", "LayoutRow")
                        .WithMany("LayoutColumns")
                        .HasForeignKey("LayoutRowId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("LayoutRow");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutRow", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutTemplate", "TmkLayout")
                        .WithMany("LayoutRows")
                        .HasForeignKey("TmkLayoutId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("TmkLayout");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "TmkTemplate")
                        .WithMany("LayoutTemplates")
                        .HasForeignKey("TmkTemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("TmkTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkFieldSelectValue", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetField", "TmkSheetField")
                        .WithMany("SelectItems")
                        .HasForeignKey("TmkSheetFieldId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("TmkSheetField");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetField", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "SheetTemplate")
                        .WithMany("Fields")
                        .HasForeignKey("SheetTemplateId");

                    b.Navigation("SheetTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.ProtocolTemplate", "ProtocolNumberTemplate")
                        .WithMany()
                        .HasForeignKey("ProtNumTempId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Route.RouteAddressMap", "RouteAddressMap")
                        .WithMany()
                        .HasForeignKey("RouteAddressMapId");

                    b.Navigation("ProtocolNumberTemplate");

                    b.Navigation("RouteAddressMap");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkTemplateRole", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.Role", "Role")
                        .WithMany("TmkTemplateRoles")
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "TmkSheetTemplate")
                        .WithMany("Roles")
                        .HasForeignKey("TemplateId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Role");

                    b.Navigation("TmkSheetTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetAssignment", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "Assignee")
                        .WithMany("WorkSheetAssignments")
                        .HasForeignKey("AssigneeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", "WorkSheet")
                        .WithMany("WorkSheetAssignments")
                        .HasForeignKey("WorkSheetId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Assignee");

                    b.Navigation("WorkSheet");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetField", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", "WorkSheet")
                        .WithMany("Fields")
                        .HasForeignKey("WorkSheetId");

                    b.Navigation("WorkSheet");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetFieldSelectItem", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetField", "WorkSheetField")
                        .WithMany("SelectItems")
                        .HasForeignKey("WorkSheetFieldId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.Navigation("WorkSheetField");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "ApplicationUser")
                        .WithOne("AppDynamicNavMenu")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", "AppId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("ApplicationUser");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.NavMenuItem", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", null)
                        .WithMany("MenuItems")
                        .HasForeignKey("AppDynamicNavMenuAppId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.SubMenuHeader", "SubMenuHeader")
                        .WithOne("NavMenuItem")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Menus.NavMenuItem", "AppId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", null)
                        .WithMany("Items")
                        .HasForeignKey("SubMenuListAppId");

                    b.Navigation("SubMenuHeader");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenu", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", null)
                        .WithMany("SubMenus")
                        .HasForeignKey("AppDynamicNavMenuAppId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", null)
                        .WithMany("SubMenus")
                        .HasForeignKey("SubMenuListAppId1");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuHeader", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.SubMenu", "SubMenu")
                        .WithOne("SubMenuHeader")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Menus.SubMenuHeader", "AppId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("SubMenu");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Menus.SubMenu", "SubMenu")
                        .WithOne("SubMenuList")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", "AppId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("SubMenu");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.FidaUserRouteToken", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithOne("RouteToken")
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Route.FidaUserRouteToken", "UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.FidaVehicle", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Route.RouteAddress", "EndAddress")
                        .WithOne()
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Route.FidaVehicle", "EndAddressId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Route.RouteAddress", "StartAddress")
                        .WithOne()
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Route.FidaVehicle", "StartAddressId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", "User")
                        .WithMany("FidaVehicles")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EndAddress");

                    b.Navigation("StartAddress");

                    b.Navigation("User");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.RouteAddress", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Route.FidaVehicle", "FidaVeichle")
                        .WithMany()
                        .HasForeignKey("FidaVeichleId");

                    b.Navigation("FidaVeichle");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Route.RouteAddressMap", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", "TmkTemplate")
                        .WithOne()
                        .HasForeignKey("FidaBlazorNet6.Shared.Models.Route.RouteAddressMap", "TmkTemplateId");

                    b.Navigation("TmkTemplate");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.System.Tracer", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Csv.CsvMapTemplate", null)
                        .WithMany("Tracers")
                        .HasForeignKey("CsvMapTemplateId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", null)
                        .WithMany("Tracers")
                        .HasForeignKey("TmkSheetTemplateId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetAssignment", null)
                        .WithMany("Tracers")
                        .HasForeignKey("WorkSheetAssignmentId");

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", null)
                        .WithMany("Tracers")
                        .HasForeignKey("WorkSheetId");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailAddress", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "BccEmailMessage")
                        .WithMany("BccAddresses")
                        .HasForeignKey("BccEmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", null)
                        .WithMany("BccAddresses")
                        .HasForeignKey("BccWtEmailMessageId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "CcEmailMessage")
                        .WithMany("CcAddresses")
                        .HasForeignKey("CcEmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", null)
                        .WithMany("CcAddresses")
                        .HasForeignKey("CcWtEmailMessageId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Contact", null)
                        .WithMany("Emails")
                        .HasForeignKey("ContactId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "FromEmailMessage")
                        .WithMany("FromAddresses")
                        .HasForeignKey("FromEmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", null)
                        .WithMany("FromAddresses")
                        .HasForeignKey("FromWtEmailMessageId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "ReplyToEmailMessage")
                        .WithMany("ReplyTo")
                        .HasForeignKey("ReplyToEmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "ToEmailMessage")
                        .WithMany("ToAddresses")
                        .HasForeignKey("ToEmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", null)
                        .WithMany("ToAddresses")
                        .HasForeignKey("ToWtEmailMessageId")
                        .OnDelete(DeleteBehavior.Restrict);

                    b.Navigation("BccEmailMessage");

                    b.Navigation("CcEmailMessage");

                    b.Navigation("FromEmailMessage");

                    b.Navigation("ReplyToEmailMessage");

                    b.Navigation("ToEmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailAttachment", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithMany("Attachments")
                        .HasForeignKey("EmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailTemplate", "EmailTemplate")
                        .WithMany("Attachments")
                        .HasForeignKey("EmailTemplateId")
                        .OnDelete(DeleteBehavior.Cascade);

                    b.HasOne("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", null)
                        .WithMany("Attachments")
                        .HasForeignKey("WtEmailId");

                    b.Navigation("EmailMessage");

                    b.Navigation("EmailTemplate");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailEvent", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithMany("EmailEvents")
                        .HasForeignKey("EmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailHeader", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithMany("Headers")
                        .HasForeignKey("EmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessage", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany("EmailMessages")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessageFlag", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithMany("MessageFlags")
                        .HasForeignKey("EmailMessageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessageId", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithMany("References")
                        .HasForeignKey("EmailMessageParentId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailTemplate", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany("EmailTemplates")
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailUid", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Email.EmailMessage", "EmailMessage")
                        .WithOne("Uid")
                        .HasForeignKey("FidaBlazorUI_Share.Models.Email.EmailUid", "Id")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("EmailMessage");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LangTransPage", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Page", "Page")
                        .WithMany("LangTransPages")
                        .HasForeignKey("PageId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorUI_Share.Models.Language.LangTranslation", "LangTranslation")
                        .WithMany("LangTransPages")
                        .HasForeignKey("langTranslationId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("LangTranslation");

                    b.Navigation("Page");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LangTranslation", b =>
                {
                    b.HasOne("FidaBlazorUI_Share.Models.Language.BaseLangCode", "BaseLang")
                        .WithMany("LangTranslations")
                        .HasForeignKey("BaseLangId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("FidaBlazorUI_Share.Models.Language.LanguageCode", "LangCode")
                        .WithMany("LangTranslations")
                        .HasForeignKey("LangCodeId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("BaseLang");

                    b.Navigation("LangCode");
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<int>", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.Role", null)
                        .WithMany()
                        .HasForeignKey("RoleId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<int>", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<int>", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<int>", b =>
                {
                    b.HasOne("FidaBlazorNet6.Shared.Models.Account.User", null)
                        .WithMany()
                        .HasForeignKey("UserId")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.Role", b =>
                {
                    b.Navigation("TmkTemplateRoles");

                    b.Navigation("UserRoles");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Account.User", b =>
                {
                    b.Navigation("Adresses");

                    b.Navigation("AppDynamicNavMenu");

                    b.Navigation("EmailMessages");

                    b.Navigation("EmailTemplates");

                    b.Navigation("FidaVehicles");

                    b.Navigation("IdentityNumbers");

                    b.Navigation("PhoneNumbers");

                    b.Navigation("Profile");

                    b.Navigation("RouteToken");

                    b.Navigation("SecondaryEMailAddresses");

                    b.Navigation("UserRoles");

                    b.Navigation("WorkSheetAssignments");

                    b.Navigation("WorkTaskParameters");

                    b.Navigation("WorkTasks");

                    b.Navigation("oldPasswords");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Csv.CsvMapTemplate", b =>
                {
                    b.Navigation("CsvMaps");

                    b.Navigation("Tracers");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Contact", b =>
                {
                    b.Navigation("Emails");

                    b.Navigation("PhoneNumbers");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Lead", b =>
                {
                    b.Navigation("Contacts");

                    b.Navigation("LeadAddress");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomation", b =>
                {
                    b.Navigation("TriggeredActions");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskAutomation.TaskAutomationTemplate", b =>
                {
                    b.Navigation("TriggeredActions");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.TaskFieldTemplate", b =>
                {
                    b.Navigation("DropSelectItems");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTaskTemplates.WorkTaskTemplate", b =>
                {
                    b.Navigation("TaskAutomations");

                    b.Navigation("TaskFields");

                    b.Navigation("WorkTasks");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WT_Email.WtEmail", b =>
                {
                    b.Navigation("Attachments");

                    b.Navigation("BccAddresses");

                    b.Navigation("CcAddresses");

                    b.Navigation("FromAddresses");

                    b.Navigation("ToAddresses");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasks.WorkTask", b =>
                {
                    b.Navigation("TaskAutomations");

                    b.Navigation("TaskFields");

                    b.Navigation("WtEmailMessage");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.Tasks.WorkTasksGeneralParameters.WorkTaskParameter", b =>
                {
                    b.Navigation("DayWorkWindows");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutRow", b =>
                {
                    b.Navigation("LayoutColumns");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.Layout.TmkLayoutTemplate", b =>
                {
                    b.Navigation("LayoutRows");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetField", b =>
                {
                    b.Navigation("SelectItems");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.TmkSheetTemplates.TmkSheetTemplate", b =>
                {
                    b.Navigation("AssignmentReasons");

                    b.Navigation("Fields");

                    b.Navigation("LayoutTemplates");

                    b.Navigation("Roles");

                    b.Navigation("Tracers");

                    b.Navigation("WorkTaskTemplates");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheet", b =>
                {
                    b.Navigation("Fields");

                    b.Navigation("Tracers");

                    b.Navigation("WorkSheetAssignments");

                    b.Navigation("WorkTasks");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetAssignment", b =>
                {
                    b.Navigation("Tracers");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Leads.WorkSheets.WorkSheetField", b =>
                {
                    b.Navigation("SelectItems");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.AppDynamicNavMenu", b =>
                {
                    b.Navigation("MenuItems");

                    b.Navigation("SubMenus");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenu", b =>
                {
                    b.Navigation("SubMenuHeader");

                    b.Navigation("SubMenuList");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuHeader", b =>
                {
                    b.Navigation("NavMenuItem");
                });

            modelBuilder.Entity("FidaBlazorNet6.Shared.Models.Menus.SubMenuList", b =>
                {
                    b.Navigation("Items");

                    b.Navigation("SubMenus");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailMessage", b =>
                {
                    b.Navigation("Attachments");

                    b.Navigation("BccAddresses");

                    b.Navigation("CcAddresses");

                    b.Navigation("EmailEvents");

                    b.Navigation("FromAddresses");

                    b.Navigation("Headers");

                    b.Navigation("MessageFlags");

                    b.Navigation("References");

                    b.Navigation("ReplyTo");

                    b.Navigation("ToAddresses");

                    b.Navigation("Uid");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Email.EmailTemplate", b =>
                {
                    b.Navigation("Attachments");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.BaseLangCode", b =>
                {
                    b.Navigation("LangTranslations");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LangTranslation", b =>
                {
                    b.Navigation("LangTransPages");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Language.LanguageCode", b =>
                {
                    b.Navigation("LangTranslations");
                });

            modelBuilder.Entity("FidaBlazorUI_Share.Models.Page", b =>
                {
                    b.Navigation("LangTransPages");
                });
#pragma warning restore 612, 618
        }
    }
}
`
And This is the first Migration file:

`using System;
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FidaBlazorNet6.Server.Migrations
{
    public partial class InitialCreate : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AlterDatabase()
                .Annotation("Npgsql:Enum:day_of_week", "sunday,monday,tuesday,wednesday,thursday,friday,saturday");

            migrationBuilder.CreateTable(
                name: "AspNetRoles",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Name = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    NormalizedName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    ConcurrencyStamp = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoles", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "BaseLangCodes",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    KeyText = table.Column<string>(type: "text", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_BaseLangCodes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CsvMapTemplates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    CsvTemplateName = table.Column<string>(type: "text", nullable: false),
                    SheetTemplateName = table.Column<string>(type: "text", nullable: false),
                    CsvValuesNumber = table.Column<int>(type: "integer", nullable: false),
                    Deleted = table.Column<bool>(type: "boolean", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CsvMapTemplates", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "EmailVerificationResponse",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Result = table.Column<string>(type: "text", nullable: true),
                    Reason = table.Column<string>(type: "text", nullable: true),
                    Disposable = table.Column<bool>(type: "boolean", nullable: false),
                    Accept_all = table.Column<bool>(type: "boolean", nullable: false),
                    Role = table.Column<bool>(type: "boolean", nullable: false),
                    Free = table.Column<bool>(type: "boolean", nullable: false),
                    Email = table.Column<string>(type: "text", nullable: true),
                    User = table.Column<string>(type: "text", nullable: true),
                    Domain = table.Column<string>(type: "text", nullable: true),
                    Mx_record = table.Column<string>(type: "text", nullable: true),
                    Mx_domain = table.Column<string>(type: "text", nullable: true),
                    Safe_to_send = table.Column<bool>(type: "boolean", nullable: false),
                    Did_you_mean = table.Column<string>(type: "text", nullable: true),
                    Success = table.Column<bool>(type: "boolean", nullable: false),
                    Message = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailVerificationResponse", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "LanguageCodes",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Code = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LanguageCodes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Leads",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    CompanyName = table.Column<string>(type: "text", nullable: true),
                    LeadPurchasingDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    IndustrySector = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Leads", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "Pages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Url = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Pages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "WorkSheets",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Protocol = table.Column<string>(type: "text", nullable: false),
                    Deleted = table.Column<bool>(type: "boolean", nullable: false),
                    ScheduledForMeeting = table.Column<bool>(type: "boolean", nullable: false),
                    TemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkSheets", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AspNetRoleClaims",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    RoleId = table.Column<int>(type: "integer", nullable: false),
                    ClaimType = table.Column<string>(type: "text", nullable: true),
                    ClaimValue = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetRoleClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetRoleClaims_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "CsvTempItem",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Index = table.Column<int>(type: "integer", nullable: false),
                    Header = table.Column<string>(type: "text", nullable: false),
                    Value = table.Column<string>(type: "text", nullable: true),
                    ClassPropertyName = table.Column<string>(type: "text", nullable: false),
                    MapTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CsvTempItem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CsvTempItem_CsvMapTemplates_MapTemplateId",
                        column: x => x.MapTemplateId,
                        principalTable: "CsvMapTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "VerifiedEmails",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    EmailAddress = table.Column<string>(type: "text", nullable: true),
                    VerificationResponseId = table.Column<int>(type: "integer", nullable: true),
                    VerificationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_VerifiedEmails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_VerifiedEmails_EmailVerificationResponse_VerificationRespon~",
                        column: x => x.VerificationResponseId,
                        principalTable: "EmailVerificationResponse",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUsers",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FirstName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
                    LastName = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: true),
                    BirthDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    PlaceOfBirth = table.Column<string>(type: "text", nullable: true),
                    Gender = table.Column<int>(type: "integer", nullable: false),
                    Thumbnail = table.Column<string>(type: "text", nullable: true),
                    PhotoUrl = table.Column<string>(type: "text", nullable: true),
                    IsDisabled = table.Column<bool>(type: "boolean", nullable: false),
                    EnableWorkTaskSetting = table.Column<bool>(type: "boolean", nullable: false),
                    ImapPassword = table.Column<string>(type: "text", nullable: true),
                    LanguageId = table.Column<int>(type: "integer", nullable: true),
                    UserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    NormalizedUserName = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    Email = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    NormalizedEmail = table.Column<string>(type: "character varying(256)", maxLength: 256, nullable: true),
                    EmailConfirmed = table.Column<bool>(type: "boolean", nullable: false),
                    PasswordHash = table.Column<string>(type: "text", nullable: true),
                    SecurityStamp = table.Column<string>(type: "text", nullable: true),
                    ConcurrencyStamp = table.Column<string>(type: "text", nullable: true),
                    PhoneNumber = table.Column<string>(type: "text", nullable: true),
                    PhoneNumberConfirmed = table.Column<bool>(type: "boolean", nullable: false),
                    TwoFactorEnabled = table.Column<bool>(type: "boolean", nullable: false),
                    LockoutEnd = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
                    LockoutEnabled = table.Column<bool>(type: "boolean", nullable: false),
                    AccessFailedCount = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUsers", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetUsers_LanguageCodes_LanguageId",
                        column: x => x.LanguageId,
                        principalTable: "LanguageCodes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "LangTranslations",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Translation = table.Column<string>(type: "text", nullable: true),
                    BaseLangId = table.Column<int>(type: "integer", nullable: false),
                    LangCodeId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LangTranslations", x => x.Id);
                    table.ForeignKey(
                        name: "FK_LangTranslations_BaseLangCodes_BaseLangId",
                        column: x => x.BaseLangId,
                        principalTable: "BaseLangCodes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_LangTranslations_LanguageCodes_LangCodeId",
                        column: x => x.LangCodeId,
                        principalTable: "LanguageCodes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "Contact",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Appellative = table.Column<int>(type: "integer", nullable: false),
                    Name = table.Column<string>(type: "text", nullable: true),
                    FamilyName = table.Column<string>(type: "text", nullable: true),
                    Gender = table.Column<int>(type: "integer", nullable: false),
                    CompanyPosition = table.Column<int>(type: "integer", nullable: false),
                    LeadId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Contact", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Contact_Leads_LeadId",
                        column: x => x.LeadId,
                        principalTable: "Leads",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WorkSheetFields",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FieldName = table.Column<string>(type: "text", nullable: false),
                    FieldType = table.Column<int>(type: "integer", nullable: false),
                    FieldValue = table.Column<string>(type: "text", nullable: true),
                    Priority = table.Column<int>(type: "integer", nullable: false),
                    Mandatory = table.Column<bool>(type: "boolean", nullable: false),
                    FillWithCurrentUser = table.Column<bool>(type: "boolean", nullable: false),
                    NeedValidEmail = table.Column<bool>(type: "boolean", nullable: false),
                    EmailCheckStatus = table.Column<int>(type: "integer", nullable: false),
                    WorkSheetId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkSheetFields", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkSheetFields_WorkSheets_WorkSheetId",
                        column: x => x.WorkSheetId,
                        principalTable: "WorkSheets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "AppDynamicNavMenus",
                columns: table => new
                {
                    AppId = table.Column<int>(type: "integer", nullable: false),
                    Multi = table.Column<bool>(type: "boolean", nullable: false),
                    Id = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Class = table.Column<string>(type: "text", nullable: true),
                    Style = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AppDynamicNavMenus", x => x.AppId);
                    table.ForeignKey(
                        name: "FK_AppDynamicNavMenus_AspNetUsers_AppId",
                        column: x => x.AppId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserClaims",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    UserId = table.Column<int>(type: "integer", nullable: false),
                    ClaimType = table.Column<string>(type: "text", nullable: true),
                    ClaimValue = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserClaims", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AspNetUserClaims_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserLogins",
                columns: table => new
                {
                    LoginProvider = table.Column<string>(type: "text", nullable: false),
                    ProviderKey = table.Column<string>(type: "text", nullable: false),
                    ProviderDisplayName = table.Column<string>(type: "text", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserLogins", x => new { x.LoginProvider, x.ProviderKey });
                    table.ForeignKey(
                        name: "FK_AspNetUserLogins_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserRoles",
                columns: table => new
                {
                    UserId = table.Column<int>(type: "integer", nullable: false),
                    RoleId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserRoles", x => new { x.UserId, x.RoleId });
                    table.ForeignKey(
                        name: "FK_AspNetUserRoles_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_AspNetUserRoles_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "AspNetUserTokens",
                columns: table => new
                {
                    UserId = table.Column<int>(type: "integer", nullable: false),
                    LoginProvider = table.Column<string>(type: "text", nullable: false),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Value = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AspNetUserTokens", x => new { x.UserId, x.LoginProvider, x.Name });
                    table.ForeignKey(
                        name: "FK_AspNetUserTokens_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailMessages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    MessageId = table.Column<string>(type: "text", nullable: true),
                    MessageIds = table.Column<List<string>>(type: "text[]", nullable: true),
                    Date = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
                    Importance = table.Column<int>(type: "integer", nullable: false),
                    Priority = table.Column<int>(type: "integer", nullable: false),
                    Subject = table.Column<string>(type: "text", nullable: true),
                    Body = table.Column<string>(type: "text", nullable: true),
                    IsHtml = table.Column<bool>(type: "boolean", nullable: false),
                    NeedReadReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    NeedDeliveredReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    InReplyTo = table.Column<string>(type: "text", nullable: true),
                    Sender = table.Column<string>(type: "text", nullable: true),
                    MessageDirection = table.Column<int>(type: "integer", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailMessages", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailMessages_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailTemplates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ClassDataSource = table.Column<string>(type: "text", nullable: true),
                    TemplateName = table.Column<string>(type: "text", nullable: true),
                    Subject = table.Column<string>(type: "text", nullable: true),
                    Body = table.Column<string>(type: "text", nullable: true),
                    NeedReadReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    NeedDeliveredReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    Shared = table.Column<bool>(type: "boolean", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailTemplates", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailTemplates_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "FidaUserRouteToken",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Token = table.Column<string>(type: "text", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FidaUserRouteToken", x => x.Id);
                    table.ForeignKey(
                        name: "FK_FidaUserRouteToken_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "OldPassword",
                columns: table => new
                {
                    id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    oldPasswordHash = table.Column<string>(type: "text", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OldPassword", x => x.id);
                    table.ForeignKey(
                        name: "FK_OldPassword_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "UserAddress",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    NameId = table.Column<string>(type: "text", nullable: false),
                    Street = table.Column<string>(type: "text", nullable: false),
                    Number = table.Column<string>(type: "text", nullable: false),
                    Flat = table.Column<string>(type: "text", nullable: true),
                    Staircase = table.Column<string>(type: "text", nullable: true),
                    City = table.Column<string>(type: "text", nullable: false),
                    PostalCode = table.Column<string>(type: "text", nullable: false),
                    County = table.Column<string>(type: "text", nullable: false),
                    Country = table.Column<int>(type: "integer", nullable: false),
                    State = table.Column<string>(type: "text", nullable: true),
                    AddressType = table.Column<int>(type: "integer", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: true),
                    LeadId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserAddress", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserAddress_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_UserAddress_Leads_LeadId",
                        column: x => x.LeadId,
                        principalTable: "Leads",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "UserIdentityNumber",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    IdNumber = table.Column<string>(type: "text", nullable: false),
                    IdType = table.Column<int>(type: "integer", nullable: false),
                    DocumentCopyUrl = table.Column<string>(type: "text", nullable: true),
                    DocumentThumbnail = table.Column<string>(type: "text", nullable: true),
                    IssuingDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    ExpiringDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    DocumentIssuer = table.Column<string>(type: "text", nullable: true),
                    IssuingPlace = table.Column<string>(type: "text", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserIdentityNumber", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserIdentityNumber_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "UserMailAddress",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: true),
                    Address = table.Column<string>(type: "text", nullable: false),
                    MailType = table.Column<int>(type: "integer", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserMailAddress", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserMailAddress_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "UserProfile",
                columns: table => new
                {
                    Id = table.Column<long>(type: "bigint", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    UserId = table.Column<int>(type: "integer", nullable: false),
                    LastPageVisited = table.Column<string>(type: "text", nullable: true),
                    IsNavOpen = table.Column<bool>(type: "boolean", nullable: false),
                    IsNavMinified = table.Column<bool>(type: "boolean", nullable: false),
                    Count = table.Column<int>(type: "integer", nullable: false),
                    LastUpdatedDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_UserProfile", x => x.Id);
                    table.ForeignKey(
                        name: "FK_UserProfile_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WorkSheetAssignments",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    WorkSheetId = table.Column<int>(type: "integer", nullable: false),
                    AssigneeId = table.Column<int>(type: "integer", nullable: false),
                    UserSelectedToWork = table.Column<bool>(type: "boolean", nullable: false),
                    AssignmentDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    AssignmentReason = table.Column<string>(type: "text", nullable: false),
                    AssignmentEnd = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    AssignmentEndReason = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkSheetAssignments", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkSheetAssignments_AspNetUsers_AssigneeId",
                        column: x => x.AssigneeId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_WorkSheetAssignments_WorkSheets_WorkSheetId",
                        column: x => x.WorkSheetId,
                        principalTable: "WorkSheets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WorkTaskParameter",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    WorkTaskType = table.Column<int>(type: "integer", nullable: false),
                    DurationInMinutes = table.Column<int>(type: "integer", nullable: false),
                    ValidityStart = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    ValidityEnd = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    Description = table.Column<string>(type: "text", nullable: true),
                    FromAdmin = table.Column<bool>(type: "boolean", nullable: false),
                    WeekWorkDays = table.Column<int[]>(type: "integer[]", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkTaskParameter", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkTaskParameter_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "LangTransPage",
                columns: table => new
                {
                    langTranslationId = table.Column<int>(type: "integer", nullable: false),
                    PageId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_LangTransPage", x => new { x.PageId, x.langTranslationId });
                    table.ForeignKey(
                        name: "FK_LangTransPage_LangTranslations_langTranslationId",
                        column: x => x.langTranslationId,
                        principalTable: "LangTranslations",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_LangTransPage_Pages_PageId",
                        column: x => x.PageId,
                        principalTable: "Pages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "PhoneNumber",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    CountryDialCode = table.Column<string>(type: "text", nullable: false),
                    Number = table.Column<string>(type: "text", nullable: false),
                    NumberType = table.Column<int>(type: "integer", nullable: false),
                    Notes = table.Column<string>(type: "text", nullable: true),
                    UserId = table.Column<int>(type: "integer", nullable: true),
                    ContactId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PhoneNumber", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PhoneNumber_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_PhoneNumber_Contact_ContactId",
                        column: x => x.ContactId,
                        principalTable: "Contact",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WorkSheetFieldSelectItem",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ItemName = table.Column<string>(type: "text", nullable: false),
                    ItemValue = table.Column<string>(type: "text", nullable: false),
                    IsDefaultValue = table.Column<bool>(type: "boolean", nullable: false),
                    WorkSheetFieldId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkSheetFieldSelectItem", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkSheetFieldSelectItem_WorkSheetFields_WorkSheetFieldId",
                        column: x => x.WorkSheetFieldId,
                        principalTable: "WorkSheetFields",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailEvents",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Email = table.Column<string>(type: "text", nullable: true),
                    Date = table.Column<string>(type: "text", nullable: true),
                    Subject = table.Column<string>(type: "text", nullable: true),
                    MessageId = table.Column<string>(type: "text", nullable: true),
                    Event = table.Column<string>(type: "text", nullable: true),
                    Reason = table.Column<string>(type: "text", nullable: true),
                    Tag = table.Column<string>(type: "text", nullable: true),
                    Ip = table.Column<string>(type: "text", nullable: true),
                    Link = table.Column<string>(type: "text", nullable: true),
                    From = table.Column<string>(type: "text", nullable: true),
                    TemplateId = table.Column<long>(type: "bigint", nullable: true),
                    EventRegistrationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailEvents", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailEvents_EmailMessages_EmailMessageId",
                        column: x => x.EmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailHeaders",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    RawField = table.Column<byte[]>(type: "bytea", nullable: true),
                    HeaderId = table.Column<int>(type: "integer", nullable: false),
                    Field = table.Column<string>(type: "text", nullable: true),
                    Offset = table.Column<long>(type: "bigint", nullable: true),
                    RawValue = table.Column<byte[]>(type: "bytea", nullable: true),
                    Value = table.Column<string>(type: "text", nullable: true),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailHeaders", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailHeaders_EmailMessages_EmailMessageId",
                        column: x => x.EmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailMessageFlag",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    MessageFlag = table.Column<int>(type: "integer", nullable: false),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailMessageFlag", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailMessageFlag_EmailMessages_EmailMessageId",
                        column: x => x.EmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailMessageId",
                columns: table => new
                {
                    Id = table.Column<string>(type: "text", nullable: false),
                    MessageId = table.Column<string>(type: "text", nullable: true),
                    EmailMessageParentId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailMessageId", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailMessageId_EmailMessages_EmailMessageParentId",
                        column: x => x.EmailMessageParentId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailUid",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false),
                    UidId = table.Column<long>(type: "bigint", nullable: false),
                    Validity = table.Column<long>(type: "bigint", nullable: false),
                    IsValid = table.Column<bool>(type: "boolean", nullable: false),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailUid", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailUid_EmailMessages_Id",
                        column: x => x.Id,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WorkWindow",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Day = table.Column<int>(type: "integer", nullable: false),
                    Start = table.Column<TimeSpan>(type: "interval", nullable: false),
                    End = table.Column<TimeSpan>(type: "interval", nullable: false),
                    WorkTaskParameterId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkWindow", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkWindow_WorkTaskParameter_WorkTaskParameterId",
                        column: x => x.WorkTaskParameterId,
                        principalTable: "WorkTaskParameter",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "NavMenuItems",
                columns: table => new
                {
                    AppId = table.Column<int>(type: "integer", nullable: false),
                    Href = table.Column<string>(type: "text", nullable: true),
                    Disabled = table.Column<bool>(type: "boolean", nullable: false),
                    AllowSection = table.Column<bool>(type: "boolean", nullable: false),
                    Content = table.Column<string>(type: "text", nullable: true),
                    Icon = table.Column<string>(type: "text", nullable: true),
                    AppDynamicNavMenuAppId = table.Column<int>(type: "integer", nullable: true),
                    SubMenuListAppId = table.Column<int>(type: "integer", nullable: true),
                    Id = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Class = table.Column<string>(type: "text", nullable: true),
                    Style = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_NavMenuItems", x => x.AppId);
                    table.ForeignKey(
                        name: "FK_NavMenuItems_AppDynamicNavMenus_AppDynamicNavMenuAppId",
                        column: x => x.AppDynamicNavMenuAppId,
                        principalTable: "AppDynamicNavMenus",
                        principalColumn: "AppId",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "SubMenus",
                columns: table => new
                {
                    AppId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Selected = table.Column<bool>(type: "boolean", nullable: false),
                    Expanded = table.Column<bool>(type: "boolean", nullable: false),
                    AppDynamicNavMenuAppId = table.Column<int>(type: "integer", nullable: true),
                    SubMenuListAppId1 = table.Column<int>(type: "integer", nullable: true),
                    Id = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Class = table.Column<string>(type: "text", nullable: true),
                    Style = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SubMenus", x => x.AppId);
                    table.ForeignKey(
                        name: "FK_SubMenus_AppDynamicNavMenus_AppDynamicNavMenuAppId",
                        column: x => x.AppDynamicNavMenuAppId,
                        principalTable: "AppDynamicNavMenus",
                        principalColumn: "AppId",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "SubMenuHeaders",
                columns: table => new
                {
                    AppId = table.Column<int>(type: "integer", nullable: false),
                    Content = table.Column<string>(type: "text", nullable: true),
                    Id = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Class = table.Column<string>(type: "text", nullable: true),
                    Style = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SubMenuHeaders", x => x.AppId);
                    table.ForeignKey(
                        name: "FK_SubMenuHeaders_SubMenus_AppId",
                        column: x => x.AppId,
                        principalTable: "SubMenus",
                        principalColumn: "AppId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "SubMenuLists",
                columns: table => new
                {
                    AppId = table.Column<int>(type: "integer", nullable: false),
                    Id = table.Column<string>(type: "text", nullable: true),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Class = table.Column<string>(type: "text", nullable: true),
                    Style = table.Column<string>(type: "text", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_SubMenuLists", x => x.AppId);
                    table.ForeignKey(
                        name: "FK_SubMenuLists_SubMenus_AppId",
                        column: x => x.AppId,
                        principalTable: "SubMenus",
                        principalColumn: "AppId",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TmkTemplateRole",
                columns: table => new
                {
                    TemplateId = table.Column<int>(type: "integer", nullable: false),
                    RoleId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkTemplateRole", x => new { x.TemplateId, x.RoleId });
                    table.ForeignKey(
                        name: "FK_TmkTemplateRole_AspNetRoles_RoleId",
                        column: x => x.RoleId,
                        principalTable: "AspNetRoles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "FidaVehicles",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    Selected = table.Column<bool>(type: "boolean", nullable: false),
                    StartCoordinates = table.Column<double[]>(type: "double precision[]", nullable: true),
                    EndCoordinates = table.Column<double[]>(type: "double precision[]", nullable: true),
                    VehicleProfile = table.Column<int>(type: "integer", nullable: false),
                    WorkStart = table.Column<TimeSpan>(type: "interval", nullable: false),
                    WorkEnd = table.Column<TimeSpan>(type: "interval", nullable: false),
                    BreakDuration = table.Column<int>(type: "integer", nullable: false),
                    BreakStart = table.Column<TimeSpan>(type: "interval", nullable: false),
                    BreakEnd = table.Column<TimeSpan>(type: "interval", nullable: false),
                    ValidityStart = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    ValidityEnd = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    StartAddressId = table.Column<int>(type: "integer", nullable: false),
                    EndAddressId = table.Column<int>(type: "integer", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_FidaVehicles", x => x.Id);
                    table.ForeignKey(
                        name: "FK_FidaVehicles_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "RouteAddress",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Address = table.Column<string>(type: "text", nullable: true),
                    Locality = table.Column<string>(type: "text", nullable: true),
                    Postalcode = table.Column<string>(type: "text", nullable: true),
                    Country = table.Column<string>(type: "text", nullable: true),
                    FidaVeichleId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RouteAddress", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RouteAddress_FidaVehicles_FidaVeichleId",
                        column: x => x.FidaVeichleId,
                        principalTable: "FidaVehicles",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "WorkTasks",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    DueOn = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    Start = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    End = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    Duration = table.Column<int>(type: "integer", nullable: false),
                    TaskType = table.Column<int>(type: "integer", nullable: false),
                    WtChanged = table.Column<bool>(type: "boolean", nullable: false),
                    TemplateId = table.Column<int>(type: "integer", nullable: false),
                    EmailTemplateId = table.Column<int>(type: "integer", nullable: true),
                    WorkSheetId = table.Column<int>(type: "integer", nullable: false),
                    UserId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkTasks", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkTasks_AspNetUsers_UserId",
                        column: x => x.UserId,
                        principalTable: "AspNetUsers",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_WorkTasks_WorkSheets_WorkSheetId",
                        column: x => x.WorkSheetId,
                        principalTable: "WorkSheets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TaskAutomations",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    TriggerEvent = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskAutomations", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskAutomations_WorkTasks_WorkTaskId",
                        column: x => x.WorkTaskId,
                        principalTable: "WorkTasks",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TaskField",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FieldType = table.Column<int>(type: "integer", nullable: false),
                    FieldName = table.Column<string>(type: "text", nullable: false),
                    FieldValue = table.Column<string>(type: "text", nullable: true),
                    WorkTaskId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskField", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskField_WorkTasks_WorkTaskId",
                        column: x => x.WorkTaskId,
                        principalTable: "WorkTasks",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WtEmails",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Importance = table.Column<int>(type: "integer", nullable: false),
                    Priority = table.Column<int>(type: "integer", nullable: false),
                    Subject = table.Column<string>(type: "text", nullable: true),
                    Body = table.Column<string>(type: "text", nullable: true),
                    NeedReadReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    NeedDeliveredReceipt = table.Column<bool>(type: "boolean", nullable: false),
                    ExecutionCleared = table.Column<bool>(type: "boolean", nullable: false),
                    ExecutionClearedDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    Executed = table.Column<bool>(type: "boolean", nullable: false),
                    ExecutionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    MessageId = table.Column<string>(type: "text", nullable: true),
                    MessageIds = table.Column<List<string>>(type: "text[]", nullable: true),
                    WorkTaskId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WtEmails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WtEmails_WorkTasks_WorkTaskId",
                        column: x => x.WorkTaskId,
                        principalTable: "WorkTasks",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WT_Action",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    ActionType = table.Column<int>(type: "integer", nullable: false),
                    Delay = table.Column<double>(type: "double precision", nullable: false),
                    ClassType = table.Column<string>(type: "text", nullable: true),
                    ClassPropertyName = table.Column<string>(type: "text", nullable: true),
                    ClassPropertyValue = table.Column<string>(type: "text", nullable: true),
                    EmailTemplateId = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskType = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskTemplateId = table.Column<int>(type: "integer", nullable: false),
                    RegistrationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: false),
                    Executed = table.Column<bool>(type: "boolean", nullable: false),
                    ExecutionDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    TaskAutomationId = table.Column<int>(type: "integer", nullable: false),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WT_Action", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WT_Action_EmailMessages_EmailMessageId",
                        column: x => x.EmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_WT_Action_TaskAutomations_TaskAutomationId",
                        column: x => x.TaskAutomationId,
                        principalTable: "TaskAutomations",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "EmailAddress",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: true),
                    Address = table.Column<string>(type: "text", nullable: true),
                    ToEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    FromEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    BccEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    CcEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    ReplyToEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    ContactId = table.Column<int>(type: "integer", nullable: true),
                    ToWtEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    FromWtEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    BccWtEmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    CcWtEmailMessageId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailAddress", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailAddress_Contact_ContactId",
                        column: x => x.ContactId,
                        principalTable: "Contact",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_EmailMessages_BccEmailMessageId",
                        column: x => x.BccEmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_EmailMessages_CcEmailMessageId",
                        column: x => x.CcEmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_EmailMessages_FromEmailMessageId",
                        column: x => x.FromEmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_EmailMessages_ReplyToEmailMessageId",
                        column: x => x.ReplyToEmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_EmailMessages_ToEmailMessageId",
                        column: x => x.ToEmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAddress_WtEmails_BccWtEmailMessageId",
                        column: x => x.BccWtEmailMessageId,
                        principalTable: "WtEmails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_EmailAddress_WtEmails_CcWtEmailMessageId",
                        column: x => x.CcWtEmailMessageId,
                        principalTable: "WtEmails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_EmailAddress_WtEmails_FromWtEmailMessageId",
                        column: x => x.FromWtEmailMessageId,
                        principalTable: "WtEmails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_EmailAddress_WtEmails_ToWtEmailMessageId",
                        column: x => x.ToWtEmailMessageId,
                        principalTable: "WtEmails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "EmailAttachments",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FileName = table.Column<string>(type: "text", nullable: true),
                    FileNameUrl = table.Column<string>(type: "text", nullable: true),
                    FileFullPath = table.Column<string>(type: "text", nullable: true),
                    FileUrl = table.Column<string>(type: "text", nullable: true),
                    MediaType = table.Column<string>(type: "text", nullable: true),
                    MediaSubType = table.Column<string>(type: "text", nullable: true),
                    FileDataBytes = table.Column<byte[]>(type: "bytea", nullable: true),
                    EmailMessageId = table.Column<int>(type: "integer", nullable: true),
                    EmailTemplateId = table.Column<int>(type: "integer", nullable: true),
                    WtEmailId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_EmailAttachments", x => x.Id);
                    table.ForeignKey(
                        name: "FK_EmailAttachments_EmailMessages_EmailMessageId",
                        column: x => x.EmailMessageId,
                        principalTable: "EmailMessages",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAttachments_EmailTemplates_EmailTemplateId",
                        column: x => x.EmailTemplateId,
                        principalTable: "EmailTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                    table.ForeignKey(
                        name: "FK_EmailAttachments_WtEmails_WtEmailId",
                        column: x => x.WtEmailId,
                        principalTable: "WtEmails",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "Tracer",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    CreationDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    CreatorName = table.Column<string>(type: "text", nullable: true),
                    ModifierName = table.Column<string>(type: "text", nullable: true),
                    ModifyDate = table.Column<DateTime>(type: "timestamp without time zone", nullable: true),
                    CsvMapTemplateId = table.Column<int>(type: "integer", nullable: true),
                    TmkSheetTemplateId = table.Column<int>(type: "integer", nullable: true),
                    WorkSheetAssignmentId = table.Column<int>(type: "integer", nullable: true),
                    WorkSheetId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Tracer", x => x.Id);
                    table.ForeignKey(
                        name: "FK_Tracer_CsvMapTemplates_CsvMapTemplateId",
                        column: x => x.CsvMapTemplateId,
                        principalTable: "CsvMapTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Tracer_WorkSheetAssignments_WorkSheetAssignmentId",
                        column: x => x.WorkSheetAssignmentId,
                        principalTable: "WorkSheetAssignments",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                    table.ForeignKey(
                        name: "FK_Tracer_WorkSheets_WorkSheetId",
                        column: x => x.WorkSheetId,
                        principalTable: "WorkSheets",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TmkSheetTemplates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Name = table.Column<string>(type: "text", nullable: false),
                    Deleted = table.Column<bool>(type: "boolean", nullable: false),
                    FinalTaskType = table.Column<int>(type: "integer", nullable: false),
                    ProtNumTempId = table.Column<int>(type: "integer", nullable: true),
                    RouteAddressMapId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkSheetTemplates", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "AssignmentReason",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ReasonText = table.Column<string>(type: "text", nullable: false),
                    ReasonValue = table.Column<string>(type: "text", nullable: false),
                    TmkSheetTemplateId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_AssignmentReason", x => x.Id);
                    table.ForeignKey(
                        name: "FK_AssignmentReason_TmkSheetTemplates_TmkSheetTemplateId",
                        column: x => x.TmkSheetTemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "ProtocolTemplate",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ProtocolType = table.Column<int>(type: "integer", nullable: false),
                    Prefix = table.Column<string>(type: "text", nullable: true),
                    Suffix = table.Column<string>(type: "text", nullable: true),
                    ProtProgNumber = table.Column<int>(type: "integer", nullable: false),
                    TemplateId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProtocolTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_ProtocolTemplate_TmkSheetTemplates_TemplateId",
                        column: x => x.TemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "RouteAddressMap",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    AddressMapFieldName = table.Column<string>(type: "text", nullable: true),
                    CountryMapFieldName = table.Column<string>(type: "text", nullable: true),
                    PostalcodeMapFieldName = table.Column<string>(type: "text", nullable: true),
                    LocalityMapFieldName = table.Column<string>(type: "text", nullable: true),
                    TmkTemplateId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RouteAddressMap", x => x.Id);
                    table.ForeignKey(
                        name: "FK_RouteAddressMap_TmkSheetTemplates_TmkTemplateId",
                        column: x => x.TmkTemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TmkLayoutTemplates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    LayoutName = table.Column<string>(type: "text", nullable: true),
                    IsDefault = table.Column<bool>(type: "boolean", nullable: false),
                    TmkTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkLayoutTemplates", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TmkLayoutTemplates_TmkSheetTemplates_TmkTemplateId",
                        column: x => x.TmkTemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TmkSheetFields",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FieldName = table.Column<string>(type: "text", nullable: false),
                    FieldType = table.Column<int>(type: "integer", nullable: false),
                    DefaultValue = table.Column<string>(type: "text", nullable: true),
                    Priority = table.Column<int>(type: "integer", nullable: false),
                    Mandatory = table.Column<bool>(type: "boolean", nullable: false),
                    FillWithCurrentUser = table.Column<bool>(type: "boolean", nullable: false),
                    NeedValidEmail = table.Column<bool>(type: "boolean", nullable: false),
                    ReadOnly = table.Column<bool>(type: "boolean", nullable: false),
                    SheetTemplateId = table.Column<int>(type: "integer", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkSheetFields", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TmkSheetFields_TmkSheetTemplates_SheetTemplateId",
                        column: x => x.SheetTemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "WorkTaskTemplates",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    TaskTemplateName = table.Column<string>(type: "text", nullable: true),
                    TaskType = table.Column<int>(type: "integer", nullable: false),
                    TmkSheetTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WorkTaskTemplates", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WorkTaskTemplates_TmkSheetTemplates_TmkSheetTemplateId",
                        column: x => x.TmkSheetTemplateId,
                        principalTable: "TmkSheetTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Restrict);
                });

            migrationBuilder.CreateTable(
                name: "TmkLayoutRow",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Index = table.Column<int>(type: "integer", nullable: false),
                    TmkLayoutId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkLayoutRow", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TmkLayoutRow_TmkLayoutTemplates_TmkLayoutId",
                        column: x => x.TmkLayoutId,
                        principalTable: "TmkLayoutTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TmkFieldSelectValue",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ItemName = table.Column<string>(type: "text", nullable: false),
                    ItemValue = table.Column<string>(type: "text", nullable: false),
                    IsDefaultValue = table.Column<bool>(type: "boolean", nullable: false),
                    TmkSheetFieldId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkFieldSelectValue", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TmkFieldSelectValue_TmkSheetFields_TmkSheetFieldId",
                        column: x => x.TmkSheetFieldId,
                        principalTable: "TmkSheetFields",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TaskAutomationTemplate",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    TriggerEvent = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskAutomationTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskAutomationTemplate_WorkTaskTemplates_WorkTaskTemplateId",
                        column: x => x.WorkTaskTemplateId,
                        principalTable: "WorkTaskTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TaskFieldTemplate",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FieldType = table.Column<int>(type: "integer", nullable: false),
                    FieldName = table.Column<string>(type: "text", nullable: false),
                    FieldValue = table.Column<string>(type: "text", nullable: true),
                    Mandatory = table.Column<bool>(type: "boolean", nullable: false),
                    MandatoryForResult = table.Column<bool>(type: "boolean", nullable: false),
                    Priority = table.Column<int>(type: "integer", nullable: false),
                    FillWithCurrentUser = table.Column<bool>(type: "boolean", nullable: false),
                    NeedValidEmail = table.Column<bool>(type: "boolean", nullable: false),
                    ReadOnly = table.Column<bool>(type: "boolean", nullable: false),
                    WorkTaskTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskFieldTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskFieldTemplate_WorkTaskTemplates_WorkTaskTemplateId",
                        column: x => x.WorkTaskTemplateId,
                        principalTable: "WorkTaskTemplates",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TmkLayoutColumn",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    FieldName = table.Column<string>(type: "text", nullable: false),
                    Index = table.Column<int>(type: "integer", nullable: false),
                    ColumnSize = table.Column<int>(type: "integer", nullable: false),
                    LayoutRowId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TmkLayoutColumn", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TmkLayoutColumn_TmkLayoutRow_LayoutRowId",
                        column: x => x.LayoutRowId,
                        principalTable: "TmkLayoutRow",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "WT_ActionTemplate",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    Description = table.Column<string>(type: "text", nullable: true),
                    ActionType = table.Column<int>(type: "integer", nullable: false),
                    Delay = table.Column<double>(type: "double precision", nullable: false),
                    ClassType = table.Column<string>(type: "text", nullable: true),
                    ClassPropertyName = table.Column<string>(type: "text", nullable: true),
                    ClassPropertyValue = table.Column<string>(type: "text", nullable: true),
                    EmailAddress = table.Column<string>(type: "text", nullable: true),
                    EmailTemplateId = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskType = table.Column<int>(type: "integer", nullable: false),
                    WorkTaskTemplateId = table.Column<int>(type: "integer", nullable: false),
                    TaskAutomationTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_WT_ActionTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_WT_ActionTemplate_TaskAutomationTemplate_TaskAutomationTemp~",
                        column: x => x.TaskAutomationTemplateId,
                        principalTable: "TaskAutomationTemplate",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "TaskDropItemTemplate",
                columns: table => new
                {
                    Id = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    ItemName = table.Column<string>(type: "text", nullable: false),
                    ItemValue = table.Column<string>(type: "text", nullable: false),
                    IsDefaultValue = table.Column<bool>(type: "boolean", nullable: false),
                    TaskFieldTemplateId = table.Column<int>(type: "integer", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TaskDropItemTemplate", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TaskDropItemTemplate_TaskFieldTemplate_TaskFieldTemplateId",
                        column: x => x.TaskFieldTemplateId,
                        principalTable: "TaskFieldTemplate",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateIndex(
                name: "IX_AspNetRoleClaims_RoleId",
                table: "AspNetRoleClaims",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "RoleNameIndex",
                table: "AspNetRoles",
                column: "NormalizedName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserClaims_UserId",
                table: "AspNetUserClaims",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserLogins_UserId",
                table: "AspNetUserLogins",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUserRoles_RoleId",
                table: "AspNetUserRoles",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "EmailIndex",
                table: "AspNetUsers",
                column: "NormalizedEmail");

            migrationBuilder.CreateIndex(
                name: "IX_AspNetUsers_LanguageId",
                table: "AspNetUsers",
                column: "LanguageId");

            migrationBuilder.CreateIndex(
                name: "UserNameIndex",
                table: "AspNetUsers",
                column: "NormalizedUserName",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_AssignmentReason_TmkSheetTemplateId",
                table: "AssignmentReason",
                column: "TmkSheetTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_Contact_LeadId",
                table: "Contact",
                column: "LeadId");

            migrationBuilder.CreateIndex(
                name: "IX_CsvTempItem_MapTemplateId",
                table: "CsvTempItem",
                column: "MapTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_BccEmailMessageId",
                table: "EmailAddress",
                column: "BccEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_BccWtEmailMessageId",
                table: "EmailAddress",
                column: "BccWtEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_CcEmailMessageId",
                table: "EmailAddress",
                column: "CcEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_CcWtEmailMessageId",
                table: "EmailAddress",
                column: "CcWtEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_ContactId",
                table: "EmailAddress",
                column: "ContactId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_FromEmailMessageId",
                table: "EmailAddress",
                column: "FromEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_FromWtEmailMessageId",
                table: "EmailAddress",
                column: "FromWtEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_ReplyToEmailMessageId",
                table: "EmailAddress",
                column: "ReplyToEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_ToEmailMessageId",
                table: "EmailAddress",
                column: "ToEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAddress_ToWtEmailMessageId",
                table: "EmailAddress",
                column: "ToWtEmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAttachments_EmailMessageId",
                table: "EmailAttachments",
                column: "EmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAttachments_EmailTemplateId",
                table: "EmailAttachments",
                column: "EmailTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailAttachments_WtEmailId",
                table: "EmailAttachments",
                column: "WtEmailId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailEvents_EmailMessageId",
                table: "EmailEvents",
                column: "EmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailHeaders_EmailMessageId",
                table: "EmailHeaders",
                column: "EmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailMessageFlag_EmailMessageId",
                table: "EmailMessageFlag",
                column: "EmailMessageId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailMessageId_EmailMessageParentId",
                table: "EmailMessageId",
                column: "EmailMessageParentId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailMessages_UserId",
                table: "EmailMessages",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_EmailTemplates_UserId",
                table: "EmailTemplates",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_FidaUserRouteToken_UserId",
                table: "FidaUserRouteToken",
                column: "UserId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_FidaVehicles_EndAddressId",
                table: "FidaVehicles",
                column: "EndAddressId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_FidaVehicles_StartAddressId",
                table: "FidaVehicles",
                column: "StartAddressId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_FidaVehicles_UserId",
                table: "FidaVehicles",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_LangTranslations_BaseLangId",
                table: "LangTranslations",
                column: "BaseLangId");

            migrationBuilder.CreateIndex(
                name: "IX_LangTranslations_LangCodeId",
                table: "LangTranslations",
                column: "LangCodeId");

            migrationBuilder.CreateIndex(
                name: "IX_LangTransPage_langTranslationId",
                table: "LangTransPage",
                column: "langTranslationId");

            migrationBuilder.CreateIndex(
                name: "IX_NavMenuItems_AppDynamicNavMenuAppId",
                table: "NavMenuItems",
                column: "AppDynamicNavMenuAppId");

            migrationBuilder.CreateIndex(
                name: "IX_NavMenuItems_SubMenuListAppId",
                table: "NavMenuItems",
                column: "SubMenuListAppId");

            migrationBuilder.CreateIndex(
                name: "IX_OldPassword_UserId",
                table: "OldPassword",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_PhoneNumber_ContactId",
                table: "PhoneNumber",
                column: "ContactId");

            migrationBuilder.CreateIndex(
                name: "IX_PhoneNumber_UserId",
                table: "PhoneNumber",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_ProtocolTemplate_TemplateId",
                table: "ProtocolTemplate",
                column: "TemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_RouteAddress_FidaVeichleId",
                table: "RouteAddress",
                column: "FidaVeichleId");

            migrationBuilder.CreateIndex(
                name: "IX_RouteAddressMap_TmkTemplateId",
                table: "RouteAddressMap",
                column: "TmkTemplateId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_SubMenus_AppDynamicNavMenuAppId",
                table: "SubMenus",
                column: "AppDynamicNavMenuAppId");

            migrationBuilder.CreateIndex(
                name: "IX_SubMenus_SubMenuListAppId1",
                table: "SubMenus",
                column: "SubMenuListAppId1");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAutomations_WorkTaskId",
                table: "TaskAutomations",
                column: "WorkTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskAutomationTemplate_WorkTaskTemplateId",
                table: "TaskAutomationTemplate",
                column: "WorkTaskTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskDropItemTemplate_TaskFieldTemplateId",
                table: "TaskDropItemTemplate",
                column: "TaskFieldTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskField_WorkTaskId",
                table: "TaskField",
                column: "WorkTaskId");

            migrationBuilder.CreateIndex(
                name: "IX_TaskFieldTemplate_WorkTaskTemplateId",
                table: "TaskFieldTemplate",
                column: "WorkTaskTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkFieldSelectValue_TmkSheetFieldId",
                table: "TmkFieldSelectValue",
                column: "TmkSheetFieldId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkLayoutColumn_LayoutRowId",
                table: "TmkLayoutColumn",
                column: "LayoutRowId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkLayoutRow_TmkLayoutId",
                table: "TmkLayoutRow",
                column: "TmkLayoutId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkLayoutTemplates_TmkTemplateId",
                table: "TmkLayoutTemplates",
                column: "TmkTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkSheetFields_SheetTemplateId",
                table: "TmkSheetFields",
                column: "SheetTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkSheetTemplates_ProtNumTempId",
                table: "TmkSheetTemplates",
                column: "ProtNumTempId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkSheetTemplates_RouteAddressMapId",
                table: "TmkSheetTemplates",
                column: "RouteAddressMapId");

            migrationBuilder.CreateIndex(
                name: "IX_TmkTemplateRole_RoleId",
                table: "TmkTemplateRole",
                column: "RoleId");

            migrationBuilder.CreateIndex(
                name: "IX_Tracer_CsvMapTemplateId",
                table: "Tracer",
                column: "CsvMapTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_Tracer_TmkSheetTemplateId",
                table: "Tracer",
                column: "TmkSheetTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_Tracer_WorkSheetAssignmentId",
                table: "Tracer",
                column: "WorkSheetAssignmentId");

            migrationBuilder.CreateIndex(
                name: "IX_Tracer_WorkSheetId",
                table: "Tracer",
                column: "WorkSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_UserAddress_LeadId",
                table: "UserAddress",
                column: "LeadId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_UserAddress_UserId",
                table: "UserAddress",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserIdentityNumber_UserId",
                table: "UserIdentityNumber",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserMailAddress_UserId",
                table: "UserMailAddress",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_UserProfile_UserId",
                table: "UserProfile",
                column: "UserId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_VerifiedEmails_VerificationResponseId",
                table: "VerifiedEmails",
                column: "VerificationResponseId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkSheetAssignments_AssigneeId",
                table: "WorkSheetAssignments",
                column: "AssigneeId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkSheetAssignments_WorkSheetId",
                table: "WorkSheetAssignments",
                column: "WorkSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkSheetFields_WorkSheetId",
                table: "WorkSheetFields",
                column: "WorkSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkSheetFieldSelectItem_WorkSheetFieldId",
                table: "WorkSheetFieldSelectItem",
                column: "WorkSheetFieldId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkTaskParameter_UserId",
                table: "WorkTaskParameter",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkTasks_TemplateId",
                table: "WorkTasks",
                column: "TemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkTasks_UserId",
                table: "WorkTasks",
                column: "UserId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkTasks_WorkSheetId",
                table: "WorkTasks",
                column: "WorkSheetId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkTaskTemplates_TmkSheetTemplateId",
                table: "WorkTaskTemplates",
                column: "TmkSheetTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_WorkWindow_WorkTaskParameterId",
                table: "WorkWindow",
                column: "WorkTaskParameterId");

            migrationBuilder.CreateIndex(
                name: "IX_WT_Action_EmailMessageId",
                table: "WT_Action",
                column: "EmailMessageId",
                unique: true);

            migrationBuilder.CreateIndex(
                name: "IX_WT_Action_TaskAutomationId",
                table: "WT_Action",
                column: "TaskAutomationId");

            migrationBuilder.CreateIndex(
                name: "IX_WT_ActionTemplate_TaskAutomationTemplateId",
                table: "WT_ActionTemplate",
                column: "TaskAutomationTemplateId");

            migrationBuilder.CreateIndex(
                name: "IX_WtEmails_WorkTaskId",
                table: "WtEmails",
                column: "WorkTaskId",
                unique: true);

            migrationBuilder.AddForeignKey(
                name: "FK_NavMenuItems_SubMenuHeaders_AppId",
                table: "NavMenuItems",
                column: "AppId",
                principalTable: "SubMenuHeaders",
                principalColumn: "AppId",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_NavMenuItems_SubMenuLists_SubMenuListAppId",
                table: "NavMenuItems",
                column: "SubMenuListAppId",
                principalTable: "SubMenuLists",
                principalColumn: "AppId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_SubMenus_SubMenuLists_SubMenuListAppId1",
                table: "SubMenus",
                column: "SubMenuListAppId1",
                principalTable: "SubMenuLists",
                principalColumn: "AppId",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TmkTemplateRole_TmkSheetTemplates_TemplateId",
                table: "TmkTemplateRole",
                column: "TemplateId",
                principalTable: "TmkSheetTemplates",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_FidaVehicles_RouteAddress_EndAddressId",
                table: "FidaVehicles",
                column: "EndAddressId",
                principalTable: "RouteAddress",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_FidaVehicles_RouteAddress_StartAddressId",
                table: "FidaVehicles",
                column: "StartAddressId",
                principalTable: "RouteAddress",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_WorkTasks_WorkTaskTemplates_TemplateId",
                table: "WorkTasks",
                column: "TemplateId",
                principalTable: "WorkTaskTemplates",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_Tracer_TmkSheetTemplates_TmkSheetTemplateId",
                table: "Tracer",
                column: "TmkSheetTemplateId",
                principalTable: "TmkSheetTemplates",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TmkSheetTemplates_ProtocolTemplate_ProtNumTempId",
                table: "TmkSheetTemplates",
                column: "ProtNumTempId",
                principalTable: "ProtocolTemplate",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);

            migrationBuilder.AddForeignKey(
                name: "FK_TmkSheetTemplates_RouteAddressMap_RouteAddressMapId",
                table: "TmkSheetTemplates",
                column: "RouteAddressMapId",
                principalTable: "RouteAddressMap",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_AppDynamicNavMenus_AspNetUsers_AppId",
                table: "AppDynamicNavMenus");

            migrationBuilder.DropForeignKey(
                name: "FK_FidaVehicles_AspNetUsers_UserId",
                table: "FidaVehicles");

            migrationBuilder.DropForeignKey(
                name: "FK_ProtocolTemplate_TmkSheetTemplates_TemplateId",
                table: "ProtocolTemplate");

            migrationBuilder.DropForeignKey(
                name: "FK_RouteAddressMap_TmkSheetTemplates_TmkTemplateId",
                table: "RouteAddressMap");

            migrationBuilder.DropForeignKey(
                name: "FK_FidaVehicles_RouteAddress_EndAddressId",
                table: "FidaVehicles");

            migrationBuilder.DropForeignKey(
                name: "FK_FidaVehicles_RouteAddress_StartAddressId",
                table: "FidaVehicles");

            migrationBuilder.DropForeignKey(
                name: "FK_SubMenus_AppDynamicNavMenus_AppDynamicNavMenuAppId",
                table: "SubMenus");

            migrationBuilder.DropForeignKey(
                name: "FK_SubMenus_SubMenuLists_SubMenuListAppId1",
                table: "SubMenus");

            migrationBuilder.DropTable(
                name: "AspNetRoleClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserClaims");

            migrationBuilder.DropTable(
                name: "AspNetUserLogins");

            migrationBuilder.DropTable(
                name: "AspNetUserRoles");

            migrationBuilder.DropTable(
                name: "AspNetUserTokens");

            migrationBuilder.DropTable(
                name: "AssignmentReason");

            migrationBuilder.DropTable(
                name: "CsvTempItem");

            migrationBuilder.DropTable(
                name: "EmailAddress");

            migrationBuilder.DropTable(
                name: "EmailAttachments");

            migrationBuilder.DropTable(
                name: "EmailEvents");

            migrationBuilder.DropTable(
                name: "EmailHeaders");

            migrationBuilder.DropTable(
                name: "EmailMessageFlag");

            migrationBuilder.DropTable(
                name: "EmailMessageId");

            migrationBuilder.DropTable(
                name: "EmailUid");

            migrationBuilder.DropTable(
                name: "FidaUserRouteToken");

            migrationBuilder.DropTable(
                name: "LangTransPage");

            migrationBuilder.DropTable(
                name: "NavMenuItems");

            migrationBuilder.DropTable(
                name: "OldPassword");

            migrationBuilder.DropTable(
                name: "PhoneNumber");

            migrationBuilder.DropTable(
                name: "TaskDropItemTemplate");

            migrationBuilder.DropTable(
                name: "TaskField");

            migrationBuilder.DropTable(
                name: "TmkFieldSelectValue");

            migrationBuilder.DropTable(
                name: "TmkLayoutColumn");

            migrationBuilder.DropTable(
                name: "TmkTemplateRole");

            migrationBuilder.DropTable(
                name: "Tracer");

            migrationBuilder.DropTable(
                name: "UserAddress");

            migrationBuilder.DropTable(
                name: "UserIdentityNumber");

            migrationBuilder.DropTable(
                name: "UserMailAddress");

            migrationBuilder.DropTable(
                name: "UserProfile");

            migrationBuilder.DropTable(
                name: "VerifiedEmails");

            migrationBuilder.DropTable(
                name: "WorkSheetFieldSelectItem");

            migrationBuilder.DropTable(
                name: "WorkWindow");

            migrationBuilder.DropTable(
                name: "WT_Action");

            migrationBuilder.DropTable(
                name: "WT_ActionTemplate");

            migrationBuilder.DropTable(
                name: "EmailTemplates");

            migrationBuilder.DropTable(
                name: "WtEmails");

            migrationBuilder.DropTable(
                name: "LangTranslations");

            migrationBuilder.DropTable(
                name: "Pages");

            migrationBuilder.DropTable(
                name: "SubMenuHeaders");

            migrationBuilder.DropTable(
                name: "Contact");

            migrationBuilder.DropTable(
                name: "TaskFieldTemplate");

            migrationBuilder.DropTable(
                name: "TmkSheetFields");

            migrationBuilder.DropTable(
                name: "TmkLayoutRow");

            migrationBuilder.DropTable(
                name: "AspNetRoles");

            migrationBuilder.DropTable(
                name: "CsvMapTemplates");

            migrationBuilder.DropTable(
                name: "WorkSheetAssignments");

            migrationBuilder.DropTable(
                name: "EmailVerificationResponse");

            migrationBuilder.DropTable(
                name: "WorkSheetFields");

            migrationBuilder.DropTable(
                name: "WorkTaskParameter");

            migrationBuilder.DropTable(
                name: "EmailMessages");

            migrationBuilder.DropTable(
                name: "TaskAutomations");

            migrationBuilder.DropTable(
                name: "TaskAutomationTemplate");

            migrationBuilder.DropTable(
                name: "BaseLangCodes");

            migrationBuilder.DropTable(
                name: "Leads");

            migrationBuilder.DropTable(
                name: "TmkLayoutTemplates");

            migrationBuilder.DropTable(
                name: "WorkTasks");

            migrationBuilder.DropTable(
                name: "WorkSheets");

            migrationBuilder.DropTable(
                name: "WorkTaskTemplates");

            migrationBuilder.DropTable(
                name: "AspNetUsers");

            migrationBuilder.DropTable(
                name: "LanguageCodes");

            migrationBuilder.DropTable(
                name: "TmkSheetTemplates");

            migrationBuilder.DropTable(
                name: "ProtocolTemplate");

            migrationBuilder.DropTable(
                name: "RouteAddressMap");

            migrationBuilder.DropTable(
                name: "RouteAddress");

            migrationBuilder.DropTable(
                name: "FidaVehicles");

            migrationBuilder.DropTable(
                name: "AppDynamicNavMenus");

            migrationBuilder.DropTable(
                name: "SubMenuLists");

            migrationBuilder.DropTable(
                name: "SubMenus");
        }
    }
}

Thank you for suggestions.

EDIT BY @roji: Cross-posted as https://stackoverflow.com/questions/67450628/error-on-second-migration-with-postgree-db

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sinanbuyukbayrakcommented, Jun 9, 2021

This bug seems to be resolved when I tested it with daily builds. Thanks.

1reaction
rojicommented, Jun 4, 2021

This fix will go into 6.0.0-preview5, we should be a couple weeks away IIRC. In the meantime, can you try out the daily builds and confirm that the bug is gone?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Entity Framework Code Migrations: Exception has been ...
Exception has been thrown by the target of an invocation. I've tried adding the startup project to the command, which didn't work either....
Read more >
[error] Error thrown while running command "doctrine ...
php. Run the command doctrine:migrations:migrate again and paste the lines back. Now it seems to works to create new entities and migrate the...
Read more >
ArgumentOutOfRangeException Class (System)
The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked...
Read more >
List<T> Class (System.Collections.Generic)
It implements the IList<T> generic interface by using an array whose size is dynamically increased as required. You can add items to a...
Read more >
Migration Guide | Cypress Documentation
Migrating to Cypress 12.0​. This guide details the changes and how to change your code to migrate to Cypress version 12.0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found