Flatten migration

This commit is contained in:
Loporrit
2025-06-27 17:46:44 +00:00
parent 3fbceee0ce
commit f225323c40
10 changed files with 145 additions and 4687 deletions

View File

@@ -1,114 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
/// <inheritdoc />
public partial class CharaDataFileSwap : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid",
table: "chara_data_files");
migrationBuilder.DropPrimaryKey(
name: "pk_chara_data_files",
table: "chara_data_files");
migrationBuilder.DropIndex(
name: "ix_chara_data_files_parent_id_parent_uploader_uid",
table: "chara_data_files");
migrationBuilder.AlterColumn<string>(
name: "parent_uploader_uid",
table: "chara_data_files",
type: "character varying(10)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "character varying(10)",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "pk_chara_data_files",
table: "chara_data_files",
columns: new[] { "parent_id", "parent_uploader_uid", "game_path" });
migrationBuilder.CreateTable(
name: "chara_data_file_swaps",
columns: table => new
{
parent_id = table.Column<string>(type: "text", nullable: false),
parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: false),
game_path = table.Column<string>(type: "text", nullable: false),
file_path = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_chara_data_file_swaps", x => new { x.parent_id, x.parent_uploader_uid, x.game_path });
table.ForeignKey(
name: "fk_chara_data_file_swaps_chara_data_parent_id_parent_uploader_",
columns: x => new { x.parent_id, x.parent_uploader_uid },
principalTable: "chara_data",
principalColumns: new[] { "id", "uploader_uid" },
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "ix_chara_data_file_swaps_parent_id",
table: "chara_data_file_swaps",
column: "parent_id");
migrationBuilder.AddForeignKey(
name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid",
table: "chara_data_files",
columns: new[] { "parent_id", "parent_uploader_uid" },
principalTable: "chara_data",
principalColumns: new[] { "id", "uploader_uid" },
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid",
table: "chara_data_files");
migrationBuilder.DropTable(
name: "chara_data_file_swaps");
migrationBuilder.DropPrimaryKey(
name: "pk_chara_data_files",
table: "chara_data_files");
migrationBuilder.AlterColumn<string>(
name: "parent_uploader_uid",
table: "chara_data_files",
type: "character varying(10)",
nullable: true,
oldClrType: typeof(string),
oldType: "character varying(10)");
migrationBuilder.AddPrimaryKey(
name: "pk_chara_data_files",
table: "chara_data_files",
columns: new[] { "parent_id", "game_path" });
migrationBuilder.CreateIndex(
name: "ix_chara_data_files_parent_id_parent_uploader_uid",
table: "chara_data_files",
columns: new[] { "parent_id", "parent_uploader_uid" });
migrationBuilder.AddForeignKey(
name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid",
table: "chara_data_files",
columns: new[] { "parent_id", "parent_uploader_uid" },
principalTable: "chara_data",
principalColumns: new[] { "id", "uploader_uid" });
}
}
}

View File

@@ -1,41 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
/// <inheritdoc />
public partial class CascadeFile : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_chara_data_files_files_file_cache_hash",
table: "chara_data_files");
migrationBuilder.AddForeignKey(
name: "fk_chara_data_files_files_file_cache_hash",
table: "chara_data_files",
column: "file_cache_hash",
principalTable: "file_caches",
principalColumn: "hash",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "fk_chara_data_files_files_file_cache_hash",
table: "chara_data_files");
migrationBuilder.AddForeignKey(
name: "fk_chara_data_files_files_file_cache_hash",
table: "chara_data_files",
column: "file_cache_hash",
principalTable: "file_caches",
principalColumn: "hash");
}
}
}

View File

@@ -1,65 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
/// <inheritdoc />
public partial class OrigFileGamePath : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "pk_chara_data_orig_files",
table: "chara_data_orig_files");
migrationBuilder.AlterColumn<string>(
name: "hash",
table: "chara_data_orig_files",
type: "text",
nullable: true,
oldClrType: typeof(string),
oldType: "text");
migrationBuilder.AddColumn<string>(
name: "game_path",
table: "chara_data_orig_files",
type: "text",
nullable: false,
defaultValue: "");
migrationBuilder.AddPrimaryKey(
name: "pk_chara_data_orig_files",
table: "chara_data_orig_files",
columns: new[] { "parent_id", "parent_uploader_uid", "game_path" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropPrimaryKey(
name: "pk_chara_data_orig_files",
table: "chara_data_orig_files");
migrationBuilder.DropColumn(
name: "game_path",
table: "chara_data_orig_files");
migrationBuilder.AlterColumn<string>(
name: "hash",
table: "chara_data_orig_files",
type: "text",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "text",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "pk_chara_data_orig_files",
table: "chara_data_orig_files",
columns: new[] { "parent_id", "parent_uploader_uid", "hash" });
}
}
}

View File

@@ -1,28 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace MareSynchronosServer.Migrations
{
/// <inheritdoc />
public partial class ManipData : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "manipulation_data",
table: "chara_data",
type: "text",
nullable: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "manipulation_data",
table: "chara_data");
}
}
}

View File

@@ -12,15 +12,15 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace MareSynchronosServer.Migrations namespace MareSynchronosServer.Migrations
{ {
[DbContext(typeof(MareDbContext))] [DbContext(typeof(MareDbContext))]
[Migration("20241228190750_ManipData")] [Migration("20250627174541_MCDO")]
partial class ManipData partial class MCDO
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder) protected override void BuildTargetModel(ModelBuilder modelBuilder)
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "8.0.10") .HasAnnotation("ProductVersion", "8.0.4")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -36,10 +36,6 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("is_banned"); .HasColumnName("is_banned");
b.Property<bool>("MarkForBan")
.HasColumnType("boolean")
.HasColumnName("mark_for_ban");
b.Property<string>("PrimaryUserUID") b.Property<string>("PrimaryUserUID")
.HasColumnType("character varying(10)") .HasColumnType("character varying(10)")
.HasColumnName("primary_user_uid"); .HasColumnName("primary_user_uid");
@@ -318,6 +314,26 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("character varying(10)") .HasColumnType("character varying(10)")
.HasColumnName("other_user_uid"); .HasColumnName("other_user_uid");
b.Property<bool>("AllowReceivingMessages")
.HasColumnType("boolean")
.HasColumnName("allow_receiving_messages");
b.Property<bool>("DisableAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_animations");
b.Property<bool>("DisableSounds")
.HasColumnType("boolean")
.HasColumnName("disable_sounds");
b.Property<bool>("DisableVFX")
.HasColumnType("boolean")
.HasColumnName("disable_vfx");
b.Property<bool>("IsPaused")
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<byte[]>("Timestamp") b.Property<byte[]>("Timestamp")
.IsConcurrencyToken() .IsConcurrencyToken()
.ValueGeneratedOnAddOrUpdate() .ValueGeneratedOnAddOrUpdate()
@@ -343,10 +359,6 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("character varying(40)") .HasColumnType("character varying(40)")
.HasColumnName("hash"); .HasColumnName("hash");
b.Property<long>("RawSize")
.HasColumnType("bigint")
.HasColumnName("raw_size");
b.Property<long>("Size") b.Property<long>("Size")
.HasColumnType("bigint") .HasColumnType("bigint")
.HasColumnName("size"); .HasColumnName("size");
@@ -415,6 +427,18 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("character varying(50)") .HasColumnType("character varying(50)")
.HasColumnName("alias"); .HasColumnName("alias");
b.Property<bool>("DisableAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_animations");
b.Property<bool>("DisableSounds")
.HasColumnType("boolean")
.HasColumnName("disable_sounds");
b.Property<bool>("DisableVFX")
.HasColumnType("boolean")
.HasColumnName("disable_vfx");
b.Property<string>("HashedPassword") b.Property<string>("HashedPassword")
.HasColumnType("text") .HasColumnType("text")
.HasColumnName("hashed_password"); .HasColumnName("hashed_password");
@@ -427,18 +451,6 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("character varying(10)") .HasColumnType("character varying(10)")
.HasColumnName("owner_uid"); .HasColumnName("owner_uid");
b.Property<bool>("PreferDisableAnimations")
.HasColumnType("boolean")
.HasColumnName("prefer_disable_animations");
b.Property<bool>("PreferDisableSounds")
.HasColumnType("boolean")
.HasColumnName("prefer_disable_sounds");
b.Property<bool>("PreferDisableVFX")
.HasColumnType("boolean")
.HasColumnName("prefer_disable_vfx");
b.HasKey("GID") b.HasKey("GID")
.HasName("pk_groups"); .HasName("pk_groups");
@@ -495,10 +507,26 @@ namespace MareSynchronosServer.Migrations
.HasColumnType("character varying(10)") .HasColumnType("character varying(10)")
.HasColumnName("group_user_uid"); .HasColumnName("group_user_uid");
b.Property<bool>("DisableAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_animations");
b.Property<bool>("DisableSounds")
.HasColumnType("boolean")
.HasColumnName("disable_sounds");
b.Property<bool>("DisableVFX")
.HasColumnType("boolean")
.HasColumnName("disable_vfx");
b.Property<bool>("IsModerator") b.Property<bool>("IsModerator")
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("is_moderator"); .HasColumnName("is_moderator");
b.Property<bool>("IsPaused")
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<bool>("IsPinned") b.Property<bool>("IsPinned")
.HasColumnType("boolean") .HasColumnType("boolean")
.HasColumnName("is_pinned"); .HasColumnName("is_pinned");
@@ -515,44 +543,6 @@ namespace MareSynchronosServer.Migrations
b.ToTable("group_pairs", (string)null); b.ToTable("group_pairs", (string)null);
}); });
modelBuilder.Entity("MareSynchronosShared.Models.GroupPairPreferredPermission", b =>
{
b.Property<string>("UserUID")
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<string>("GroupGID")
.HasColumnType("character varying(20)")
.HasColumnName("group_gid");
b.Property<bool>("DisableAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_animations");
b.Property<bool>("DisableSounds")
.HasColumnType("boolean")
.HasColumnName("disable_sounds");
b.Property<bool>("DisableVFX")
.HasColumnType("boolean")
.HasColumnName("disable_vfx");
b.Property<bool>("IsPaused")
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.HasKey("UserUID", "GroupGID")
.HasName("pk_group_pair_preferred_permissions");
b.HasIndex("GroupGID")
.HasDatabaseName("ix_group_pair_preferred_permissions_group_gid");
b.HasIndex("UserUID")
.HasDatabaseName("ix_group_pair_preferred_permissions_user_uid");
b.ToTable("group_pair_preferred_permissions", (string)null);
});
modelBuilder.Entity("MareSynchronosShared.Models.GroupTempInvite", b => modelBuilder.Entity("MareSynchronosShared.Models.GroupTempInvite", b =>
{ {
b.Property<string>("GroupGID") b.Property<string>("GroupGID")
@@ -650,95 +640,6 @@ namespace MareSynchronosServer.Migrations
b.ToTable("users", (string)null); b.ToTable("users", (string)null);
}); });
modelBuilder.Entity("MareSynchronosShared.Models.UserDefaultPreferredPermission", b =>
{
b.Property<string>("UserUID")
.HasMaxLength(10)
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<bool>("DisableGroupAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_group_animations");
b.Property<bool>("DisableGroupSounds")
.HasColumnType("boolean")
.HasColumnName("disable_group_sounds");
b.Property<bool>("DisableGroupVFX")
.HasColumnType("boolean")
.HasColumnName("disable_group_vfx");
b.Property<bool>("DisableIndividualAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_individual_animations");
b.Property<bool>("DisableIndividualSounds")
.HasColumnType("boolean")
.HasColumnName("disable_individual_sounds");
b.Property<bool>("DisableIndividualVFX")
.HasColumnType("boolean")
.HasColumnName("disable_individual_vfx");
b.Property<bool>("IndividualIsSticky")
.HasColumnType("boolean")
.HasColumnName("individual_is_sticky");
b.HasKey("UserUID")
.HasName("pk_user_default_preferred_permissions");
b.HasIndex("UserUID")
.HasDatabaseName("ix_user_default_preferred_permissions_user_uid");
b.ToTable("user_default_preferred_permissions", (string)null);
});
modelBuilder.Entity("MareSynchronosShared.Models.UserPermissionSet", b =>
{
b.Property<string>("UserUID")
.HasColumnType("character varying(10)")
.HasColumnName("user_uid");
b.Property<string>("OtherUserUID")
.HasColumnType("character varying(10)")
.HasColumnName("other_user_uid");
b.Property<bool>("DisableAnimations")
.HasColumnType("boolean")
.HasColumnName("disable_animations");
b.Property<bool>("DisableSounds")
.HasColumnType("boolean")
.HasColumnName("disable_sounds");
b.Property<bool>("DisableVFX")
.HasColumnType("boolean")
.HasColumnName("disable_vfx");
b.Property<bool>("IsPaused")
.HasColumnType("boolean")
.HasColumnName("is_paused");
b.Property<bool>("Sticky")
.HasColumnType("boolean")
.HasColumnName("sticky");
b.HasKey("UserUID", "OtherUserUID")
.HasName("pk_user_permission_sets");
b.HasIndex("OtherUserUID")
.HasDatabaseName("ix_user_permission_sets_other_user_uid");
b.HasIndex("UserUID")
.HasDatabaseName("ix_user_permission_sets_user_uid");
b.HasIndex("UserUID", "OtherUserUID", "IsPaused")
.HasDatabaseName("ix_user_permission_sets_user_uid_other_user_uid_is_paused");
b.ToTable("user_permission_sets", (string)null);
});
modelBuilder.Entity("MareSynchronosShared.Models.UserProfileData", b => modelBuilder.Entity("MareSynchronosShared.Models.UserProfileData", b =>
{ {
b.Property<string>("UserUID") b.Property<string>("UserUID")
@@ -771,6 +672,43 @@ namespace MareSynchronosServer.Migrations
b.ToTable("user_profile_data", (string)null); b.ToTable("user_profile_data", (string)null);
}); });
modelBuilder.Entity("MareSynchronosShared.Models.UserProfileDataReport", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("integer")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("Id"));
b.Property<DateTime>("ReportDate")
.HasColumnType("timestamp with time zone")
.HasColumnName("report_date");
b.Property<string>("ReportReason")
.HasColumnType("text")
.HasColumnName("report_reason");
b.Property<string>("ReportedUserUID")
.HasColumnType("character varying(10)")
.HasColumnName("reported_user_uid");
b.Property<string>("ReportingUserUID")
.HasColumnType("character varying(10)")
.HasColumnName("reporting_user_uid");
b.HasKey("Id")
.HasName("pk_user_profile_data_reports");
b.HasIndex("ReportedUserUID")
.HasDatabaseName("ix_user_profile_data_reports_reported_user_uid");
b.HasIndex("ReportingUserUID")
.HasDatabaseName("ix_user_profile_data_reports_reporting_user_uid");
b.ToTable("user_profile_data_reports", (string)null);
});
modelBuilder.Entity("MareSynchronosShared.Models.Auth", b => modelBuilder.Entity("MareSynchronosShared.Models.Auth", b =>
{ {
b.HasOne("MareSynchronosShared.Models.User", "PrimaryUser") b.HasOne("MareSynchronosShared.Models.User", "PrimaryUser")
@@ -967,27 +905,6 @@ namespace MareSynchronosServer.Migrations
b.Navigation("GroupUser"); b.Navigation("GroupUser");
}); });
modelBuilder.Entity("MareSynchronosShared.Models.GroupPairPreferredPermission", b =>
{
b.HasOne("MareSynchronosShared.Models.Group", "Group")
.WithMany()
.HasForeignKey("GroupGID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_group_pair_preferred_permissions_groups_group_gid");
b.HasOne("MareSynchronosShared.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_group_pair_preferred_permissions_users_user_uid");
b.Navigation("Group");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosShared.Models.GroupTempInvite", b => modelBuilder.Entity("MareSynchronosShared.Models.GroupTempInvite", b =>
{ {
b.HasOne("MareSynchronosShared.Models.Group", "Group") b.HasOne("MareSynchronosShared.Models.Group", "Group")
@@ -1010,39 +927,6 @@ namespace MareSynchronosServer.Migrations
b.Navigation("User"); b.Navigation("User");
}); });
modelBuilder.Entity("MareSynchronosShared.Models.UserDefaultPreferredPermission", b =>
{
b.HasOne("MareSynchronosShared.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_user_default_preferred_permissions_users_user_uid");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosShared.Models.UserPermissionSet", b =>
{
b.HasOne("MareSynchronosShared.Models.User", "OtherUser")
.WithMany()
.HasForeignKey("OtherUserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_user_permission_sets_users_other_user_uid");
b.HasOne("MareSynchronosShared.Models.User", "User")
.WithMany()
.HasForeignKey("UserUID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("fk_user_permission_sets_users_user_uid");
b.Navigation("OtherUser");
b.Navigation("User");
});
modelBuilder.Entity("MareSynchronosShared.Models.UserProfileData", b => modelBuilder.Entity("MareSynchronosShared.Models.UserProfileData", b =>
{ {
b.HasOne("MareSynchronosShared.Models.User", "User") b.HasOne("MareSynchronosShared.Models.User", "User")
@@ -1055,6 +939,23 @@ namespace MareSynchronosServer.Migrations
b.Navigation("User"); b.Navigation("User");
}); });
modelBuilder.Entity("MareSynchronosShared.Models.UserProfileDataReport", b =>
{
b.HasOne("MareSynchronosShared.Models.User", "ReportedUser")
.WithMany()
.HasForeignKey("ReportedUserUID")
.HasConstraintName("fk_user_profile_data_reports_users_reported_user_uid");
b.HasOne("MareSynchronosShared.Models.User", "ReportingUser")
.WithMany()
.HasForeignKey("ReportingUserUID")
.HasConstraintName("fk_user_profile_data_reports_users_reporting_user_uid");
b.Navigation("ReportedUser");
b.Navigation("ReportingUser");
});
modelBuilder.Entity("MareSynchronosShared.Models.CharaData", b => modelBuilder.Entity("MareSynchronosShared.Models.CharaData", b =>
{ {
b.Navigation("AllowedIndividiuals"); b.Navigation("AllowedIndividiuals");

View File

@@ -7,7 +7,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
namespace MareSynchronosServer.Migrations namespace MareSynchronosServer.Migrations
{ {
/// <inheritdoc /> /// <inheritdoc />
public partial class CharaData : Migration public partial class MCDO : Migration
{ {
/// <inheritdoc /> /// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder) protected override void Up(MigrationBuilder migrationBuilder)
@@ -26,6 +26,7 @@ namespace MareSynchronosServer.Migrations
expiry_date = table.Column<DateTime>(type: "timestamp with time zone", nullable: true), expiry_date = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
glamourer_data = table.Column<string>(type: "text", nullable: true), glamourer_data = table.Column<string>(type: "text", nullable: true),
customize_data = table.Column<string>(type: "text", nullable: true), customize_data = table.Column<string>(type: "text", nullable: true),
manipulation_data = table.Column<string>(type: "text", nullable: true),
download_count = table.Column<int>(type: "integer", nullable: false) download_count = table.Column<int>(type: "integer", nullable: false)
}, },
constraints: table => constraints: table =>
@@ -64,28 +65,50 @@ namespace MareSynchronosServer.Migrations
onDelete: ReferentialAction.Cascade); onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable(
name: "chara_data_file_swaps",
columns: table => new
{
parent_id = table.Column<string>(type: "text", nullable: false),
parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: false),
game_path = table.Column<string>(type: "text", nullable: false),
file_path = table.Column<string>(type: "text", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("pk_chara_data_file_swaps", x => new { x.parent_id, x.parent_uploader_uid, x.game_path });
table.ForeignKey(
name: "fk_chara_data_file_swaps_chara_data_parent_id_parent_uploader_",
columns: x => new { x.parent_id, x.parent_uploader_uid },
principalTable: "chara_data",
principalColumns: new[] { "id", "uploader_uid" },
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
name: "chara_data_files", name: "chara_data_files",
columns: table => new columns: table => new
{ {
game_path = table.Column<string>(type: "text", nullable: false), game_path = table.Column<string>(type: "text", nullable: false),
parent_id = table.Column<string>(type: "text", nullable: false), parent_id = table.Column<string>(type: "text", nullable: false),
file_cache_hash = table.Column<string>(type: "character varying(40)", nullable: true), parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: false),
parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: true) file_cache_hash = table.Column<string>(type: "character varying(40)", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("pk_chara_data_files", x => new { x.parent_id, x.game_path }); table.PrimaryKey("pk_chara_data_files", x => new { x.parent_id, x.parent_uploader_uid, x.game_path });
table.ForeignKey( table.ForeignKey(
name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid", name: "fk_chara_data_files_chara_data_parent_id_parent_uploader_uid",
columns: x => new { x.parent_id, x.parent_uploader_uid }, columns: x => new { x.parent_id, x.parent_uploader_uid },
principalTable: "chara_data", principalTable: "chara_data",
principalColumns: new[] { "id", "uploader_uid" }); principalColumns: new[] { "id", "uploader_uid" },
onDelete: ReferentialAction.Cascade);
table.ForeignKey( table.ForeignKey(
name: "fk_chara_data_files_files_file_cache_hash", name: "fk_chara_data_files_files_file_cache_hash",
column: x => x.file_cache_hash, column: x => x.file_cache_hash,
principalTable: "file_caches", principalTable: "file_caches",
principalColumn: "hash"); principalColumn: "hash",
onDelete: ReferentialAction.Cascade);
}); });
migrationBuilder.CreateTable( migrationBuilder.CreateTable(
@@ -94,11 +117,12 @@ namespace MareSynchronosServer.Migrations
{ {
parent_id = table.Column<string>(type: "text", nullable: false), parent_id = table.Column<string>(type: "text", nullable: false),
parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: false), parent_uploader_uid = table.Column<string>(type: "character varying(10)", nullable: false),
hash = table.Column<string>(type: "text", nullable: false) game_path = table.Column<string>(type: "text", nullable: false),
hash = table.Column<string>(type: "text", nullable: true)
}, },
constraints: table => constraints: table =>
{ {
table.PrimaryKey("pk_chara_data_orig_files", x => new { x.parent_id, x.parent_uploader_uid, x.hash }); table.PrimaryKey("pk_chara_data_orig_files", x => new { x.parent_id, x.parent_uploader_uid, x.game_path });
table.ForeignKey( table.ForeignKey(
name: "fk_chara_data_orig_files_chara_data_parent_id_parent_uploader_", name: "fk_chara_data_orig_files_chara_data_parent_id_parent_uploader_",
columns: x => new { x.parent_id, x.parent_uploader_uid }, columns: x => new { x.parent_id, x.parent_uploader_uid },
@@ -150,6 +174,11 @@ namespace MareSynchronosServer.Migrations
table: "chara_data_allowance", table: "chara_data_allowance",
column: "parent_id"); column: "parent_id");
migrationBuilder.CreateIndex(
name: "ix_chara_data_file_swaps_parent_id",
table: "chara_data_file_swaps",
column: "parent_id");
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_chara_data_files_file_cache_hash", name: "ix_chara_data_files_file_cache_hash",
table: "chara_data_files", table: "chara_data_files",
@@ -160,11 +189,6 @@ namespace MareSynchronosServer.Migrations
table: "chara_data_files", table: "chara_data_files",
column: "parent_id"); column: "parent_id");
migrationBuilder.CreateIndex(
name: "ix_chara_data_files_parent_id_parent_uploader_uid",
table: "chara_data_files",
columns: new[] { "parent_id", "parent_uploader_uid" });
migrationBuilder.CreateIndex( migrationBuilder.CreateIndex(
name: "ix_chara_data_orig_files_parent_id", name: "ix_chara_data_orig_files_parent_id",
table: "chara_data_orig_files", table: "chara_data_orig_files",
@@ -182,6 +206,9 @@ namespace MareSynchronosServer.Migrations
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "chara_data_allowance"); name: "chara_data_allowance");
migrationBuilder.DropTable(
name: "chara_data_file_swaps");
migrationBuilder.DropTable( migrationBuilder.DropTable(
name: "chara_data_files"); name: "chara_data_files");