初始化
This commit is contained in:
495
FutureMailAPI/Migrations/20251018051334_AddSentMailCreatedAt.Designer.cs
generated
Normal file
495
FutureMailAPI/Migrations/20251018051334_AddSentMailCreatedAt.Designer.cs
generated
Normal file
@@ -0,0 +1,495 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FutureMailAPI.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FutureMailAPI.Migrations
|
||||
{
|
||||
[DbContext(typeof(FutureMailDbContext))]
|
||||
[Migration("20251018051334_AddSentMailCreatedAt")]
|
||||
partial class AddSentMailCreatedAt
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.9");
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClientSecret")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RedirectUris")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Scopes")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("OAuthClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ExpiresAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("RevokedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Scope")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccessToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("RefreshToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("OAuthTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsRead")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsReplied")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("ReadAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ReceivedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<int>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("RecipientId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ReplyMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SentMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("RecipientId1");
|
||||
|
||||
b.HasIndex("SentMailId");
|
||||
|
||||
b.ToTable("ReceivedMails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Attachments")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DeliveryTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("EncryptionKey")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsEncrypted")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("RecipientId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("RecipientType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SenderId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("SentAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Theme")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TriggerDetails")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("TriggerType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("RecipientId1");
|
||||
|
||||
b.HasIndex("SenderId");
|
||||
|
||||
b.ToTable("SentMails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<double>("GlowIntensity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Opacity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionX")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionY")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionZ")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Rotation")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("SentMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SentMailId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("Size")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Style")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SentMailId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SentMailId1");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TimeCapsules");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Avatar")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("LastLoginAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nickname")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PreferredBackground")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PreferredScene")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("RefreshTokenExpiryTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Salt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
|
||||
.WithMany("Tokens")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany("ReceivedMails")
|
||||
.HasForeignKey("RecipientId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
|
||||
.WithMany()
|
||||
.HasForeignKey("SentMailId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipient");
|
||||
|
||||
b.Navigation("SentMail");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId1");
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Sender")
|
||||
.WithMany("SentMails")
|
||||
.HasForeignKey("SenderId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipient");
|
||||
|
||||
b.Navigation("Sender");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", null)
|
||||
.WithOne("TimeCapsule")
|
||||
.HasForeignKey("FutureMailAPI.Models.TimeCapsule", "SentMailId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
|
||||
.WithMany()
|
||||
.HasForeignKey("SentMailId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "User")
|
||||
.WithMany("TimeCapsules")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SentMail");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
|
||||
{
|
||||
b.Navigation("Tokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.Navigation("TimeCapsule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
|
||||
{
|
||||
b.Navigation("ReceivedMails");
|
||||
|
||||
b.Navigation("SentMails");
|
||||
|
||||
b.Navigation("TimeCapsules");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FutureMailAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSentMailCreatedAt : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TimeCapsules_SentMailId",
|
||||
table: "TimeCapsules");
|
||||
|
||||
migrationBuilder.AddColumn<double>(
|
||||
name: "GlowIntensity",
|
||||
table: "TimeCapsules",
|
||||
type: "REAL",
|
||||
nullable: false,
|
||||
defaultValue: 0.0);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "Style",
|
||||
table: "TimeCapsules",
|
||||
type: "TEXT",
|
||||
maxLength: 50,
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CreatedAt",
|
||||
table: "SentMails",
|
||||
type: "TEXT",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeCapsules_SentMailId",
|
||||
table: "TimeCapsules",
|
||||
column: "SentMailId",
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_TimeCapsules_SentMailId",
|
||||
table: "TimeCapsules");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "GlowIntensity",
|
||||
table: "TimeCapsules");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Style",
|
||||
table: "TimeCapsules");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedAt",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_TimeCapsules_SentMailId",
|
||||
table: "TimeCapsules",
|
||||
column: "SentMailId");
|
||||
}
|
||||
}
|
||||
}
|
||||
475
FutureMailAPI/Migrations/20251018071917_FixDuplicateForeignKeys.Designer.cs
generated
Normal file
475
FutureMailAPI/Migrations/20251018071917_FixDuplicateForeignKeys.Designer.cs
generated
Normal file
@@ -0,0 +1,475 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using FutureMailAPI.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FutureMailAPI.Migrations
|
||||
{
|
||||
[DbContext(typeof(FutureMailDbContext))]
|
||||
[Migration("20251018071917_FixDuplicateForeignKeys")]
|
||||
partial class FixDuplicateForeignKeys
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "9.0.9");
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("ClientId")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("ClientSecret")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RedirectUris")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Scopes")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("UpdatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("OAuthClients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("AccessToken")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<DateTime>("ExpiresAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("RevokedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Scope")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TokenType")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("UpdatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccessToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("RefreshToken")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("OAuthTokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsRead")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<bool>("IsReplied")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("ReadAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("ReceivedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<int>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ReplyMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SentMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("SentMailId");
|
||||
|
||||
b.ToTable("ReceivedMails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Attachments")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DeliveryTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("EncryptionKey")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsEncrypted")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("RecipientType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SenderId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime>("SentAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Theme")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Title")
|
||||
.IsRequired()
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("TriggerDetails")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("TriggerType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("SenderId");
|
||||
|
||||
b.ToTable("SentMails");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Color")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<double>("GlowIntensity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Opacity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionX")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionY")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("PositionZ")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Rotation")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("SentMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("SentMailId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<double>("Size")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Style")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("UserId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SentMailId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SentMailId1");
|
||||
|
||||
b.HasIndex("UserId");
|
||||
|
||||
b.ToTable("TimeCapsules");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Avatar")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("LastLoginAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Nickname")
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PreferredBackground")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("PreferredScene")
|
||||
.HasMaxLength(20)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("RefreshToken")
|
||||
.HasMaxLength(500)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("RefreshTokenExpiryTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Salt")
|
||||
.IsRequired()
|
||||
.HasMaxLength(255)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Username")
|
||||
.IsRequired()
|
||||
.HasMaxLength(100)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Email")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Username")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthToken", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.OAuthClient", "Client")
|
||||
.WithMany("Tokens")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "User")
|
||||
.WithMany()
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany("ReceivedMails")
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
|
||||
.WithMany()
|
||||
.HasForeignKey("SentMailId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipient");
|
||||
|
||||
b.Navigation("SentMail");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Sender")
|
||||
.WithMany("SentMails")
|
||||
.HasForeignKey("SenderId")
|
||||
.OnDelete(DeleteBehavior.Restrict)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Recipient");
|
||||
|
||||
b.Navigation("Sender");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", null)
|
||||
.WithOne("TimeCapsule")
|
||||
.HasForeignKey("FutureMailAPI.Models.TimeCapsule", "SentMailId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", "SentMail")
|
||||
.WithMany()
|
||||
.HasForeignKey("SentMailId1")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "User")
|
||||
.WithMany("TimeCapsules")
|
||||
.HasForeignKey("UserId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("SentMail");
|
||||
|
||||
b.Navigation("User");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.OAuthClient", b =>
|
||||
{
|
||||
b.Navigation("Tokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.Navigation("TimeCapsule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
|
||||
{
|
||||
b.Navigation("ReceivedMails");
|
||||
|
||||
b.Navigation("SentMails");
|
||||
|
||||
b.Navigation("TimeCapsules");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FutureMailAPI.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class FixDuplicateForeignKeys : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_ReceivedMails_Users_RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_SentMails_Users_RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_SentMails_RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_ReceivedMails_RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RecipientId1",
|
||||
table: "SentMails");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "RecipientId1",
|
||||
table: "ReceivedMails");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RecipientId1",
|
||||
table: "SentMails",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SentMails_RecipientId1",
|
||||
table: "SentMails",
|
||||
column: "RecipientId1");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_ReceivedMails_RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
column: "RecipientId1");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_ReceivedMails_Users_RecipientId1",
|
||||
table: "ReceivedMails",
|
||||
column: "RecipientId1",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_SentMails_Users_RecipientId1",
|
||||
table: "SentMails",
|
||||
column: "RecipientId1",
|
||||
principalTable: "Users",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,9 +148,6 @@ namespace FutureMailAPI.Migrations
|
||||
b.Property<int>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("RecipientId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ReplyMailId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@@ -161,8 +158,6 @@ namespace FutureMailAPI.Migrations
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("RecipientId1");
|
||||
|
||||
b.HasIndex("SentMailId");
|
||||
|
||||
b.ToTable("ReceivedMails");
|
||||
@@ -181,6 +176,9 @@ namespace FutureMailAPI.Migrations
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime>("DeliveryTime")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
@@ -193,9 +191,6 @@ namespace FutureMailAPI.Migrations
|
||||
b.Property<int?>("RecipientId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("RecipientId1")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("RecipientType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@@ -229,8 +224,6 @@ namespace FutureMailAPI.Migrations
|
||||
|
||||
b.HasIndex("RecipientId");
|
||||
|
||||
b.HasIndex("RecipientId1");
|
||||
|
||||
b.HasIndex("SenderId");
|
||||
|
||||
b.ToTable("SentMails");
|
||||
@@ -251,6 +244,9 @@ namespace FutureMailAPI.Migrations
|
||||
.HasColumnType("TEXT")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<double>("GlowIntensity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
b.Property<double>("Opacity")
|
||||
.HasColumnType("REAL");
|
||||
|
||||
@@ -278,6 +274,10 @@ namespace FutureMailAPI.Migrations
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Style")
|
||||
.HasMaxLength(50)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int>("Type")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
@@ -286,7 +286,8 @@ namespace FutureMailAPI.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("SentMailId");
|
||||
b.HasIndex("SentMailId")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("SentMailId1");
|
||||
|
||||
@@ -387,15 +388,9 @@ namespace FutureMailAPI.Migrations
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.ReceivedMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany("ReceivedMails")
|
||||
.HasForeignKey("RecipientId1")
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
@@ -412,15 +407,11 @@ namespace FutureMailAPI.Migrations
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.User", null)
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Recipient")
|
||||
.WithMany()
|
||||
.HasForeignKey("RecipientId1");
|
||||
|
||||
b.HasOne("FutureMailAPI.Models.User", "Sender")
|
||||
.WithMany("SentMails")
|
||||
.HasForeignKey("SenderId")
|
||||
@@ -435,8 +426,8 @@ namespace FutureMailAPI.Migrations
|
||||
modelBuilder.Entity("FutureMailAPI.Models.TimeCapsule", b =>
|
||||
{
|
||||
b.HasOne("FutureMailAPI.Models.SentMail", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("SentMailId")
|
||||
.WithOne("TimeCapsule")
|
||||
.HasForeignKey("FutureMailAPI.Models.TimeCapsule", "SentMailId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
@@ -462,6 +453,11 @@ namespace FutureMailAPI.Migrations
|
||||
b.Navigation("Tokens");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.SentMail", b =>
|
||||
{
|
||||
b.Navigation("TimeCapsule");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FutureMailAPI.Models.User", b =>
|
||||
{
|
||||
b.Navigation("ReceivedMails");
|
||||
|
||||
Reference in New Issue
Block a user