//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Sledgemapper.Api.Infrastructure.Data;
namespace Sledgemapper.Api.Migrations
{
[DbContext(typeof(SledgemapperDbContext))]
[Migration("20210219223114_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.3");
modelBuilder.Entity("CampaignUser", b =>
{
b.Property("CampaignsCampaignId")
.HasColumnType("INTEGER");
b.Property("InvitedUsersId")
.HasColumnType("INTEGER");
b.HasKey("CampaignsCampaignId", "InvitedUsersId");
b.HasIndex("InvitedUsersId");
b.ToTable("CampaignUser");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Property("CampaignId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CampaignName")
.HasColumnType("TEXT");
b.Property("OwnerId")
.HasColumnType("INTEGER");
b.HasKey("CampaignId");
b.HasIndex("OwnerId");
b.HasIndex("CampaignName", "OwnerId")
.IsUnique();
b.ToTable("Campaigns");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.Property("MapId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CampaignId")
.HasColumnType("INTEGER");
b.Property("MapName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("MapId");
b.HasIndex("CampaignId");
b.ToTable("Maps");
});
modelBuilder.Entity("Sledgemapper.Api.Models.MapLog", b =>
{
b.Property("MapLogId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Object")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property("Operation")
.IsRequired()
.HasMaxLength(1)
.HasColumnType("TEXT");
b.Property("SessionId")
.HasColumnType("INTEGER");
b.Property("Timestamp")
.HasColumnType("REAL");
b.Property("Type")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property("UserId")
.HasColumnType("INTEGER");
b.HasKey("MapLogId");
b.ToTable("MapLogs");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Session", b =>
{
b.Property("SessionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("OwnerUserId")
.HasColumnType("INTEGER");
b.Property("SessionName")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("SessionId");
b.ToTable("Sessions");
});
modelBuilder.Entity("Sledgemapper.Api.Models.SessionUser", b =>
{
b.Property("SessionUserId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("SessionId")
.HasColumnType("INTEGER");
b.Property("UserId")
.HasColumnType("INTEGER");
b.HasKey("SessionUserId");
b.ToTable("SessionUsers");
});
modelBuilder.Entity("Sledgemapper.Api.Models.Snapshot", b =>
{
b.Property("SnapshotId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Object")
.IsRequired()
.HasColumnType("TEXT");
b.Property("SessionId")
.HasColumnType("INTEGER");
b.Property("Timestamp")
.HasColumnType("REAL");
b.HasKey("SnapshotId");
b.ToTable("Snapshots");
});
modelBuilder.Entity("Sledgemapper.Api.Models.UserConnection", b =>
{
b.Property("UserConnectionId")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ConnectionId")
.IsRequired()
.HasColumnType("TEXT");
b.Property("UserId")
.HasColumnType("INTEGER");
b.HasKey("UserConnectionId");
b.ToTable("UserConnections");
});
modelBuilder.Entity("Sledgemapper.Entities.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("FirstName")
.HasColumnType("TEXT");
b.Property("Initials")
.HasColumnType("TEXT");
b.Property("LastName")
.HasColumnType("TEXT");
b.Property("PasswordHash")
.HasColumnType("BLOB");
b.Property("PasswordSalt")
.HasColumnType("BLOB");
b.Property("Username")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Users");
});
modelBuilder.Entity("CampaignUser", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany()
.HasForeignKey("CampaignsCampaignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Sledgemapper.Entities.User", null)
.WithMany()
.HasForeignKey("InvitedUsersId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.HasOne("Sledgemapper.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Owner");
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Map", b =>
{
b.HasOne("Sledgemapper.Api.Core.Entities.Campaign", null)
.WithMany("Maps")
.HasForeignKey("CampaignId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sledgemapper.Api.Core.Entities.Campaign", b =>
{
b.Navigation("Maps");
});
#pragma warning restore 612, 618
}
}
}