//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using MoonlightServers.ApiServer.Database;
#nullable disable
namespace MoonlightServers.ApiServer.Database.Migrations
{
[DbContext(typeof(ServersDataContext))]
[Migration("20241205154432_AddedBaseModels")]
partial class AddedBaseModels
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("Servers")
.HasAnnotation("ProductVersion", "8.0.11")
.HasAnnotation("Relational:MaxIdentifierLength", 64);
MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Allocation", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("IpAddress")
.IsRequired()
.HasColumnType("longtext");
b.Property("NodeId")
.HasColumnType("int");
b.Property("Port")
.HasColumnType("int");
b.Property("ServerId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("ServerId");
b.ToTable("Allocations", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Node", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("EnableDynamicFirewall")
.HasColumnType("tinyint(1)");
b.Property("EnableTransparentMode")
.HasColumnType("tinyint(1)");
b.Property("Fqdn")
.IsRequired()
.HasColumnType("longtext");
b.Property("FtpPort")
.HasColumnType("int");
b.Property("HttpPort")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("Token")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("Nodes", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Server", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Bandwidth")
.HasColumnType("int");
b.Property("Cpu")
.HasColumnType("int");
b.Property("Disk")
.HasColumnType("int");
b.Property("DockerImageIndex")
.HasColumnType("int");
b.Property("Memory")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("NodeId")
.HasColumnType("int");
b.Property("OwnerId")
.HasColumnType("int");
b.Property("StarId")
.HasColumnType("int");
b.Property("StartupOverride")
.HasColumnType("longtext");
b.Property("UseVirtualDisk")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.HasIndex("NodeId");
b.HasIndex("StarId");
b.ToTable("Servers", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.ServerBackup", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Completed")
.HasColumnType("tinyint(1)");
b.Property("CompletedAt")
.HasColumnType("datetime(6)");
b.Property("CreatedAt")
.HasColumnType("datetime(6)");
b.Property("Size")
.HasColumnType("bigint");
b.Property("Successful")
.HasColumnType("tinyint(1)");
b.HasKey("Id");
b.ToTable("ServerBackups", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.ServerVariable", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("Key")
.IsRequired()
.HasColumnType("longtext");
b.Property("ServerId")
.HasColumnType("int");
b.Property("Value")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("ServerId");
b.ToTable("ServerVariables", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Star", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("AllowDockerImageChange")
.HasColumnType("tinyint(1)");
b.Property("Author")
.IsRequired()
.HasColumnType("longtext");
b.Property("DonateUrl")
.HasColumnType("longtext");
b.Property("InstallDockerImage")
.IsRequired()
.HasColumnType("longtext");
b.Property("InstallScript")
.IsRequired()
.HasColumnType("longtext");
b.Property("InstallShell")
.IsRequired()
.HasColumnType("longtext");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("OnlineDetection")
.IsRequired()
.HasColumnType("longtext");
b.Property("ParseConfiguration")
.IsRequired()
.HasColumnType("longtext");
b.Property("RequiredAllocations")
.HasColumnType("int");
b.Property("StartupCommand")
.IsRequired()
.HasColumnType("longtext");
b.Property("StopCommand")
.IsRequired()
.HasColumnType("longtext");
b.Property("UpdateUrl")
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("Stars", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.StarDockerImage", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("AutoPulling")
.HasColumnType("tinyint(1)");
b.Property("DisplayName")
.IsRequired()
.HasColumnType("longtext");
b.Property("Identifier")
.IsRequired()
.HasColumnType("longtext");
b.Property("StarId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StarId");
b.ToTable("StarDockerImages", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.StarVariable", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
MySqlPropertyBuilderExtensions.UseMySqlIdentityColumn(b.Property("Id"));
b.Property("AllowEditing")
.HasColumnType("tinyint(1)");
b.Property("AllowViewing")
.HasColumnType("tinyint(1)");
b.Property("DefaultValue")
.IsRequired()
.HasColumnType("longtext");
b.Property("Description")
.IsRequired()
.HasColumnType("longtext");
b.Property("Filter")
.HasColumnType("longtext");
b.Property("Key")
.IsRequired()
.HasColumnType("longtext");
b.Property("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property("StarId")
.HasColumnType("int");
b.Property("Type")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("StarId");
b.ToTable("StarVariables", "Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Allocation", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Node", "Node")
.WithMany("Allocations")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Server", "Server")
.WithMany("Allocations")
.HasForeignKey("ServerId");
b.Navigation("Node");
b.Navigation("Server");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Server", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Node", "Node")
.WithMany("Servers")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Star", "Star")
.WithMany()
.HasForeignKey("StarId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Node");
b.Navigation("Star");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.ServerVariable", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Server", "Server")
.WithMany()
.HasForeignKey("ServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Server");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.StarDockerImage", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Star", "Star")
.WithMany("DockerImages")
.HasForeignKey("StarId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Star");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.StarVariable", b =>
{
b.HasOne("MoonlightServers.ApiServer.Database.Entities.Star", "Star")
.WithMany("Variables")
.HasForeignKey("StarId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Star");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Node", b =>
{
b.Navigation("Allocations");
b.Navigation("Servers");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Server", b =>
{
b.Navigation("Allocations");
});
modelBuilder.Entity("MoonlightServers.ApiServer.Database.Entities.Star", b =>
{
b.Navigation("DockerImages");
b.Navigation("Variables");
});
#pragma warning restore 612, 618
}
}
}