This commit is contained in:
2025-12-26 16:40:32 +03:00
commit 4f1be2c3db
37 changed files with 2222 additions and 0 deletions

View File

@@ -0,0 +1,170 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using public_valetax.Data;
#nullable disable
namespace public_valetax.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251226122935_InitialCreate")]
partial class InitialCreate
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("public_valetax.Models.JournalEntry", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("BodyParameters")
.HasColumnType("text")
.HasColumnName("body_parameters");
b.Property<long>("EventId")
.HasColumnType("bigint")
.HasColumnName("event_id");
b.Property<string>("ExceptionType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("exception_type");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text")
.HasColumnName("message");
b.Property<string>("QueryParameters")
.HasColumnType("text")
.HasColumnName("query_parameters");
b.Property<string>("StackTrace")
.HasColumnType("text")
.HasColumnName("stack_trace");
b.Property<DateTime>("Timestamp")
.HasColumnType("timestamp with time zone")
.HasColumnName("timestamp");
b.HasKey("Id");
b.HasIndex("EventId")
.IsUnique();
b.ToTable("journal_entries");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.Property<long?>("ParentId")
.HasColumnType("bigint")
.HasColumnName("parent_id");
b.Property<long>("TreeId")
.HasColumnType("bigint")
.HasColumnName("tree_id");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TreeId", "Name")
.IsUnique();
b.ToTable("nodes");
});
modelBuilder.Entity("public_valetax.Models.Tree", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("trees");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.HasOne("public_valetax.Models.Node", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("public_valetax.Models.Tree", "Tree")
.WithMany("Nodes")
.HasForeignKey("TreeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
b.Navigation("Tree");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("public_valetax.Models.Tree", b =>
{
b.Navigation("Nodes");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,113 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace public_valetax.Migrations
{
/// <inheritdoc />
public partial class InitialCreate : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "journal_entries",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
event_id = table.Column<long>(type: "bigint", nullable: false),
timestamp = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
query_parameters = table.Column<string>(type: "text", nullable: true),
body_parameters = table.Column<string>(type: "text", nullable: true),
stack_trace = table.Column<string>(type: "text", nullable: true),
exception_type = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
message = table.Column<string>(type: "text", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_journal_entries", x => x.id);
});
migrationBuilder.CreateTable(
name: "trees",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_trees", x => x.id);
});
migrationBuilder.CreateTable(
name: "nodes",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
tree_id = table.Column<long>(type: "bigint", nullable: false),
parent_id = table.Column<long>(type: "bigint", nullable: true),
name = table.Column<string>(type: "character varying(255)", maxLength: 255, nullable: false),
created_at = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_nodes", x => x.id);
table.ForeignKey(
name: "FK_nodes_nodes_parent_id",
column: x => x.parent_id,
principalTable: "nodes",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_nodes_trees_tree_id",
column: x => x.tree_id,
principalTable: "trees",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_journal_entries_event_id",
table: "journal_entries",
column: "event_id",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_nodes_parent_id",
table: "nodes",
column: "parent_id");
migrationBuilder.CreateIndex(
name: "IX_nodes_tree_id_name",
table: "nodes",
columns: new[] { "tree_id", "name" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_trees_name",
table: "trees",
column: "name",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "journal_entries");
migrationBuilder.DropTable(
name: "nodes");
migrationBuilder.DropTable(
name: "trees");
}
}
}

View File

@@ -0,0 +1,167 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
using public_valetax.Data;
#nullable disable
namespace public_valetax.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.0")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("public_valetax.Models.JournalEntry", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<string>("BodyParameters")
.HasColumnType("text")
.HasColumnName("body_parameters");
b.Property<long>("EventId")
.HasColumnType("bigint")
.HasColumnName("event_id");
b.Property<string>("ExceptionType")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("exception_type");
b.Property<string>("Message")
.IsRequired()
.HasColumnType("text")
.HasColumnName("message");
b.Property<string>("QueryParameters")
.HasColumnType("text")
.HasColumnName("query_parameters");
b.Property<string>("StackTrace")
.HasColumnType("text")
.HasColumnName("stack_trace");
b.Property<DateTime>("Timestamp")
.HasColumnType("timestamp with time zone")
.HasColumnName("timestamp");
b.HasKey("Id");
b.HasIndex("EventId")
.IsUnique();
b.ToTable("journal_entries");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.Property<long?>("ParentId")
.HasColumnType("bigint")
.HasColumnName("parent_id");
b.Property<long>("TreeId")
.HasColumnType("bigint")
.HasColumnName("tree_id");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("TreeId", "Name")
.IsUnique();
b.ToTable("nodes");
});
modelBuilder.Entity("public_valetax.Models.Tree", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint")
.HasColumnName("id");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<long>("Id"));
b.Property<DateTime>("CreatedAt")
.HasColumnType("timestamp with time zone")
.HasColumnName("created_at");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("character varying(255)")
.HasColumnName("name");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("trees");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.HasOne("public_valetax.Models.Node", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("public_valetax.Models.Tree", "Tree")
.WithMany("Nodes")
.HasForeignKey("TreeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Parent");
b.Navigation("Tree");
});
modelBuilder.Entity("public_valetax.Models.Node", b =>
{
b.Navigation("Children");
});
modelBuilder.Entity("public_valetax.Models.Tree", b =>
{
b.Navigation("Nodes");
});
#pragma warning restore 612, 618
}
}
}