// using System; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using VoidCat.Services; #nullable disable namespace VoidCat.Migrations { [DbContext(typeof(VoidContext))] [Migration("20230503115108_Init")] partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder .HasAnnotation("ProductVersion", "7.0.5") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("VoidCat.Database.ApiKey", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Created") .HasColumnType("timestamp with time zone"); b.Property("Expiry") .HasColumnType("timestamp with time zone"); b.Property("Token") .IsRequired() .HasColumnType("text"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("ApiKey", (string)null); }); modelBuilder.Entity("VoidCat.Database.EmailVerification", b => { b.Property("Code") .HasColumnType("uuid"); b.Property("Expires") .HasColumnType("timestamp with time zone"); b.Property("UserId") .HasColumnType("uuid"); b.HasIndex("UserId"); b.ToTable("EmailVerification", (string)null); }); modelBuilder.Entity("VoidCat.Database.File", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("Description") .HasColumnType("text"); b.Property("Digest") .HasColumnType("text"); b.Property("EditSecret") .HasColumnType("uuid"); b.Property("EncryptionParams") .HasColumnType("text"); b.Property("Expires") .HasColumnType("timestamp with time zone"); b.Property("MagnetLink") .HasColumnType("text"); b.Property("MimeType") .IsRequired() .ValueGeneratedOnAdd() .HasColumnType("text") .HasDefaultValue("application/octet-stream"); b.Property("Name") .HasColumnType("text"); b.Property("Size") .HasColumnType("numeric(20,0)"); b.Property("Storage") .IsRequired() .ValueGeneratedOnAdd() .HasColumnType("text") .HasDefaultValue("local-disk"); b.Property("Uploaded") .HasColumnType("timestamp with time zone"); b.HasKey("Id"); b.HasIndex("Uploaded"); b.ToTable("Files", (string)null); }); modelBuilder.Entity("VoidCat.Database.User", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AuthType") .HasColumnType("integer"); b.Property("Avatar") .HasColumnType("text"); b.Property("Created") .HasColumnType("timestamp with time zone"); b.Property("DisplayName") .IsRequired() .ValueGeneratedOnAdd() .HasColumnType("text") .HasDefaultValue("void user"); b.Property("Email") .IsRequired() .HasColumnType("text"); b.Property("Flags") .HasColumnType("integer"); b.Property("LastLogin") .HasColumnType("timestamp with time zone"); b.Property("Password") .HasColumnType("text"); b.Property("Storage") .IsRequired() .ValueGeneratedOnAdd() .HasColumnType("text") .HasDefaultValue("local-disk"); b.HasKey("Id"); b.HasIndex("Email"); b.ToTable("Users", (string)null); }); modelBuilder.Entity("VoidCat.Database.UserAuthToken", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("AccessToken") .IsRequired() .HasColumnType("text"); b.Property("Expires") .HasColumnType("timestamp with time zone"); b.Property("IdToken") .HasColumnType("text"); b.Property("Provider") .IsRequired() .HasColumnType("text"); b.Property("RefreshToken") .IsRequired() .HasColumnType("text"); b.Property("Scope") .IsRequired() .HasColumnType("text"); b.Property("TokenType") .IsRequired() .HasColumnType("text"); b.Property("UserId") .HasColumnType("uuid"); b.HasKey("Id"); b.HasIndex("UserId"); b.ToTable("UsersAuthToken", (string)null); }); modelBuilder.Entity("VoidCat.Database.UserFile", b => { b.Property("UserId") .HasColumnType("uuid"); b.Property("FileId") .HasColumnType("uuid"); b.HasKey("UserId", "FileId"); b.HasIndex("FileId") .IsUnique(); b.ToTable("UserFiles", (string)null); }); modelBuilder.Entity("VoidCat.Database.UserRole", b => { b.Property("UserId") .HasColumnType("uuid"); b.Property("Role") .HasColumnType("text"); b.HasKey("UserId", "Role"); b.ToTable("UserRoles", (string)null); }); modelBuilder.Entity("VoidCat.Database.VirusScanResult", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uuid"); b.Property("FileId") .HasColumnType("uuid"); b.Property("Names") .IsRequired() .HasColumnType("text"); b.Property("ScanTime") .HasColumnType("timestamp with time zone"); b.Property("Scanner") .IsRequired() .HasColumnType("text"); b.Property("Score") .HasColumnType("numeric"); b.HasKey("Id"); b.HasIndex("FileId"); b.ToTable("VirusScanResult", (string)null); }); modelBuilder.Entity("VoidCat.Database.ApiKey", b => { b.HasOne("VoidCat.Database.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("VoidCat.Database.EmailVerification", b => { b.HasOne("VoidCat.Database.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("VoidCat.Database.UserAuthToken", b => { b.HasOne("VoidCat.Database.User", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("VoidCat.Database.UserFile", b => { b.HasOne("VoidCat.Database.File", "File") .WithOne() .HasForeignKey("VoidCat.Database.UserFile", "FileId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.HasOne("VoidCat.Database.User", "User") .WithMany("UserFiles") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("File"); b.Navigation("User"); }); modelBuilder.Entity("VoidCat.Database.UserRole", b => { b.HasOne("VoidCat.Database.User", "User") .WithMany("Roles") .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("User"); }); modelBuilder.Entity("VoidCat.Database.VirusScanResult", b => { b.HasOne("VoidCat.Database.File", "File") .WithMany() .HasForeignKey("FileId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); b.Navigation("File"); }); modelBuilder.Entity("VoidCat.Database.User", b => { b.Navigation("Roles"); b.Navigation("UserFiles"); }); #pragma warning restore 612, 618 } } }