Merge pull request #2 from Penumbra-Sync/postgresql

migrate to postgresql
This commit is contained in:
rootdarkarchon
2022-08-01 02:14:31 +02:00
committed by GitHub
34 changed files with 731 additions and 2793 deletions

View File

@@ -19,17 +19,17 @@ namespace MareSynchronosServer.Data
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<Auth>().ToTable("Auth");
modelBuilder.Entity<User>().ToTable("Users");
modelBuilder.Entity<Auth>().ToTable("auth");
modelBuilder.Entity<User>().ToTable("users");
modelBuilder.Entity<User>().HasIndex(c => c.CharacterIdentification);
modelBuilder.Entity<FileCache>().ToTable("FileCaches");
modelBuilder.Entity<FileCache>().ToTable("file_caches");
modelBuilder.Entity<FileCache>().HasIndex(c => c.UploaderUID);
modelBuilder.Entity<ClientPair>().ToTable("ClientPairs");
modelBuilder.Entity<ClientPair>().ToTable("client_pairs");
modelBuilder.Entity<ClientPair>().HasKey(u => new { u.UserUID, u.OtherUserUID });
modelBuilder.Entity<ClientPair>().HasIndex(c => c.UserUID);
modelBuilder.Entity<ClientPair>().HasIndex(c => c.OtherUserUID);
modelBuilder.Entity<ForbiddenUploadEntry>().ToTable("ForbiddenUploadEntries");
modelBuilder.Entity<Banned>().ToTable("BannedUsers");
modelBuilder.Entity<ForbiddenUploadEntry>().ToTable("forbidden_upload_entries");
modelBuilder.Entity<Banned>().ToTable("banned_users");
}
}
}

View File

@@ -28,6 +28,11 @@ namespace MareSynchronosServer.Hubs
var ownPairData = await _dbContext.ClientPairs.Where(u => u.User.UID == userid).ToListAsync();
var auth = await _dbContext.Auth.SingleAsync(u => u.UserUID == userid);
while (_dbContext.Files.Any(f => f.Uploader == userEntry))
{
await Task.Delay(1000);
}
MareMetrics.Pairs.Dec(ownPairData.Count);
MareMetrics.PairsPaused.Dec(ownPairData.Count(c => c.IsPaused));

View File

@@ -8,18 +8,19 @@
<ItemGroup>
<PackageReference Include="Bazinga.AspNetCore.Authentication.Basic" Version="2.0.1" />
<PackageReference Include="EFCore.NamingConventions" Version="6.0.0" />
<PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.3.0" />
<PackageReference Include="lz4net" Version="1.0.15.93" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.5" />
<PackageReference Include="prometheus-net" Version="6.0.0" />
<PackageReference Include="prometheus-net.AspNetCore" Version="6.0.0" />
</ItemGroup>
@@ -28,4 +29,8 @@
<ProjectReference Include="..\..\MareAPI\MareSynchronosAPI\MareSynchronos.API.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
</Project>

View File

@@ -1,150 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220629173313_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.CharacterData", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<string>("CharacterCache")
.HasColumnType("nvarchar(max)");
b.Property<string>("Hash")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "JobId");
b.ToTable("CharacterData", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,117 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CharacterData",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
JobId = table.Column<int>(type: "int", nullable: false),
CharacterCache = table.Column<string>(type: "nvarchar(max)", nullable: true),
Hash = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CharacterData", x => new { x.UserId, x.JobId });
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
UID = table.Column<string>(type: "nvarchar(450)", nullable: false),
SecretKey = table.Column<string>(type: "nvarchar(max)", nullable: true),
CharacterIdentification = table.Column<string>(type: "nvarchar(max)", nullable: true),
Timestamp = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Users", x => x.UID);
});
migrationBuilder.CreateTable(
name: "ClientPairs",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
UserUID = table.Column<string>(type: "nvarchar(450)", nullable: true),
OtherUserUID = table.Column<string>(type: "nvarchar(450)", nullable: true),
IsPaused = table.Column<bool>(type: "bit", nullable: false),
Timestamp = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ClientPairs", x => x.Id);
table.ForeignKey(
name: "FK_ClientPairs_Users_OtherUserUID",
column: x => x.OtherUserUID,
principalTable: "Users",
principalColumn: "UID");
table.ForeignKey(
name: "FK_ClientPairs_Users_UserUID",
column: x => x.UserUID,
principalTable: "Users",
principalColumn: "UID");
});
migrationBuilder.CreateTable(
name: "FileCaches",
columns: table => new
{
Hash = table.Column<string>(type: "nvarchar(450)", nullable: false),
UploaderUID = table.Column<string>(type: "nvarchar(450)", nullable: true),
Uploaded = table.Column<bool>(type: "bit", nullable: false),
LastAccessTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Timestamp = table.Column<byte[]>(type: "rowversion", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_FileCaches", x => x.Hash);
table.ForeignKey(
name: "FK_FileCaches_Users_UploaderUID",
column: x => x.UploaderUID,
principalTable: "Users",
principalColumn: "UID");
});
migrationBuilder.CreateIndex(
name: "IX_ClientPairs_OtherUserUID",
table: "ClientPairs",
column: "OtherUserUID");
migrationBuilder.CreateIndex(
name: "IX_ClientPairs_UserUID",
table: "ClientPairs",
column: "UserUID");
migrationBuilder.CreateIndex(
name: "IX_FileCaches_UploaderUID",
table: "FileCaches",
column: "UploaderUID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CharacterData");
migrationBuilder.DropTable(
name: "ClientPairs");
migrationBuilder.DropTable(
name: "FileCaches");
migrationBuilder.DropTable(
name: "Users");
}
}
}

View File

@@ -1,163 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220629173544_AddForbiddenUploadEntry")]
partial class AddForbiddenUploadEntry
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.CharacterData", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<string>("CharacterCache")
.HasColumnType("nvarchar(max)");
b.Property<string>("Hash")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "JobId");
b.ToTable("CharacterData", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class AddForbiddenUploadEntry : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "ForbiddenUploadEntries",
columns: table => new
{
Hash = table.Column<string>(type: "nvarchar(450)", nullable: false),
ForbiddenBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_ForbiddenUploadEntries", x => x.Hash);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "ForbiddenUploadEntries");
}
}
}

View File

@@ -1,179 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220629184351_AddBannedAdminAndReceivingMessages")]
partial class AddBannedAdminAndReceivingMessages
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.CharacterData", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<string>("CharacterCache")
.HasColumnType("nvarchar(max)");
b.Property<string>("Hash")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "JobId");
b.ToTable("CharacterData", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,51 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class AddBannedAdminAndReceivingMessages : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsAdmin",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<bool>(
name: "AllowReceivingMessages",
table: "ClientPairs",
type: "bit",
nullable: false,
defaultValue: false);
migrationBuilder.CreateTable(
name: "BannedUsers",
columns: table => new
{
CharacterIdentification = table.Column<string>(type: "nvarchar(450)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_BannedUsers", x => x.CharacterIdentification);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BannedUsers");
migrationBuilder.DropColumn(
name: "IsAdmin",
table: "Users");
migrationBuilder.DropColumn(
name: "AllowReceivingMessages",
table: "ClientPairs");
}
}
}

View File

@@ -1,182 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220629212721_AddBannedReason")]
partial class AddBannedReason
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.CharacterData", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<string>("CharacterCache")
.HasColumnType("nvarchar(max)");
b.Property<string>("Hash")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "JobId");
b.ToTable("CharacterData", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class AddBannedReason : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Reason",
table: "BannedUsers",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Reason",
table: "BannedUsers");
}
}
}

View File

@@ -1,185 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220629230923_ChangeAdminToModerator")]
partial class ChangeAdminToModerator
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.CharacterData", b =>
{
b.Property<string>("UserId")
.HasColumnType("nvarchar(450)");
b.Property<int>("JobId")
.HasColumnType("int");
b.Property<string>("CharacterCache")
.HasColumnType("nvarchar(max)");
b.Property<string>("Hash")
.HasColumnType("nvarchar(max)");
b.HasKey("UserId", "JobId");
b.ToTable("CharacterData", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,26 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class ChangeAdminToModerator : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsModerator",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsModerator",
table: "Users");
}
}
}

View File

@@ -1,166 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220704113233_RemoveCharacterData")]
partial class RemoveCharacterData
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,32 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class RemoveCharacterData : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CharacterData");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CharacterData",
columns: table => new
{
UserId = table.Column<string>(type: "nvarchar(450)", nullable: false),
JobId = table.Column<int>(type: "int", nullable: false),
CharacterCache = table.Column<string>(type: "nvarchar(max)", nullable: true),
Hash = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CharacterData", x => new { x.UserId, x.JobId });
});
}
}
}

View File

@@ -1,176 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220710104014_AddTimestampToAllTables")]
partial class AddTimestampToAllTables
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(450)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<DateTime>("LastAccessTime")
.HasColumnType("datetime2");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(450)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasColumnType("nvarchar(450)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,38 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class AddTimestampToAllTables : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<byte[]>(
name: "Timestamp",
table: "ForbiddenUploadEntries",
type: "rowversion",
rowVersion: true,
nullable: true);
migrationBuilder.AddColumn<byte[]>(
name: "Timestamp",
table: "BannedUsers",
type: "rowversion",
rowVersion: true,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Timestamp",
table: "ForbiddenUploadEntries");
migrationBuilder.DropColumn(
name: "Timestamp",
table: "BannedUsers");
}
}
}

View File

@@ -1,175 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220712082237_SetMaxLengths")]
partial class SetMaxLengths
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"), 1L, 1);
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<string>("OtherUserUID")
.HasColumnType("nvarchar(10)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(10)");
b.HasKey("Id");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(20)
.HasColumnType("nvarchar(40)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,141 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class SetMaxLengths : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LastAccessTime",
table: "FileCaches");
migrationBuilder.DropForeignKey("FK_FileCaches_Users_UploaderUID", "FileCaches");
migrationBuilder.DropForeignKey("FK_ClientPairs_Users_UserUID", "ClientPairs");
migrationBuilder.DropForeignKey("FK_ClientPairs_Users_OtherUserUID", "ClientPairs");
migrationBuilder.DropPrimaryKey("PK_FileCaches", "FileCaches");
migrationBuilder.DropPrimaryKey("PK_Users", "Users");
migrationBuilder.AlterColumn<string>(
name: "UploaderUID",
table: "FileCaches",
type: "nvarchar(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Hash",
table: "FileCaches",
type: "nvarchar(40)",
maxLength: 20,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(450)");
migrationBuilder.AlterColumn<string>(
name: "UserUID",
table: "ClientPairs",
type: "nvarchar(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OtherUserUID",
table: "ClientPairs",
type: "nvarchar(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "UID",
table: "Users",
type: "nvarchar(10)",
maxLength: 10,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(450)");
migrationBuilder.AddPrimaryKey("PK_Users", "Users", "UID");
migrationBuilder.AddPrimaryKey("PK_FileCaches", "FileCaches", "Hash");
migrationBuilder.AddForeignKey("FK_FileCaches_Users_UploaderUID", "FileCaches", "UploaderUID", "Users");
migrationBuilder.AddForeignKey("FK_ClientPairs_Users_UserUID", "ClientPairs", "UserUID", "Users");
migrationBuilder.AddForeignKey("FK_ClientPairs_Users_OtherUserUID", "ClientPairs", "UserUID", "Users");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey("FK_FileCaches_Users_UploaderUID", "FileCaches");
migrationBuilder.DropForeignKey("FK_ClientPairs_Users_UserUID", "ClientPairs");
migrationBuilder.DropForeignKey("FK_ClientPairs_Users_OtherUserUID", "ClientPairs");
migrationBuilder.DropPrimaryKey("PK_FileCaches", "FileCaches");
migrationBuilder.DropPrimaryKey("PK_Users", "Users");
migrationBuilder.AlterColumn<string>(
name: "UID",
table: "Users",
type: "nvarchar(450)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldMaxLength: 10);
migrationBuilder.AlterColumn<string>(
name: "UploaderUID",
table: "FileCaches",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Hash",
table: "FileCaches",
type: "nvarchar(450)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(20)",
oldMaxLength: 20);
migrationBuilder.AddColumn<DateTime>(
name: "LastAccessTime",
table: "FileCaches",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AlterColumn<string>(
name: "UserUID",
table: "ClientPairs",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OtherUserUID",
table: "ClientPairs",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldNullable: true);
migrationBuilder.AddPrimaryKey("PK_Users", "Users", "UID");
migrationBuilder.AddPrimaryKey("PK_FileCaches", "FileCaches", "Hash");
migrationBuilder.AddForeignKey("FK_FileCaches_Users_UploaderUID", "FileCaches", "UploaderUID", "Users");
migrationBuilder.AddForeignKey("FK_ClientPairs_Users_UserUID", "ClientPairs", "UserUID", "Users");
migrationBuilder.AddForeignKey("FK_ClientPairs_Users_OtherUserUID", "ClientPairs", "UserUID", "Users");
}
}
}

View File

@@ -1,175 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220712102941_ClientPairKey")]
partial class ClientPairKey
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UserUID", "OtherUserUID");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<string>("SecretKey")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,131 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class ClientPairKey : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ClientPairs_Users_OtherUserUID",
table: "ClientPairs");
migrationBuilder.DropForeignKey(
name: "FK_ClientPairs_Users_UserUID",
table: "ClientPairs");
migrationBuilder.DropPrimaryKey(
name: "PK_ClientPairs",
table: "ClientPairs");
migrationBuilder.DropColumn(
name: "Id",
table: "ClientPairs");
migrationBuilder.AlterColumn<string>(
name: "UserUID",
table: "ClientPairs",
type: "nvarchar(10)",
maxLength: 10,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "OtherUserUID",
table: "ClientPairs",
type: "nvarchar(10)",
maxLength: 10,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_ClientPairs",
table: "ClientPairs",
columns: new[] { "UserUID", "OtherUserUID" });
migrationBuilder.AddForeignKey(
name: "FK_ClientPairs_Users_OtherUserUID",
table: "ClientPairs",
column: "OtherUserUID",
principalTable: "Users",
principalColumn: "UID",
onDelete: ReferentialAction.NoAction);
migrationBuilder.AddForeignKey(
name: "FK_ClientPairs_Users_UserUID",
table: "ClientPairs",
column: "UserUID",
principalTable: "Users",
principalColumn: "UID",
onDelete: ReferentialAction.NoAction);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ClientPairs_Users_OtherUserUID",
table: "ClientPairs");
migrationBuilder.DropForeignKey(
name: "FK_ClientPairs_Users_UserUID",
table: "ClientPairs");
migrationBuilder.DropPrimaryKey(
name: "PK_ClientPairs",
table: "ClientPairs");
migrationBuilder.AlterColumn<string>(
name: "OtherUserUID",
table: "ClientPairs",
type: "nvarchar(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldMaxLength: 10);
migrationBuilder.AlterColumn<string>(
name: "UserUID",
table: "ClientPairs",
type: "nvarchar(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(10)",
oldMaxLength: 10);
migrationBuilder.AddColumn<int>(
name: "Id",
table: "ClientPairs",
type: "int",
nullable: false,
defaultValue: 0)
.Annotation("SqlServer:Identity", "1, 1");
migrationBuilder.AddPrimaryKey(
name: "PK_ClientPairs",
table: "ClientPairs",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ClientPairs_Users_OtherUserUID",
table: "ClientPairs",
column: "OtherUserUID",
principalTable: "Users",
principalColumn: "UID");
migrationBuilder.AddForeignKey(
name: "FK_ClientPairs_Users_UserUID",
table: "ClientPairs",
column: "UserUID",
principalTable: "Users",
principalColumn: "UID");
}
}
}

View File

@@ -1,197 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220713083057_MoveAuthToSeparateTable")]
partial class MoveAuthToSeparateTable
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.Property<string>("HashedKey")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(10)");
b.HasKey("HashedKey");
b.HasIndex("UserUID");
b.ToTable("Auth", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UserUID", "OtherUserUID");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasColumnType("nvarchar(450)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,53 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class MoveAuthToSeparateTable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Auth",
columns: table => new
{
HashedKey = table.Column<string>(type: "nvarchar(64)", maxLength: 64, nullable: false),
UserUID = table.Column<string>(type: "nvarchar(10)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Auth", x => x.HashedKey);
table.ForeignKey(
name: "FK_Auth_Users_UserUID",
column: x => x.UserUID,
principalTable: "Users",
principalColumn: "UID");
});
migrationBuilder.Sql("INSERT INTO Auth SELECT SecretKey, UID FROM Users");
migrationBuilder.DropColumn(
name: "SecretKey",
table: "Users");
migrationBuilder.CreateIndex(
name: "IX_Auth_UserUID",
table: "Auth",
column: "UserUID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Auth");
migrationBuilder.AddColumn<string>(
name: "SecretKey",
table: "Users",
type: "nvarchar(max)",
nullable: true);
}
}
}

View File

@@ -1,200 +0,0 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220713104127_AddIndexes")]
partial class AddIndexes
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.Property<string>("HashedKey")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(10)");
b.HasKey("HashedKey");
b.HasIndex("UserUID");
b.ToTable("Auth", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("CharacterIdentification");
b.ToTable("BannedUsers", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UserUID", "OtherUserUID");
b.HasIndex("OtherUserUID");
b.HasIndex("UserUID");
b.ToTable("ClientPairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
b.HasKey("Hash");
b.HasIndex("UploaderUID");
b.ToTable("FileCaches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("Hash");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("UID");
b.HasIndex("CharacterIdentification");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -1,72 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class AddIndexes : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "CharacterIdentification",
table: "Users",
type: "nvarchar(450)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)",
oldNullable: true);
migrationBuilder.DropPrimaryKey(
name: "PK_ForbiddenUploadEntries",
table: "ForbiddenUploadEntries");
migrationBuilder.AlterColumn<string>(
name: "Hash",
table: "ForbiddenUploadEntries",
type: "nvarchar(40)",
maxLength: 40,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(450)");
migrationBuilder.AddPrimaryKey(
name: "PK_ForbiddenUploadEntries",
table: "ForbiddenUploadEntries",
column: "Hash");
migrationBuilder.CreateIndex(
name: "IX_Users_CharacterIdentification",
table: "Users",
column: "CharacterIdentification");
migrationBuilder.Sql("ALTER DATABASE CURRENT SET ALLOW_SNAPSHOT_ISOLATION ON", true);
migrationBuilder.Sql("ALTER DATABASE CURRENT SET READ_COMMITTED_SNAPSHOT ON", true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_Users_CharacterIdentification",
table: "Users");
migrationBuilder.AlterColumn<string>(
name: "CharacterIdentification",
table: "Users",
type: "nvarchar(max)",
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(450)",
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Hash",
table: "ForbiddenUploadEntries",
type: "nvarchar(450)",
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(40)",
oldMaxLength: 40);
}
}
}

View File

@@ -1,27 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class UserLoginDateTime : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "LastLoggedIn",
table: "Users",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "LastLoggedIn",
table: "Users");
}
}
}

View File

@@ -3,39 +3,43 @@ using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220718071653_UserLoginDateTime")]
partial class UserLoginDateTime
[Migration("20220731210149_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
.HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.Property<string>("HashedKey")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
.HasColumnType("character varying(64)")
.HasColumnName("hashed_key");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.HasKey("HashedKey");
b.HasKey("HashedKey")
.HasName("pk_auth");
b.HasIndex("UserUID");
b.HasIndex("UserUID")
.HasDatabaseName("ix_auth_user_uid");
b.ToTable("Auth", (string)null);
});
@@ -43,17 +47,21 @@ namespace MareSynchronosServer.Migrations
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
.HasColumnType("text")
.HasColumnName("reason");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("CharacterIdentification");
b.HasKey("CharacterIdentification")
.HasName("pk_banned_users");
b.ToTable("BannedUsers", (string)null);
});
@@ -62,28 +70,36 @@ namespace MareSynchronosServer.Migrations
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("other_user_uid");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("allow_receiving_messages");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UserUID", "OtherUserUID");
b.HasKey("UserUID", "OtherUserUID")
.HasName("pk_client_pairs");
b.HasIndex("OtherUserUID");
b.HasIndex("OtherUserUID")
.HasDatabaseName("ix_client_pairs_other_user_uid");
b.HasIndex("UserUID");
b.HasIndex("UserUID")
.HasDatabaseName("ix_client_pairs_user_uid");
b.ToTable("ClientPairs", (string)null);
});
@@ -92,22 +108,28 @@ namespace MareSynchronosServer.Migrations
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("uploaded");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("uploader_uid");
b.HasKey("Hash");
b.HasKey("Hash")
.HasName("pk_file_caches");
b.HasIndex("UploaderUID");
b.HasIndex("UploaderUID")
.HasDatabaseName("ix_file_caches_uploader_uid");
b.ToTable("FileCaches", (string)null);
});
@@ -116,17 +138,21 @@ namespace MareSynchronosServer.Migrations
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
.HasColumnType("text")
.HasColumnName("forbidden_by");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("Hash");
b.HasKey("Hash")
.HasName("pk_forbidden_upload_entries");
b.ToTable("ForbiddenUploadEntries", (string)null);
});
@@ -135,28 +161,36 @@ namespace MareSynchronosServer.Migrations
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("uid");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_admin");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_moderator");
b.Property<DateTime>("LastLoggedIn")
.HasColumnType("datetime2");
.HasColumnType("timestamp with time zone")
.HasColumnName("last_logged_in");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UID");
b.HasKey("UID")
.HasName("pk_users");
b.HasIndex("CharacterIdentification");
b.HasIndex("CharacterIdentification")
.HasDatabaseName("ix_users_character_identification");
b.ToTable("Users", (string)null);
});
@@ -165,7 +199,8 @@ namespace MareSynchronosServer.Migrations
{
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
.HasForeignKey("UserUID")
.HasConstraintName("fk_auth_users_user_uid");
b.Navigation("User");
});
@@ -176,13 +211,15 @@ namespace MareSynchronosServer.Migrations
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_client_pairs_users_other_user_uid");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_client_pairs_users_user_uid");
b.Navigation("OtherUser");
@@ -193,7 +230,8 @@ namespace MareSynchronosServer.Migrations
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
.HasForeignKey("UploaderUID")
.HasConstraintName("fk_file_caches_users_uploader_uid");
b.Navigation("Uploader");
});

View File

@@ -0,0 +1,164 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class InitialCreate : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "BannedUsers",
columns: table => new
{
character_identification = table.Column<string>(type: "text", nullable: false),
reason = table.Column<string>(type: "text", nullable: true),
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_banned_users", x => x.character_identification);
});
migrationBuilder.CreateTable(
name: "ForbiddenUploadEntries",
columns: table => new
{
hash = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
forbidden_by = table.Column<string>(type: "text", nullable: true),
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_forbidden_upload_entries", x => x.hash);
});
migrationBuilder.CreateTable(
name: "Users",
columns: table => new
{
uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
character_identification = table.Column<string>(type: "text", nullable: true),
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true),
is_moderator = table.Column<bool>(type: "boolean", nullable: false),
is_admin = table.Column<bool>(type: "boolean", nullable: false),
last_logged_in = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("pk_users", x => x.uid);
});
migrationBuilder.CreateTable(
name: "Auth",
columns: table => new
{
hashed_key = table.Column<string>(type: "character varying(64)", maxLength: 64, nullable: false),
user_uid = table.Column<string>(type: "character varying(10)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_auth", x => x.hashed_key);
table.ForeignKey(
name: "fk_auth_users_user_uid",
column: x => x.user_uid,
principalTable: "Users",
principalColumn: "uid");
});
migrationBuilder.CreateTable(
name: "ClientPairs",
columns: table => new
{
user_uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
other_user_uid = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
is_paused = table.Column<bool>(type: "boolean", nullable: false),
allow_receiving_messages = table.Column<bool>(type: "boolean", nullable: false),
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_client_pairs", x => new { x.user_uid, x.other_user_uid });
table.ForeignKey(
name: "fk_client_pairs_users_other_user_uid",
column: x => x.other_user_uid,
principalTable: "Users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "fk_client_pairs_users_user_uid",
column: x => x.user_uid,
principalTable: "Users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "FileCaches",
columns: table => new
{
hash = table.Column<string>(type: "character varying(40)", maxLength: 40, nullable: false),
uploader_uid = table.Column<string>(type: "character varying(10)", nullable: true),
uploaded = table.Column<bool>(type: "boolean", nullable: false),
timestamp = table.Column<byte[]>(type: "bytea", rowVersion: true, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_file_caches", x => x.hash);
table.ForeignKey(
name: "fk_file_caches_users_uploader_uid",
column: x => x.uploader_uid,
principalTable: "Users",
principalColumn: "uid");
});
migrationBuilder.CreateIndex(
name: "ix_auth_user_uid",
table: "Auth",
column: "user_uid");
migrationBuilder.CreateIndex(
name: "ix_client_pairs_other_user_uid",
table: "ClientPairs",
column: "other_user_uid");
migrationBuilder.CreateIndex(
name: "ix_client_pairs_user_uid",
table: "ClientPairs",
column: "user_uid");
migrationBuilder.CreateIndex(
name: "ix_file_caches_uploader_uid",
table: "FileCaches",
column: "uploader_uid");
migrationBuilder.CreateIndex(
name: "ix_users_character_identification",
table: "Users",
column: "character_identification");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Auth");
migrationBuilder.DropTable(
name: "BannedUsers");
migrationBuilder.DropTable(
name: "ClientPairs");
migrationBuilder.DropTable(
name: "FileCaches");
migrationBuilder.DropTable(
name: "ForbiddenUploadEntries");
migrationBuilder.DropTable(
name: "Users");
}
}
}

View File

@@ -0,0 +1,241 @@
// <auto-generated />
using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace MareSynchronosServer.Migrations
{
[DbContext(typeof(MareDbContext))]
[Migration("20220731211419_RenameLowerSnakeCase")]
partial class RenameLowerSnakeCase
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.Property<string>("HashedKey")
.HasMaxLength(64)
.HasColumnType("character varying(64)")
.HasColumnName("hashed_key");
b.Property<string>("UserUID")
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.HasKey("HashedKey")
.HasName("pk_auth");
b.HasIndex("UserUID")
.HasDatabaseName("ix_auth_user_uid");
b.ToTable("auth", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<string>("Reason")
.HasColumnType("text")
.HasColumnName("reason");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("CharacterIdentification")
.HasName("pk_banned_users");
b.ToTable("banned_users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("character varying(10)")
.HasColumnName("other_user_uid");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("boolean")
.HasColumnName("allow_receiving_messages");
b.Property<bool>("IsPaused")
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UserUID", "OtherUserUID")
.HasName("pk_client_pairs");
b.HasIndex("OtherUserUID")
.HasDatabaseName("ix_client_pairs_other_user_uid");
b.HasIndex("UserUID")
.HasDatabaseName("ix_client_pairs_user_uid");
b.ToTable("client_pairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.Property<bool>("Uploaded")
.HasColumnType("boolean")
.HasColumnName("uploaded");
b.Property<string>("UploaderUID")
.HasColumnType("character varying(10)")
.HasColumnName("uploader_uid");
b.HasKey("Hash")
.HasName("pk_file_caches");
b.HasIndex("UploaderUID")
.HasDatabaseName("ix_file_caches_uploader_uid");
b.ToTable("file_caches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<string>("ForbiddenBy")
.HasColumnType("text")
.HasColumnName("forbidden_by");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("Hash")
.HasName("pk_forbidden_upload_entries");
b.ToTable("forbidden_upload_entries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("character varying(10)")
.HasColumnName("uid");
b.Property<string>("CharacterIdentification")
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<bool>("IsAdmin")
.HasColumnType("boolean")
.HasColumnName("is_admin");
b.Property<bool>("IsModerator")
.HasColumnType("boolean")
.HasColumnName("is_moderator");
b.Property<DateTime>("LastLoggedIn")
.HasColumnType("timestamp with time zone")
.HasColumnName("last_logged_in");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UID")
.HasName("pk_users");
b.HasIndex("CharacterIdentification")
.HasDatabaseName("ix_users_character_identification");
b.ToTable("users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.HasConstraintName("fk_auth_users_user_temp_id");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID")
.HasConstraintName("fk_file_caches_users_uploader_uid");
b.Navigation("Uploader");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,133 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
public partial class RenameLowerSnakeCase : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_auth_users_user_uid",
table: "Auth");
migrationBuilder.DropForeignKey(
name: "fk_client_pairs_users_other_user_uid",
table: "ClientPairs");
migrationBuilder.DropForeignKey(
name: "fk_client_pairs_users_user_uid",
table: "ClientPairs");
migrationBuilder.RenameTable(
name: "Users",
newName: "users");
migrationBuilder.RenameTable(
name: "Auth",
newName: "auth");
migrationBuilder.RenameTable(
name: "ForbiddenUploadEntries",
newName: "forbidden_upload_entries");
migrationBuilder.RenameTable(
name: "FileCaches",
newName: "file_caches");
migrationBuilder.RenameTable(
name: "ClientPairs",
newName: "client_pairs");
migrationBuilder.RenameTable(
name: "BannedUsers",
newName: "banned_users");
migrationBuilder.AddForeignKey(
name: "fk_auth_users_user_temp_id",
table: "auth",
column: "user_uid",
principalTable: "users",
principalColumn: "uid");
migrationBuilder.AddForeignKey(
name: "fk_client_pairs_users_other_user_temp_id1",
table: "client_pairs",
column: "other_user_uid",
principalTable: "users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_client_pairs_users_user_temp_id2",
table: "client_pairs",
column: "user_uid",
principalTable: "users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_auth_users_user_temp_id",
table: "auth");
migrationBuilder.DropForeignKey(
name: "fk_client_pairs_users_other_user_temp_id1",
table: "client_pairs");
migrationBuilder.DropForeignKey(
name: "fk_client_pairs_users_user_temp_id2",
table: "client_pairs");
migrationBuilder.RenameTable(
name: "users",
newName: "Users");
migrationBuilder.RenameTable(
name: "auth",
newName: "Auth");
migrationBuilder.RenameTable(
name: "forbidden_upload_entries",
newName: "ForbiddenUploadEntries");
migrationBuilder.RenameTable(
name: "file_caches",
newName: "FileCaches");
migrationBuilder.RenameTable(
name: "client_pairs",
newName: "ClientPairs");
migrationBuilder.RenameTable(
name: "banned_users",
newName: "BannedUsers");
migrationBuilder.AddForeignKey(
name: "fk_auth_users_user_uid",
table: "Auth",
column: "user_uid",
principalTable: "Users",
principalColumn: "uid");
migrationBuilder.AddForeignKey(
name: "fk_client_pairs_users_other_user_uid",
table: "ClientPairs",
column: "other_user_uid",
principalTable: "Users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "fk_client_pairs_users_user_uid",
table: "ClientPairs",
column: "user_uid",
principalTable: "Users",
principalColumn: "uid",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@@ -3,8 +3,8 @@ using System;
using MareSynchronosServer.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
@@ -18,152 +18,187 @@ namespace MareSynchronosServer.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "6.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
.HasAnnotation("Relational:MaxIdentifierLength", 63);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.Property<string>("HashedKey")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
.HasColumnType("character varying(64)")
.HasColumnName("hashed_key");
b.Property<string>("UserUID")
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.HasKey("HashedKey");
b.HasKey("HashedKey")
.HasName("pk_auth");
b.HasIndex("UserUID");
b.HasIndex("UserUID")
.HasDatabaseName("ix_auth_user_uid");
b.ToTable("Auth", (string)null);
b.ToTable("auth", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Banned", b =>
{
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<string>("Reason")
.HasColumnType("nvarchar(max)");
.HasColumnType("text")
.HasColumnName("reason");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("CharacterIdentification");
b.HasKey("CharacterIdentification")
.HasName("pk_banned_users");
b.ToTable("BannedUsers", (string)null);
b.ToTable("banned_users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ClientPair", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<string>("OtherUserUID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("other_user_uid");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("allow_receiving_messages");
b.Property<bool>("IsPaused")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UserUID", "OtherUserUID");
b.HasKey("UserUID", "OtherUserUID")
.HasName("pk_client_pairs");
b.HasIndex("OtherUserUID");
b.HasIndex("OtherUserUID")
.HasDatabaseName("ix_client_pairs_other_user_uid");
b.HasIndex("UserUID");
b.HasIndex("UserUID")
.HasDatabaseName("ix_client_pairs_user_uid");
b.ToTable("ClientPairs", (string)null);
b.ToTable("client_pairs", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.FileCache", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.Property<bool>("Uploaded")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("uploaded");
b.Property<string>("UploaderUID")
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("uploader_uid");
b.HasKey("Hash");
b.HasKey("Hash")
.HasName("pk_file_caches");
b.HasIndex("UploaderUID");
b.HasIndex("UploaderUID")
.HasDatabaseName("ix_file_caches_uploader_uid");
b.ToTable("FileCaches", (string)null);
b.ToTable("file_caches", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.ForbiddenUploadEntry", b =>
{
b.Property<string>("Hash")
.HasMaxLength(40)
.HasColumnType("nvarchar(40)");
.HasColumnType("character varying(40)")
.HasColumnName("hash");
b.Property<string>("ForbiddenBy")
.HasColumnType("nvarchar(max)");
.HasColumnType("text")
.HasColumnName("forbidden_by");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("Hash");
b.HasKey("Hash")
.HasName("pk_forbidden_upload_entries");
b.ToTable("ForbiddenUploadEntries", (string)null);
b.ToTable("forbidden_upload_entries", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.User", b =>
{
b.Property<string>("UID")
.HasMaxLength(10)
.HasColumnType("nvarchar(10)");
.HasColumnType("character varying(10)")
.HasColumnName("uid");
b.Property<string>("CharacterIdentification")
.HasColumnType("nvarchar(450)");
.HasColumnType("text")
.HasColumnName("character_identification");
b.Property<bool>("IsAdmin")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_admin");
b.Property<bool>("IsModerator")
.HasColumnType("bit");
.HasColumnType("boolean")
.HasColumnName("is_moderator");
b.Property<DateTime>("LastLoggedIn")
.HasColumnType("datetime2");
.HasColumnType("timestamp with time zone")
.HasColumnName("last_logged_in");
b.Property<byte[]>("Timestamp")
.IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
.HasColumnType("bytea")
.HasColumnName("timestamp");
b.HasKey("UID");
b.HasKey("UID")
.HasName("pk_users");
b.HasIndex("CharacterIdentification");
b.HasIndex("CharacterIdentification")
.HasDatabaseName("ix_users_character_identification");
b.ToTable("Users", (string)null);
b.ToTable("users", (string)null);
});
modelBuilder.Entity("MareSynchronosServer.Models.Auth", b =>
{
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID");
.HasForeignKey("UserUID")
.HasConstraintName("fk_auth_users_user_temp_id");
b.Navigation("User");
});
@@ -174,13 +209,15 @@ namespace MareSynchronosServer.Migrations
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_client_pairs_users_other_user_temp_id1");
b.HasOne("MareSynchronosServer.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
.IsRequired()
.HasConstraintName("fk_client_pairs_users_user_temp_id2");
b.Navigation("OtherUser");
@@ -191,7 +228,8 @@ namespace MareSynchronosServer.Migrations
{
b.HasOne("MareSynchronosServer.Models.User", "Uploader")
.WithMany()
.HasForeignKey("UploaderUID");
.HasForeignKey("UploaderUID")
.HasConstraintName("fk_file_caches_users_uploader_uid");
b.Navigation("Uploader");
});

View File

@@ -47,7 +47,10 @@ namespace MareSynchronosServer
MareMetrics.InitializeMetrics(context, services.GetRequiredService<IConfiguration>());
}
host.Run();
if (args.Length == 0 || args[0] != "dry")
{
host.Run();
}
}
public static IHostBuilder CreateHostBuilder(string[] args) =>

View File

@@ -16,6 +16,7 @@ using Prometheus;
using WebSocketOptions = Microsoft.AspNetCore.Builder.WebSocketOptions;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Logging;
using Microsoft.EntityFrameworkCore.Migrations;
namespace MareSynchronosServer
{
@@ -47,10 +48,11 @@ namespace MareSynchronosServer
services.AddDbContextPool<MareDbContext>(options =>
{
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"), builder =>
options.UseNpgsql(Configuration.GetConnectionString("DefaultConnection"), builder =>
{
});
}, 32000);
builder.MigrationsHistoryTable("_efmigrationshistory", "public");
}).UseSnakeCaseNamingConvention();
});
services.AddHostedService<FileCleanupService>();
services.AddHostedService(provider => provider.GetService<SystemInfoService>());

View File

@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\SQLEXPRESS;Database=mare;Trusted_Connection=True;MultipleActiveResultSets=true"
"DefaultConnection": "Host=localhost;Port=5432;Database=mare;Username=postgres"
},
"Logging": {
"LogLevel": {