Remove test db
This commit is contained in:
@ -1,37 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
|
|
||||||
namespace USEntryCoach.Server.Data;
|
|
||||||
|
|
||||||
public class BloggingContext : DbContext
|
|
||||||
{
|
|
||||||
public DbSet<Blog> Blogs { get; set; }
|
|
||||||
public DbSet<Post> Posts { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
public BloggingContext (DbContextOptions<BloggingContext> options)
|
|
||||||
: base(options)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//public string ConnectionString { get; } = configuration.GetConnectionString("Default") ?? "No connection string";
|
|
||||||
|
|
||||||
//protected override void OnConfiguring(DbContextOptionsBuilder options) => options.UseNpgsql(ConnectionString);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Blog
|
|
||||||
{
|
|
||||||
public int BlogId { get; set; }
|
|
||||||
public string Url { get; set; }
|
|
||||||
|
|
||||||
public List<Post> Posts { get; } = new();
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Post
|
|
||||||
{
|
|
||||||
public int PostId { get; set; }
|
|
||||||
public string Title { get; set; }
|
|
||||||
public string Content { get; set; }
|
|
||||||
|
|
||||||
public int BlogId { get; set; }
|
|
||||||
public Blog Blog { get; set; }
|
|
||||||
}
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using USEntryCoach.Server.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace USEntryCoach.Server.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(BloggingContext))]
|
|
||||||
[Migration("20250527114315_Initial")]
|
|
||||||
partial class Initial
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.5")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Blog", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("BlogId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BlogId"));
|
|
||||||
|
|
||||||
b.Property<string>("Url")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("BlogId");
|
|
||||||
|
|
||||||
b.ToTable("Blogs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Post", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("PostId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PostId"));
|
|
||||||
|
|
||||||
b.Property<int>("BlogId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Content")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("PostId");
|
|
||||||
|
|
||||||
b.HasIndex("BlogId");
|
|
||||||
|
|
||||||
b.ToTable("Posts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Post", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("USEntryCoach.Server.Data.Blog", "Blog")
|
|
||||||
.WithMany("Posts")
|
|
||||||
.HasForeignKey("BlogId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Blog");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Blog", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Posts");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,64 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace USEntryCoach.Server.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class Initial : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Blogs",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
BlogId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Url = table.Column<string>(type: "text", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Blogs", x => x.BlogId);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Posts",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
PostId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
|
|
||||||
Title = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Content = table.Column<string>(type: "text", nullable: false),
|
|
||||||
BlogId = table.Column<int>(type: "integer", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Posts", x => x.PostId);
|
|
||||||
table.ForeignKey(
|
|
||||||
name: "FK_Posts_Blogs_BlogId",
|
|
||||||
column: x => x.BlogId,
|
|
||||||
principalTable: "Blogs",
|
|
||||||
principalColumn: "BlogId",
|
|
||||||
onDelete: ReferentialAction.Cascade);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
|
||||||
name: "IX_Posts_BlogId",
|
|
||||||
table: "Posts",
|
|
||||||
column: "BlogId");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Posts");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Blogs");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|
||||||
using USEntryCoach.Server.Data;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace USEntryCoach.Server.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(BloggingContext))]
|
|
||||||
partial class BloggingContextModelSnapshot : ModelSnapshot
|
|
||||||
{
|
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "9.0.5")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
|
||||||
|
|
||||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Blog", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("BlogId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("BlogId"));
|
|
||||||
|
|
||||||
b.Property<string>("Url")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("BlogId");
|
|
||||||
|
|
||||||
b.ToTable("Blogs");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Post", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("PostId")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("PostId"));
|
|
||||||
|
|
||||||
b.Property<int>("BlogId")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<string>("Content")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Title")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("PostId");
|
|
||||||
|
|
||||||
b.HasIndex("BlogId");
|
|
||||||
|
|
||||||
b.ToTable("Posts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Post", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("USEntryCoach.Server.Data.Blog", "Blog")
|
|
||||||
.WithMany("Posts")
|
|
||||||
.HasForeignKey("BlogId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Blog");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("USEntryCoach.Server.Data.Blog", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Posts");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user