mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
feat(dir): ✨ add AddChanges migration
This commit is contained in:
parent
9ed0430a9d
commit
b431dc0f41
3 changed files with 87902 additions and 0 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Text.Json;
|
||||
using FilterLists.Directory.Domain.Aggregates;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace FilterLists.Directory.Infrastructure.Migrations.Migrations
|
||||
{
|
||||
public partial class AddChanges : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AlterDatabase()
|
||||
.Annotation("Npgsql:Enum:aggregate_type", "filter_list,language,license,maintainer,software,syntax,tag");
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "changes",
|
||||
columns: table => new
|
||||
{
|
||||
id = table.Column<long>(type: "bigint", nullable: false)
|
||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
||||
reason = table.Column<string>(type: "text", nullable: true),
|
||||
submitted_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"),
|
||||
approved_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
rejected_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
|
||||
rejected_reason = table.Column<string>(type: "text", nullable: true),
|
||||
before = table.Column<JsonDocument>(type: "jsonb", nullable: true),
|
||||
after = table.Column<JsonDocument>(type: "jsonb", nullable: true),
|
||||
aggregate_type = table.Column<AggregateType>(type: "aggregate_type", nullable: false),
|
||||
filter_list_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
language_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
license_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
maintainer_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
software_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
syntax_id = table.Column<long>(type: "bigint", nullable: true),
|
||||
tag_id = table.Column<long>(type: "bigint", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("pk_changes", x => x.id);
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_filter_lists_filter_list_id",
|
||||
column: x => x.filter_list_id,
|
||||
principalTable: "filter_lists",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_languages_language_id",
|
||||
column: x => x.language_id,
|
||||
principalTable: "languages",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_licenses_license_id",
|
||||
column: x => x.license_id,
|
||||
principalTable: "licenses",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_maintainers_maintainer_id",
|
||||
column: x => x.maintainer_id,
|
||||
principalTable: "maintainers",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_software_software_id",
|
||||
column: x => x.software_id,
|
||||
principalTable: "software",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_syntaxes_syntax_id",
|
||||
column: x => x.syntax_id,
|
||||
principalTable: "syntaxes",
|
||||
principalColumn: "id");
|
||||
table.ForeignKey(
|
||||
name: "fk_changes_tags_tag_id",
|
||||
column: x => x.tag_id,
|
||||
principalTable: "tags",
|
||||
principalColumn: "id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_filter_list_id",
|
||||
table: "changes",
|
||||
column: "filter_list_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_language_id",
|
||||
table: "changes",
|
||||
column: "language_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_license_id",
|
||||
table: "changes",
|
||||
column: "license_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_maintainer_id",
|
||||
table: "changes",
|
||||
column: "maintainer_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_software_id",
|
||||
table: "changes",
|
||||
column: "software_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_syntax_id",
|
||||
table: "changes",
|
||||
column: "syntax_id");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "ix_changes_tag_id",
|
||||
table: "changes",
|
||||
column: "tag_id");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "changes");
|
||||
|
||||
migrationBuilder.AlterDatabase()
|
||||
.OldAnnotation("Npgsql:Enum:aggregate_type", "filter_list,language,license,maintainer,software,syntax,tag");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using FilterLists.Directory.Domain.Aggregates;
|
||||
using FilterLists.Directory.Infrastructure.Persistence.Queries.Context;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
|
|
@ -19,8 +22,107 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
.HasAnnotation("ProductVersion", "6.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "aggregate_type", new[] { "filter_list", "language", "license", "maintainer", "software", "syntax", "tag" });
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Change", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("id");
|
||||
|
||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
|
||||
|
||||
b.Property<JsonDocument>("After")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("after");
|
||||
|
||||
b.Property<AggregateType>("AggregateType")
|
||||
.HasColumnType("aggregate_type")
|
||||
.HasColumnName("aggregate_type");
|
||||
|
||||
b.Property<DateTime?>("ApprovedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("approved_at");
|
||||
|
||||
b.Property<JsonDocument>("Before")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("before");
|
||||
|
||||
b.Property<long?>("FilterListId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("filter_list_id");
|
||||
|
||||
b.Property<long?>("LanguageId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("language_id");
|
||||
|
||||
b.Property<long?>("LicenseId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("license_id");
|
||||
|
||||
b.Property<long?>("MaintainerId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("maintainer_id");
|
||||
|
||||
b.Property<string>("Reason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("reason");
|
||||
|
||||
b.Property<DateTime?>("RejectedAt")
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("rejected_at");
|
||||
|
||||
b.Property<string>("RejectedReason")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("rejected_reason");
|
||||
|
||||
b.Property<long?>("SoftwareId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("software_id");
|
||||
|
||||
b.Property<DateTime>("SubmittedAt")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("timestamp with time zone")
|
||||
.HasColumnName("submitted_at")
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
b.Property<long?>("SyntaxId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("syntax_id");
|
||||
|
||||
b.Property<long?>("TagId")
|
||||
.HasColumnType("bigint")
|
||||
.HasColumnName("tag_id");
|
||||
|
||||
b.HasKey("Id")
|
||||
.HasName("pk_changes");
|
||||
|
||||
b.HasIndex("FilterListId")
|
||||
.HasDatabaseName("ix_changes_filter_list_id");
|
||||
|
||||
b.HasIndex("LanguageId")
|
||||
.HasDatabaseName("ix_changes_language_id");
|
||||
|
||||
b.HasIndex("LicenseId")
|
||||
.HasDatabaseName("ix_changes_license_id");
|
||||
|
||||
b.HasIndex("MaintainerId")
|
||||
.HasDatabaseName("ix_changes_maintainer_id");
|
||||
|
||||
b.HasIndex("SoftwareId")
|
||||
.HasDatabaseName("ix_changes_software_id");
|
||||
|
||||
b.HasIndex("SyntaxId")
|
||||
.HasDatabaseName("ix_changes_syntax_id");
|
||||
|
||||
b.HasIndex("TagId")
|
||||
.HasDatabaseName("ix_changes_tag_id");
|
||||
|
||||
b.ToTable("changes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b =>
|
||||
{
|
||||
b.Property<long>("DependencyFilterListId")
|
||||
|
|
@ -87213,6 +87315,44 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Change", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("FilterListId")
|
||||
.HasConstraintName("fk_changes_filter_lists_filter_list_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("LanguageId")
|
||||
.HasConstraintName("fk_changes_languages_language_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("LicenseId")
|
||||
.HasConstraintName("fk_changes_licenses_license_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("MaintainerId")
|
||||
.HasConstraintName("fk_changes_maintainers_maintainer_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("SoftwareId")
|
||||
.HasConstraintName("fk_changes_software_software_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("SyntaxId")
|
||||
.HasConstraintName("fk_changes_syntaxes_syntax_id");
|
||||
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", null)
|
||||
.WithMany("Changes")
|
||||
.HasForeignKey("TagId")
|
||||
.HasConstraintName("fk_changes_tags_tag_id");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Dependent", b =>
|
||||
{
|
||||
b.HasOne("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", "DependencyFilterList")
|
||||
|
|
@ -87407,6 +87547,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.FilterList", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("DependencyFilterLists");
|
||||
|
||||
b.Navigation("DependentFilterLists");
|
||||
|
|
@ -87432,26 +87574,36 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Language", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("FilterListLanguages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.License", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("FilterLists");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Maintainer", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("FilterListMaintainers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Software", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("SoftwareSyntaxes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Syntax", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("FilterListSyntaxes");
|
||||
|
||||
b.Navigation("SoftwareSyntaxes");
|
||||
|
|
@ -87459,6 +87611,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
|
|||
|
||||
modelBuilder.Entity("FilterLists.Directory.Infrastructure.Persistence.Queries.Entities.Tag", b =>
|
||||
{
|
||||
b.Navigation("Changes");
|
||||
|
||||
b.Navigation("FilterListTags");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
|
|
|
|||
Loading…
Reference in a new issue