Revert "Merge branch 'PleskIntegration' into main"

This reverts commit 18c205d8a0, reversing
changes made to c5be86b695.
This commit is contained in:
Marcel Baumgartner
2023-03-24 20:11:18 +01:00
parent 18c205d8a0
commit 3611b745ff
28 changed files with 75 additions and 5394 deletions

View File

@@ -42,7 +42,6 @@ public class DataContext : DbContext
public DbSet<AaPanel> AaPanels { get; set; }
public DbSet<Website> Websites { get; set; }
public DbSet<DdosAttack> DdosAttacks { get; set; }
public DbSet<PleskServer> PleskServers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{

View File

@@ -1,9 +0,0 @@
namespace Moonlight.App.Database.Entities;
public class PleskServer
{
public int Id { get; set; }
public string BaseUrl { get; set; } = "";
public string ApiKey { get; set; } = "";
public string Name { get; set; } = "";
}

View File

@@ -3,8 +3,11 @@
public class Website
{
public int Id { get; set; }
public int PleskId { get; set; }
public int InternalAaPanelId { get; set; }
public AaPanel AaPanel { get; set; }
public User Owner { get; set; }
public PleskServer PleskServer { get; set; }
public string BaseDomain { get; set; }
public string DomainName { get; set; }
public string PhpVersion { get; set; }
public string FtpUsername { get; set; }
public string FtpPassword { get; set; }
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Moonlight.App.Database.Migrations
{
/// <inheritdoc />
public partial class AddedPleskServer : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PleskServers",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
BaseUrl = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ApiKey = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_PleskServers", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PleskServers");
}
}
}

View File

@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Moonlight.App.Database.Migrations
{
/// <inheritdoc />
public partial class AddedNameToPleskServer : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "PleskServers",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name",
table: "PleskServers");
}
}
}

View File

@@ -1,124 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Moonlight.App.Database.Migrations
{
/// <inheritdoc />
public partial class SwitchedToPleskModel : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Websites_AaPanels_AaPanelId",
table: "Websites");
migrationBuilder.DropIndex(
name: "IX_Websites_AaPanelId",
table: "Websites");
migrationBuilder.DropColumn(
name: "DomainName",
table: "Websites");
migrationBuilder.DropColumn(
name: "FtpPassword",
table: "Websites");
migrationBuilder.DropColumn(
name: "FtpUsername",
table: "Websites");
migrationBuilder.DropColumn(
name: "PhpVersion",
table: "Websites");
migrationBuilder.RenameColumn(
name: "InternalAaPanelId",
table: "Websites",
newName: "PleskServerId");
migrationBuilder.RenameColumn(
name: "AaPanelId",
table: "Websites",
newName: "PleskId");
migrationBuilder.CreateIndex(
name: "IX_Websites_PleskServerId",
table: "Websites",
column: "PleskServerId");
migrationBuilder.AddForeignKey(
name: "FK_Websites_PleskServers_PleskServerId",
table: "Websites",
column: "PleskServerId",
principalTable: "PleskServers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Websites_PleskServers_PleskServerId",
table: "Websites");
migrationBuilder.DropIndex(
name: "IX_Websites_PleskServerId",
table: "Websites");
migrationBuilder.RenameColumn(
name: "PleskServerId",
table: "Websites",
newName: "InternalAaPanelId");
migrationBuilder.RenameColumn(
name: "PleskId",
table: "Websites",
newName: "AaPanelId");
migrationBuilder.AddColumn<string>(
name: "DomainName",
table: "Websites",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FtpPassword",
table: "Websites",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "FtpUsername",
table: "Websites",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PhpVersion",
table: "Websites",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_Websites_AaPanelId",
table: "Websites",
column: "AaPanelId");
migrationBuilder.AddForeignKey(
name: "FK_Websites_AaPanels_AaPanelId",
table: "Websites",
column: "AaPanelId",
principalTable: "AaPanels",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Moonlight.App.Database.Migrations
{
/// <inheritdoc />
public partial class AddedBaseDomainToWebsite : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "BaseDomain",
table: "Websites",
type: "longtext",
nullable: false)
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "BaseDomain",
table: "Websites");
}
}
}

View File

@@ -446,29 +446,6 @@ namespace Moonlight.App.Database.Migrations
b.ToTable("NotificationClients");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.PleskServer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("ApiKey")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("BaseUrl")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.ToTable("PleskServers");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.Revoke", b =>
{
b.Property<int>("Id")
@@ -810,24 +787,36 @@ namespace Moonlight.App.Database.Migrations
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<string>("BaseDomain")
b.Property<int>("AaPanelId")
.HasColumnType("int");
b.Property<string>("DomainName")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FtpPassword")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("FtpUsername")
.IsRequired()
.HasColumnType("longtext");
b.Property<int>("InternalAaPanelId")
.HasColumnType("int");
b.Property<int>("OwnerId")
.HasColumnType("int");
b.Property<int>("PleskId")
.HasColumnType("int");
b.Property<int>("PleskServerId")
.HasColumnType("int");
b.Property<string>("PhpVersion")
.IsRequired()
.HasColumnType("longtext");
b.HasKey("Id");
b.HasIndex("OwnerId");
b.HasIndex("AaPanelId");
b.HasIndex("PleskServerId");
b.HasIndex("OwnerId");
b.ToTable("Websites");
});
@@ -1018,21 +1007,21 @@ namespace Moonlight.App.Database.Migrations
modelBuilder.Entity("Moonlight.App.Database.Entities.Website", b =>
{
b.HasOne("Moonlight.App.Database.Entities.AaPanel", "AaPanel")
.WithMany()
.HasForeignKey("AaPanelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Moonlight.App.Database.Entities.User", "Owner")
.WithMany()
.HasForeignKey("OwnerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Moonlight.App.Database.Entities.PleskServer", "PleskServer")
.WithMany()
.HasForeignKey("PleskServerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AaPanel");
b.Navigation("Owner");
b.Navigation("PleskServer");
});
modelBuilder.Entity("Moonlight.App.Database.Entities.Image", b =>