//
using System;
using Infrastructure.Context;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Infrastructure.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260206104345_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.2")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Domain.Entities.Role", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("Id");
b.ToTable("Roles", "auth");
b.HasData(
new
{
Id = 1,
Name = "SuperAdmin"
},
new
{
Id = 2,
Name = "Admin"
},
new
{
Id = 3,
Name = "User"
});
});
modelBuilder.Entity("Domain.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
b.Property("Email")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasAnnotation("RegularExpression", "^\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$");
b.Property("LastLogin")
.HasColumnType("timestamp with time zone");
b.Property("Password")
.IsRequired()
.HasMaxLength(250)
.HasColumnType("varchar(250)");
b.Property("RefreshToken")
.HasColumnType("text");
b.Property("RefreshTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property("ResetPasswordToken")
.HasColumnType("text");
b.Property("ResetPasswordTokenExpiryTime")
.HasColumnType("timestamp with time zone");
b.Property("Username")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("varchar(50)");
b.HasKey("Id");
b.ToTable("Users", "auth");
b.HasData(
new
{
Id = 1,
Email = "admin@rss.wenske-services-development.de",
LastLogin = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Password = "AQAAAAIAAYagAAAAELBxAsYVTssn5taCQ7CMo+Mzn0i87Jt8ZXJTe7cgG5hfN3wDJzIkQaotyFhM/mQGaQ==",
ResetPasswordTokenExpiryTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Username = "Superadmin"
},
new
{
Id = 2,
Email = "info@rss.wenske-services-development.de",
LastLogin = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Password = "AQAAAAIAAYagAAAAEP0NWiTTz20doMf/KL0WkBR+5roc5KTouMrfiHk2MMXOQn+E+C5Q4dqWD7PnNoxUmQ==",
ResetPasswordTokenExpiryTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
Username = "Admin"
});
});
modelBuilder.Entity("Domain.Entities.UserRole", b =>
{
b.Property("UserId")
.HasColumnType("integer");
b.Property("RoleId")
.HasColumnType("integer");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("UserRoles", "auth");
b.HasData(
new
{
UserId = 1,
RoleId = 1
},
new
{
UserId = 2,
RoleId = 2
});
});
modelBuilder.Entity("Domain.Entities.UserRole", b =>
{
b.HasOne("Domain.Entities.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Domain.Entities.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("Domain.Entities.Role", b =>
{
b.Navigation("UserRoles");
});
modelBuilder.Entity("Domain.Entities.User", b =>
{
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}