Skip to content

Commit

Permalink
Add EF migrations.
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbound committed May 23, 2023
1 parent 0386295 commit 2c42697
Show file tree
Hide file tree
Showing 10 changed files with 3,691 additions and 136 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Remotely.Server.Migrations.PostgreSql
{
/// <inheritdoc />
public partial class ReplaceDbLoggerwithSerilog : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EventLogs");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EventLogs",
columns: table => new
{
ID = table.Column<string>(type: "text", nullable: false),
OrganizationID = table.Column<string>(type: "text", nullable: true),
EventType = table.Column<int>(type: "integer", nullable: false),
Message = table.Column<string>(type: "text", nullable: true),
Source = table.Column<string>(type: "text", nullable: true),
StackTrace = table.Column<string>(type: "text", nullable: true),
TimeStamp = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EventLogs", x => x.ID);
table.ForeignKey(
name: "FK_EventLogs_Organizations_OrganizationID",
column: x => x.OrganizationID,
principalTable: "Organizations",
principalColumn: "ID");
});

migrationBuilder.CreateIndex(
name: "IX_EventLogs_OrganizationID",
table: "EventLogs",
column: "OrganizationID");
}
}
}
46 changes: 3 additions & 43 deletions Server/Migrations/PostgreSql/PostgreSqlDbContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.9")
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -216,6 +216,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("RemotelyUsers", (string)null);

b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");

b.UseTphMappingStrategy();
});

modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
Expand Down Expand Up @@ -521,37 +523,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("DeviceGroups");
});

modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.Property<string>("ID")
.ValueGeneratedOnAdd()
.HasColumnType("text");

b.Property<int>("EventType")
.HasColumnType("integer");

b.Property<string>("Message")
.HasColumnType("text");

b.Property<string>("OrganizationID")
.HasColumnType("text");

b.Property<string>("Source")
.HasColumnType("text");

b.Property<string>("StackTrace")
.HasColumnType("text");

b.Property<DateTimeOffset>("TimeStamp")
.HasColumnType("timestamp with time zone");

b.HasKey("ID");

b.HasIndex("OrganizationID");

b.ToTable("EventLogs");
});

modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.Property<string>("ID")
Expand Down Expand Up @@ -1045,15 +1016,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.Navigation("Organization");
});

modelBuilder.Entity("Remotely.Shared.Models.EventLog", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
.WithMany("EventLogs")
.HasForeignKey("OrganizationID");

b.Navigation("Organization");
});

modelBuilder.Entity("Remotely.Shared.Models.InviteLink", b =>
{
b.HasOne("Remotely.Shared.Models.Organization", "Organization")
Expand Down Expand Up @@ -1173,8 +1135,6 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Navigation("Devices");

b.Navigation("EventLogs");

b.Navigation("InviteLinks");

b.Navigation("RemotelyUsers");
Expand Down
Loading

0 comments on commit 2c42697

Please sign in to comment.