//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using TileServer.Infrastructure.Data;
#nullable disable
namespace TileServer.Infrastructure.Data.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("TileServer.Domain.Accounts.ApiToken", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Hash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Prefix")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("character varying(16)");
b.Property("RevokedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("Hash")
.IsUnique();
b.HasIndex("UserId");
b.ToTable("ApiTokens", (string)null);
});
modelBuilder.Entity("TileServer.Domain.Accounts.UsageDaily", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("Bytes")
.HasColumnType("bigint");
b.Property("Date")
.HasColumnType("date");
b.Property("StyleRequests")
.HasColumnType("bigint");
b.Property("TileRequests")
.HasColumnType("bigint");
b.Property("TokenId")
.HasColumnType("uuid");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId", "Date");
b.HasIndex("UserId", "TokenId", "Date")
.IsUnique();
b.ToTable("UsageDaily", (string)null);
});
modelBuilder.Entity("TileServer.Domain.Accounts.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("DisplayName")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("LastLoginAt")
.HasColumnType("timestamp with time zone");
b.Property("Login")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Slug")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("YandexId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.HasKey("Id");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("YandexId")
.IsUnique();
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("TileServer.Domain.Accounts.UserStyle", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedFrom")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Json")
.IsRequired()
.HasColumnType("text");
b.Property("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("UserId")
.HasColumnType("uuid");
b.HasKey("Id");
b.HasIndex("UserId", "Name")
.IsUnique();
b.ToTable("UserStyles", (string)null);
});
modelBuilder.Entity("TileServer.Domain.Accounts.ApiToken", b =>
{
b.HasOne("TileServer.Domain.Accounts.User", "User")
.WithMany("Tokens")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("TileServer.Domain.Accounts.UserStyle", b =>
{
b.HasOne("TileServer.Domain.Accounts.User", "User")
.WithMany("Styles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("TileServer.Domain.Accounts.User", b =>
{
b.Navigation("Styles");
b.Navigation("Tokens");
});
#pragma warning restore 612, 618
}
}
}