//
using System;
using System.Net.NetworkInformation;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using PhoneToolMX.Data;
#nullable disable
namespace PhoneToolMX.Models.Migrations
{
[DbContext(typeof(PTMXContext))]
[Migration("20231020213049_PrimaryExtensionAsExtension")]
partial class PrimaryExtensionAsExtension
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.23")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("ExtensionPhone", b =>
{
b.Property("ExtensionsId")
.HasColumnType("integer");
b.Property("PhonesId")
.HasColumnType("integer");
b.HasKey("ExtensionsId", "PhonesId");
b.HasIndex("PhonesId");
b.ToTable("ExtensionPhone");
});
modelBuilder.Entity("ExtensionUser", b =>
{
b.Property("ExtensionsId")
.HasColumnType("integer");
b.Property("OwnersId")
.HasColumnType("text");
b.HasKey("ExtensionsId", "OwnersId");
b.HasIndex("OwnersId");
b.ToTable("ExtensionUser");
});
modelBuilder.Entity("PhoneToolMX.Models.CustomData", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Data")
.HasColumnType("bytea");
b.Property("DataType")
.HasColumnType("integer");
b.Property("FriendlyName")
.HasMaxLength(16)
.HasColumnType("character varying(16)");
b.Property("PhoneId")
.HasColumnType("integer");
b.Property("Size")
.HasColumnType("bigint");
b.HasKey("Id");
b.HasIndex("PhoneId");
b.ToTable("CustomData");
});
modelBuilder.Entity("PhoneToolMX.Models.Extension", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("DirectoryName")
.IsRequired()
.HasColumnType("text");
b.Property("ExtId")
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("integer")
.HasComputedColumnSql("\"Id\" + 1000", true);
b.Property("HoldMusicId")
.HasColumnType("integer");
b.Property("Listed")
.HasColumnType("boolean");
b.Property("Password")
.ValueGeneratedOnAdd()
.HasColumnType("text")
.HasDefaultValueSql("encode(gen_random_bytes(18), 'base64')");
b.HasKey("Id");
b.HasIndex("HoldMusicId");
b.ToTable("Extensions");
});
modelBuilder.Entity("PhoneToolMX.Models.Phone", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("BackgroundId")
.HasColumnType("integer");
b.Property("FriendlyName")
.IsRequired()
.HasColumnType("text");
b.Property("MacAddress")
.IsRequired()
.HasColumnType("macaddr");
b.Property("ModelId")
.HasColumnType("integer");
b.Property("PrimaryExtensionId")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("BackgroundId");
b.HasIndex("ModelId");
b.HasIndex("PrimaryExtensionId");
b.ToTable("Phones");
});
modelBuilder.Entity("PhoneToolMX.Models.PhoneModel", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("MaxExtensions")
.HasColumnType("bigint");
b.Property("ModelName")
.HasColumnType("text");
b.Property("PreVvxPolycom")
.HasColumnType("boolean");
b.HasKey("Id");
b.ToTable("PhoneModels");
b.HasData(
new
{
Id = 0,
MaxExtensions = 6L,
ModelName = "Polycom VVX300/310",
PreVvxPolycom = false
});
});
modelBuilder.Entity("PhoneToolMX.Models.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("text");
b.Property("ConcurrencyStamp")
.HasColumnType("text");
b.Property("Name")
.HasColumnType("text");
b.Property("NormalizedName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Role");
});
modelBuilder.Entity("PhoneToolMX.Models.User", b =>
{
b.Property("Id")
.HasColumnType("text");
b.Property("AccessFailedCount")
.HasColumnType("integer");
b.Property("ConcurrencyStamp")
.HasColumnType("text");
b.Property("Email")
.HasColumnType("text");
b.Property("EmailConfirmed")
.HasColumnType("boolean");
b.Property("LockoutEnabled")
.HasColumnType("boolean");
b.Property("LockoutEnd")
.HasColumnType("timestamp with time zone");
b.Property("NormalizedEmail")
.HasColumnType("text");
b.Property("NormalizedUserName")
.HasColumnType("text");
b.Property("PasswordHash")
.HasColumnType("text");
b.Property("PhoneNumber")
.HasColumnType("text");
b.Property("PhoneNumberConfirmed")
.HasColumnType("boolean");
b.Property("SecurityStamp")
.HasColumnType("text");
b.Property("TwoFactorEnabled")
.HasColumnType("boolean");
b.Property("UserName")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("PhoneUser", b =>
{
b.Property("OwnersId")
.HasColumnType("text");
b.Property("PhonesId")
.HasColumnType("integer");
b.HasKey("OwnersId", "PhonesId");
b.HasIndex("PhonesId");
b.ToTable("PhoneUser");
});
modelBuilder.Entity("ExtensionPhone", b =>
{
b.HasOne("PhoneToolMX.Models.Extension", null)
.WithMany()
.HasForeignKey("ExtensionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PhoneToolMX.Models.Phone", null)
.WithMany()
.HasForeignKey("PhonesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("ExtensionUser", b =>
{
b.HasOne("PhoneToolMX.Models.Extension", null)
.WithMany()
.HasForeignKey("ExtensionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PhoneToolMX.Models.User", null)
.WithMany()
.HasForeignKey("OwnersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PhoneToolMX.Models.CustomData", b =>
{
b.HasOne("PhoneToolMX.Models.Phone", null)
.WithMany("Ringtones")
.HasForeignKey("PhoneId");
});
modelBuilder.Entity("PhoneToolMX.Models.Extension", b =>
{
b.HasOne("PhoneToolMX.Models.CustomData", "HoldMusic")
.WithMany()
.HasForeignKey("HoldMusicId");
b.Navigation("HoldMusic");
});
modelBuilder.Entity("PhoneToolMX.Models.Phone", b =>
{
b.HasOne("PhoneToolMX.Models.CustomData", "Background")
.WithMany()
.HasForeignKey("BackgroundId");
b.HasOne("PhoneToolMX.Models.PhoneModel", "Model")
.WithMany()
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PhoneToolMX.Models.Extension", "PrimaryExtension")
.WithMany()
.HasForeignKey("PrimaryExtensionId");
b.Navigation("Background");
b.Navigation("Model");
b.Navigation("PrimaryExtension");
});
modelBuilder.Entity("PhoneUser", b =>
{
b.HasOne("PhoneToolMX.Models.User", null)
.WithMany()
.HasForeignKey("OwnersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("PhoneToolMX.Models.Phone", null)
.WithMany()
.HasForeignKey("PhonesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("PhoneToolMX.Models.Phone", b =>
{
b.Navigation("Ringtones");
});
#pragma warning restore 612, 618
}
}
}