This commit is contained in:
Marc Wieland
2025-09-26 08:51:10 +02:00
commit da8f1f8ba3
195 changed files with 8237 additions and 0 deletions

107
Migrations/20250925120417_init.Designer.cs generated Normal file
View File

@@ -0,0 +1,107 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using api.Data;
#nullable disable
namespace api.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20250925120417_init")]
partial class init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("api.Models.Comment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime2");
b.Property<int?>("StockId")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("StockId");
b.ToTable("Comments");
});
modelBuilder.Entity("api.Models.Stock", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Industry")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("LastDiv")
.HasColumnType("decimal(18,2)");
b.Property<long>("MarketCap")
.HasColumnType("bigint");
b.Property<decimal>("Purchase")
.HasColumnType("decimal(18,2)");
b.Property<string>("Symbol")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Stocks");
});
modelBuilder.Entity("api.Models.Comment", b =>
{
b.HasOne("api.Models.Stock", "Stock")
.WithMany("Comments")
.HasForeignKey("StockId");
b.Navigation("Stock");
});
modelBuilder.Entity("api.Models.Stock", b =>
{
b.Navigation("Comments");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,69 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace api.Migrations
{
/// <inheritdoc />
public partial class init : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Stocks",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Symbol = table.Column<string>(type: "nvarchar(max)", nullable: false),
CompanyName = table.Column<string>(type: "nvarchar(max)", nullable: false),
Purchase = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
LastDiv = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
Industry = table.Column<string>(type: "nvarchar(max)", nullable: false),
MarketCap = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Stocks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Comments",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Title = table.Column<string>(type: "nvarchar(max)", nullable: false),
Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
CreatedOn = table.Column<DateTime>(type: "datetime2", nullable: false),
StockId = table.Column<int>(type: "int", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Comments", x => x.Id);
table.ForeignKey(
name: "FK_Comments_Stocks_StockId",
column: x => x.StockId,
principalTable: "Stocks",
principalColumn: "Id");
});
migrationBuilder.CreateIndex(
name: "IX_Comments_StockId",
table: "Comments",
column: "StockId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Comments");
migrationBuilder.DropTable(
name: "Stocks");
}
}
}

View File

@@ -0,0 +1,104 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using api.Data;
#nullable disable
namespace api.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
partial class ApplicationDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("api.Models.Comment", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Content")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("CreatedOn")
.HasColumnType("datetime2");
b.Property<int?>("StockId")
.HasColumnType("int");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.HasIndex("StockId");
b.ToTable("Comments");
});
modelBuilder.Entity("api.Models.Stock", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("CompanyName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Industry")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<decimal>("LastDiv")
.HasColumnType("decimal(18,2)");
b.Property<long>("MarketCap")
.HasColumnType("bigint");
b.Property<decimal>("Purchase")
.HasColumnType("decimal(18,2)");
b.Property<string>("Symbol")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Stocks");
});
modelBuilder.Entity("api.Models.Comment", b =>
{
b.HasOne("api.Models.Stock", "Stock")
.WithMany("Comments")
.HasForeignKey("StockId");
b.Navigation("Stock");
});
modelBuilder.Entity("api.Models.Stock", b =>
{
b.Navigation("Comments");
});
#pragma warning restore 612, 618
}
}
}