diff --git a/.gitignore b/.gitignore
index 0d2f36d6..2ed2d615 100644
--- a/.gitignore
+++ b/.gitignore
@@ -430,4 +430,5 @@ FodyWeavers.xsd
*.msp
# JetBrains Rider
-*.sln.iml
\ No newline at end of file
+*.sln.iml
+.idea/.idea.Moonlight/.idea/discord.xml
diff --git a/.idea/.idea.Moonlight/.idea/discord.xml b/.idea/.idea.Moonlight/.idea/discord.xml
index 30bab2ab..d8e95616 100644
--- a/.idea/.idea.Moonlight/.idea/discord.xml
+++ b/.idea/.idea.Moonlight/.idea/discord.xml
@@ -1,7 +1,7 @@
-
+
\ No newline at end of file
diff --git a/.idea/.idea.Moonlight/.idea/efCoreCommonOptions.xml b/.idea/.idea.Moonlight/.idea/efCoreCommonOptions.xml
new file mode 100644
index 00000000..c23c5d69
--- /dev/null
+++ b/.idea/.idea.Moonlight/.idea/efCoreCommonOptions.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Moonlight/App/Database/DataContext.cs b/Moonlight/App/Database/DataContext.cs
new file mode 100644
index 00000000..a86c721b
--- /dev/null
+++ b/Moonlight/App/Database/DataContext.cs
@@ -0,0 +1,52 @@
+using Microsoft.EntityFrameworkCore;
+using Moonlight.App.Database.Entities;
+using Moonlight.App.Services;
+
+namespace Moonlight.App.Database;
+
+public class DataContext : DbContext
+{
+ private readonly ConfigService ConfigService;
+
+ public DataContext(ConfigService configService)
+ {
+ ConfigService = configService;
+ }
+
+ public DbSet DockerImages { get; set; }
+ public DbSet Images { get; set; }
+ public DbSet ImageTags { get; set; }
+ public DbSet ImageVariables { get; set; }
+ public DbSet Nodes { get; set; }
+ public DbSet NodeAllocations { get; set; }
+ public DbSet Servers { get; set; }
+ public DbSet ServerBackups { get; set; }
+ public DbSet ServerVariables { get; set; }
+ public DbSet Users { get; set; }
+ public DbSet LoadingMessages { get; set; }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ if (!optionsBuilder.IsConfigured)
+ {
+ var config = ConfigService
+ .GetSection("Moonlight")
+ .GetSection("Database");
+
+ var connectionString = $"host={config.GetValue("Host")};" +
+ $"port={config.GetValue("Port")};" +
+ $"database={config.GetValue("Database")};" +
+ $"uid={config.GetValue("Username")};" +
+ $"pwd={config.GetValue("Password")}";
+
+ optionsBuilder.UseMySql(
+ connectionString,
+ ServerVersion.Parse("5.7.37-mysql"),
+ builder =>
+ {
+ builder.EnableRetryOnFailure(5);
+ }
+ );
+ }
+ }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/DockerImage.cs b/Moonlight/App/Database/Entities/DockerImage.cs
new file mode 100644
index 00000000..4ad61376
--- /dev/null
+++ b/Moonlight/App/Database/Entities/DockerImage.cs
@@ -0,0 +1,8 @@
+namespace Moonlight.App.Database.Entities;
+
+public class DockerImage
+{
+ public int Id { get; set; }
+ public bool Default { get; set; } = false;
+ public string Name { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/Image.cs b/Moonlight/App/Database/Entities/Image.cs
new file mode 100644
index 00000000..6485dc0a
--- /dev/null
+++ b/Moonlight/App/Database/Entities/Image.cs
@@ -0,0 +1,20 @@
+namespace Moonlight.App.Database.Entities;
+
+public class Image
+{
+ public int Id { get; set; }
+ public Guid Uuid { get; set; }
+ public string Name { get; set; } = "";
+ public string Description { get; set; } = "";
+ public string ConfigFiles { get; set; } = "{}";
+ public string StopCommand { get; set; } = "";
+ public string StartupDetection { get; set; } = "";
+ public string InstallScript { get; set; } = "";
+ public string InstallDockerImage { get; set; } = "";
+ public string InstallEntrypoint { get; set; } = "";
+ public string Startup { get; set; } = "";
+
+ public List DockerImages { get; set; } = new();
+ public List Variables { get; set; } = new();
+ public List Tags { get; set; } = new();
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/ImageTag.cs b/Moonlight/App/Database/Entities/ImageTag.cs
new file mode 100644
index 00000000..7f3063fb
--- /dev/null
+++ b/Moonlight/App/Database/Entities/ImageTag.cs
@@ -0,0 +1,7 @@
+namespace Moonlight.App.Database.Entities;
+
+public class ImageTag
+{
+ public int Id { get; set; }
+ public string Name { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/ImageVariable.cs b/Moonlight/App/Database/Entities/ImageVariable.cs
new file mode 100644
index 00000000..dd14b223
--- /dev/null
+++ b/Moonlight/App/Database/Entities/ImageVariable.cs
@@ -0,0 +1,8 @@
+namespace Moonlight.App.Database.Entities;
+
+public class ImageVariable
+{
+ public int Id { get; set; }
+ public string Key { get; set; } = "";
+ public string DefaultValue { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/LoadingMessage.cs b/Moonlight/App/Database/Entities/LoadingMessage.cs
new file mode 100644
index 00000000..668590d0
--- /dev/null
+++ b/Moonlight/App/Database/Entities/LoadingMessage.cs
@@ -0,0 +1,7 @@
+namespace Moonlight.App.Database.Entities;
+
+public class LoadingMessage
+{
+ public int Id { get; set; }
+ public string Message { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/Node.cs b/Moonlight/App/Database/Entities/Node.cs
new file mode 100644
index 00000000..66f12abc
--- /dev/null
+++ b/Moonlight/App/Database/Entities/Node.cs
@@ -0,0 +1,14 @@
+namespace Moonlight.App.Database.Entities;
+
+public class Node
+{
+ public int Id { get; set; }
+ public string Name { get; set; } = "";
+ public string Fqdn { get; set; } = "";
+ public string TokenId { get; set; } = "";
+ public string Token { get; set; } = "";
+ public int SftpPort { get; set; }
+ public int HttpPort { get; set; }
+ public int MoonlightDaemonPort { get; set; }
+ public List Allocations { get; set; } = new();
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/NodeAllocation.cs b/Moonlight/App/Database/Entities/NodeAllocation.cs
new file mode 100644
index 00000000..d726f7f6
--- /dev/null
+++ b/Moonlight/App/Database/Entities/NodeAllocation.cs
@@ -0,0 +1,7 @@
+namespace Moonlight.App.Database.Entities;
+
+public class NodeAllocation
+{
+ public int Id { get; set; }
+ public int Port { get; set; }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/Server.cs b/Moonlight/App/Database/Entities/Server.cs
new file mode 100644
index 00000000..11388d90
--- /dev/null
+++ b/Moonlight/App/Database/Entities/Server.cs
@@ -0,0 +1,23 @@
+namespace Moonlight.App.Database.Entities;
+
+public class Server
+{
+ public int Id { get; set; }
+ public Guid Uuid { get; set; }
+ public string Name { get; set; } = "";
+ public int Cpu { get; set; }
+ public long Memory { get; set; }
+ public long Disk { get; set; }
+ public Image Image { get; set; } = null!;
+ public int DockerImageIndex { get; set; } = 0;
+ public string OverrideStartup { get; set; } = "";
+ public bool Installing { get; set; } = false;
+ public bool Suspended { get; set; } = false;
+
+ public List Variables { get; set; } = new();
+ public List Backups { get; set; } = new();
+ public List Allocations { get; set; } = new();
+ public NodeAllocation MainAllocation { get; set; } = null!;
+ public Node Node { get; set; } = null!;
+ public User Owner { get; set; } = null!;
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/ServerBackup.cs b/Moonlight/App/Database/Entities/ServerBackup.cs
new file mode 100644
index 00000000..185e59ae
--- /dev/null
+++ b/Moonlight/App/Database/Entities/ServerBackup.cs
@@ -0,0 +1,11 @@
+namespace Moonlight.App.Database.Entities;
+
+public class ServerBackup
+{
+ public int Id { get; set; }
+ public string Name { get; set; } = "";
+ public Guid Uuid { get; set; }
+ public DateTime CreatedAt { get; set; }
+ public bool Created { get; set; } = false;
+ public long Bytes { get; set; }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/ServerVariable.cs b/Moonlight/App/Database/Entities/ServerVariable.cs
new file mode 100644
index 00000000..0feecbb4
--- /dev/null
+++ b/Moonlight/App/Database/Entities/ServerVariable.cs
@@ -0,0 +1,8 @@
+namespace Moonlight.App.Database.Entities;
+
+public class ServerVariable
+{
+ public int Id { get; set; }
+ public string Key { get; set; } = "";
+ public string Value { get; set; } = "";
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Entities/User.cs b/Moonlight/App/Database/Entities/User.cs
new file mode 100644
index 00000000..d4eea6de
--- /dev/null
+++ b/Moonlight/App/Database/Entities/User.cs
@@ -0,0 +1,26 @@
+using Moonlight.App.Models.Misc;
+
+namespace Moonlight.App.Database.Entities;
+
+public class User
+{
+ public int Id { get; set; }
+ public string FirstName { get; set; } = "";
+ public string LastName { get; set; } = "";
+ public string Email { get; set; } = "";
+ public string Password { get; set; } = "";
+ public string Address { get; set; } = "";
+ public string City { get; set; } = "";
+ public string State { get; set; } = "";
+ public string Country { get; set; } = "";
+ public UserStatus Status { get; set; } = UserStatus.Unverified;
+ public bool TotpEnabled { get; set; }
+ public string TotpSecret { get; set; } = "";
+ public DateTime TokenValidTime { get; set; } = DateTime.Now;
+ public long DiscordId { get; set; }
+ public string DiscordUsername { get; set; } = "";
+ public string DiscordDiscriminator { get; set; } = "";
+ public DateTime CreatedAt { get; set; }
+ public DateTime UpdatedAt { get; set; }
+ public bool Admin { get; set; }
+}
\ No newline at end of file
diff --git a/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.Designer.cs b/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.Designer.cs
new file mode 100644
index 00000000..a4bdbce2
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.Designer.cs
@@ -0,0 +1,515 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.App.Database;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20230215200722_InitialCreate")]
+ partial class InitialCreate
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Default")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("DockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ConfigFiles")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallEntrypoint")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Startup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StartupDetection")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageTags");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DefaultValue")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LoadingMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("LoadingMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Fqdn")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("HttpPort")
+ .HasColumnType("int");
+
+ b.Property("MoonlightDaemonPort")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SftpPort")
+ .HasColumnType("int");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TokenId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Nodes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ 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("NodeAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Cpu")
+ .HasColumnType("int");
+
+ b.Property("Disk")
+ .HasColumnType("bigint");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("int");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Installing")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("MainAllocationId")
+ .HasColumnType("int");
+
+ b.Property("Memory")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("OverrideStartup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("Suspended")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("MainAllocationId");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("OwnerId");
+
+ b.ToTable("Servers");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Bytes")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("ServerBackups");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ 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");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Address")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Admin")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Country")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("DiscordDiscriminator")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("DiscordId")
+ .HasColumnType("bigint");
+
+ b.Property("DiscordUsername")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("FirstName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("LastName")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Password")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("State")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Status")
+ .HasColumnType("int");
+
+ b.Property("TokenValidTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("TotpEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("TotpSecret")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Users");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", null)
+ .WithMany("DockerImages")
+ .HasForeignKey("ImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", null)
+ .WithMany("Tags")
+ .HasForeignKey("ImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", null)
+ .WithMany("Variables")
+ .HasForeignKey("ImageId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Node", null)
+ .WithMany("Allocations")
+ .HasForeignKey("NodeId");
+
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Allocations")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Image", "Image")
+ .WithMany()
+ .HasForeignKey("ImageId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.NodeAllocation", "MainAllocation")
+ .WithMany()
+ .HasForeignKey("MainAllocationId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.Node", "Node")
+ .WithMany()
+ .HasForeignKey("NodeId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
+ .WithMany()
+ .HasForeignKey("OwnerId")
+ .OnDelete(DeleteBehavior.Cascade)
+ .IsRequired();
+
+ b.Navigation("Image");
+
+ b.Navigation("MainAllocation");
+
+ b.Navigation("Node");
+
+ b.Navigation("Owner");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Backups")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+ {
+ b.HasOne("Moonlight.App.Database.Entities.Server", null)
+ .WithMany("Variables")
+ .HasForeignKey("ServerId");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Navigation("DockerImages");
+
+ b.Navigation("Tags");
+
+ b.Navigation("Variables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Navigation("Allocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Navigation("Allocations");
+
+ b.Navigation("Backups");
+
+ b.Navigation("Variables");
+ });
+#pragma warning restore 612, 618
+ }
+ }
+}
diff --git a/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.cs b/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.cs
new file mode 100644
index 00000000..7bc64d22
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/20230215200722_InitialCreate.cs
@@ -0,0 +1,434 @@
+using System;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ ///
+ public partial class InitialCreate : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterDatabase()
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Images",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Uuid = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Description = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ConfigFiles = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ StopCommand = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ StartupDetection = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ InstallScript = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ InstallDockerImage = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ InstallEntrypoint = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Startup = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Images", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "LoadingMessages",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Message = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4")
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_LoadingMessages", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Nodes",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Fqdn = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ TokenId = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Token = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ SftpPort = table.Column(type: "int", nullable: false),
+ HttpPort = table.Column(type: "int", nullable: false),
+ MoonlightDaemonPort = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Nodes", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Users",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ FirstName = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ LastName = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Email = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Password = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Address = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ City = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ State = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Country = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Status = table.Column(type: "int", nullable: false),
+ TotpEnabled = table.Column(type: "tinyint(1)", nullable: false),
+ TotpSecret = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ TokenValidTime = table.Column(type: "datetime(6)", nullable: false),
+ DiscordId = table.Column(type: "bigint", nullable: false),
+ DiscordUsername = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ DiscordDiscriminator = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ CreatedAt = table.Column(type: "datetime(6)", nullable: false),
+ UpdatedAt = table.Column(type: "datetime(6)", nullable: false),
+ Admin = table.Column(type: "tinyint(1)", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Users", x => x.Id);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "DockerImages",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Default = table.Column(type: "tinyint(1)", nullable: false),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ImageId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_DockerImages", x => x.Id);
+ table.ForeignKey(
+ name: "FK_DockerImages_Images_ImageId",
+ column: x => x.ImageId,
+ principalTable: "Images",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "ImageTags",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ImageId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ImageTags", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ImageTags_Images_ImageId",
+ column: x => x.ImageId,
+ principalTable: "Images",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "ImageVariables",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Key = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ DefaultValue = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ImageId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ImageVariables", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ImageVariables_Images_ImageId",
+ column: x => x.ImageId,
+ principalTable: "Images",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "NodeAllocations",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Port = table.Column(type: "int", nullable: false),
+ NodeId = table.Column(type: "int", nullable: true),
+ ServerId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_NodeAllocations", x => x.Id);
+ table.ForeignKey(
+ name: "FK_NodeAllocations_Nodes_NodeId",
+ column: x => x.NodeId,
+ principalTable: "Nodes",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "Servers",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Uuid = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Cpu = table.Column(type: "int", nullable: false),
+ Memory = table.Column(type: "bigint", nullable: false),
+ Disk = table.Column(type: "bigint", nullable: false),
+ ImageId = table.Column(type: "int", nullable: false),
+ DockerImageIndex = table.Column(type: "int", nullable: false),
+ OverrideStartup = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Installing = table.Column(type: "tinyint(1)", nullable: false),
+ Suspended = table.Column(type: "tinyint(1)", nullable: false),
+ MainAllocationId = table.Column(type: "int", nullable: false),
+ NodeId = table.Column(type: "int", nullable: false),
+ OwnerId = table.Column(type: "int", nullable: false)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Servers", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Servers_Images_ImageId",
+ column: x => x.ImageId,
+ principalTable: "Images",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_NodeAllocations_MainAllocationId",
+ column: x => x.MainAllocationId,
+ principalTable: "NodeAllocations",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_Nodes_NodeId",
+ column: x => x.NodeId,
+ principalTable: "Nodes",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ table.ForeignKey(
+ name: "FK_Servers_Users_OwnerId",
+ column: x => x.OwnerId,
+ principalTable: "Users",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "ServerBackups",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Name = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Uuid = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
+ CreatedAt = table.Column(type: "datetime(6)", nullable: false),
+ Created = table.Column(type: "tinyint(1)", nullable: false),
+ Bytes = table.Column(type: "bigint", nullable: false),
+ ServerId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerBackups", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ServerBackups_Servers_ServerId",
+ column: x => x.ServerId,
+ principalTable: "Servers",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateTable(
+ name: "ServerVariables",
+ columns: table => new
+ {
+ Id = table.Column(type: "int", nullable: false)
+ .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
+ Key = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ Value = table.Column(type: "longtext", nullable: false)
+ .Annotation("MySql:CharSet", "utf8mb4"),
+ ServerId = table.Column(type: "int", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ServerVariables", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ServerVariables_Servers_ServerId",
+ column: x => x.ServerId,
+ principalTable: "Servers",
+ principalColumn: "Id");
+ })
+ .Annotation("MySql:CharSet", "utf8mb4");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_DockerImages_ImageId",
+ table: "DockerImages",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ImageTags_ImageId",
+ table: "ImageTags",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ImageVariables_ImageId",
+ table: "ImageVariables",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_NodeAllocations_NodeId",
+ table: "NodeAllocations",
+ column: "NodeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_NodeAllocations_ServerId",
+ table: "NodeAllocations",
+ column: "ServerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerBackups_ServerId",
+ table: "ServerBackups",
+ column: "ServerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_ImageId",
+ table: "Servers",
+ column: "ImageId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_MainAllocationId",
+ table: "Servers",
+ column: "MainAllocationId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_NodeId",
+ table: "Servers",
+ column: "NodeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Servers_OwnerId",
+ table: "Servers",
+ column: "OwnerId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ServerVariables_ServerId",
+ table: "ServerVariables",
+ column: "ServerId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_NodeAllocations_Servers_ServerId",
+ table: "NodeAllocations",
+ column: "ServerId",
+ principalTable: "Servers",
+ principalColumn: "Id");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Servers_Images_ImageId",
+ table: "Servers");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_NodeAllocations_Nodes_NodeId",
+ table: "NodeAllocations");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_Servers_Nodes_NodeId",
+ table: "Servers");
+
+ migrationBuilder.DropForeignKey(
+ name: "FK_NodeAllocations_Servers_ServerId",
+ table: "NodeAllocations");
+
+ migrationBuilder.DropTable(
+ name: "DockerImages");
+
+ migrationBuilder.DropTable(
+ name: "ImageTags");
+
+ migrationBuilder.DropTable(
+ name: "ImageVariables");
+
+ migrationBuilder.DropTable(
+ name: "LoadingMessages");
+
+ migrationBuilder.DropTable(
+ name: "ServerBackups");
+
+ migrationBuilder.DropTable(
+ name: "ServerVariables");
+
+ migrationBuilder.DropTable(
+ name: "Images");
+
+ migrationBuilder.DropTable(
+ name: "Nodes");
+
+ migrationBuilder.DropTable(
+ name: "Servers");
+
+ migrationBuilder.DropTable(
+ name: "NodeAllocations");
+
+ migrationBuilder.DropTable(
+ name: "Users");
+ }
+ }
+}
diff --git a/Moonlight/App/Database/Migrations/DataContextModelSnapshot.cs b/Moonlight/App/Database/Migrations/DataContextModelSnapshot.cs
new file mode 100644
index 00000000..06df2d11
--- /dev/null
+++ b/Moonlight/App/Database/Migrations/DataContextModelSnapshot.cs
@@ -0,0 +1,512 @@
+//
+using System;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Moonlight.App.Database;
+
+#nullable disable
+
+namespace Moonlight.App.Database.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ partial class DataContextModelSnapshot : ModelSnapshot
+ {
+ protected override void BuildModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("ProductVersion", "7.0.3")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.DockerImage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Default")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("DockerImages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ConfigFiles")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallDockerImage")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallEntrypoint")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("InstallScript")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Startup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StartupDetection")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("StopCommand")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageTags");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ImageVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("DefaultValue")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Key")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("ImageVariables");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.LoadingMessage", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Message")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("LoadingMessages");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Node", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Fqdn")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("HttpPort")
+ .HasColumnType("int");
+
+ b.Property("MoonlightDaemonPort")
+ .HasColumnType("int");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("SftpPort")
+ .HasColumnType("int");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("TokenId")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.HasKey("Id");
+
+ b.ToTable("Nodes");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.NodeAllocation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ 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("NodeAllocations");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.Server", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Cpu")
+ .HasColumnType("int");
+
+ b.Property("Disk")
+ .HasColumnType("bigint");
+
+ b.Property("DockerImageIndex")
+ .HasColumnType("int");
+
+ b.Property("ImageId")
+ .HasColumnType("int");
+
+ b.Property("Installing")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("MainAllocationId")
+ .HasColumnType("int");
+
+ b.Property("Memory")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("NodeId")
+ .HasColumnType("int");
+
+ b.Property("OverrideStartup")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("OwnerId")
+ .HasColumnType("int");
+
+ b.Property("Suspended")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.HasIndex("MainAllocationId");
+
+ b.HasIndex("NodeId");
+
+ b.HasIndex("OwnerId");
+
+ b.ToTable("Servers");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerBackup", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Bytes")
+ .HasColumnType("bigint");
+
+ b.Property("Created")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("ServerId")
+ .HasColumnType("int");
+
+ b.Property("Uuid")
+ .HasColumnType("char(36)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ServerId");
+
+ b.ToTable("ServerBackups");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.ServerVariable", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ 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");
+ });
+
+ modelBuilder.Entity("Moonlight.App.Database.Entities.User", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("int");
+
+ b.Property("Address")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Admin")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("City")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Country")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("CreatedAt")
+ .HasColumnType("datetime(6)");
+
+ b.Property("DiscordDiscriminator")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("DiscordId")
+ .HasColumnType("bigint");
+
+ b.Property("DiscordUsername")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property("Email")
+ .IsRequired()
+ .HasColumnType("longtext");
+
+ b.Property