#400 database migration

This commit is contained in:
Hamid Reza Mohammadi 2023-07-25 18:05:37 +03:30
parent 3f511f289d
commit 8bf9e142d1
5 changed files with 5178 additions and 2 deletions

View File

@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "7.0.1",
"version": "7.0.9",
"commands": [
"dotnet-ef"
]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace RMuseum.Migrations
{
/// <inheritdoc />
public partial class PDFNewEntities : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<int>(
name: "BookScriptType",
table: "PDFBooks",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "PDFSourceId",
table: "PDFBooks",
type: "int",
nullable: true);
migrationBuilder.CreateTable(
name: "PDFSources",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
Url = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PDFSources", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PDFBooks_PDFSourceId",
table: "PDFBooks",
column: "PDFSourceId");
migrationBuilder.AddForeignKey(
name: "FK_PDFBooks_PDFSources_PDFSourceId",
table: "PDFBooks",
column: "PDFSourceId",
principalTable: "PDFSources",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_PDFBooks_PDFSources_PDFSourceId",
table: "PDFBooks");
migrationBuilder.DropTable(
name: "PDFSources");
migrationBuilder.DropIndex(
name: "IX_PDFBooks_PDFSourceId",
table: "PDFBooks");
migrationBuilder.DropColumn(
name: "BookScriptType",
table: "PDFBooks");
migrationBuilder.DropColumn(
name: "PDFSourceId",
table: "PDFBooks");
}
}
}

View File

@ -17,7 +17,7 @@ namespace RMuseum.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.1")
.HasAnnotation("ProductVersion", "7.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
@ -3043,6 +3043,9 @@ namespace RMuseum.Migrations
b.Property<int>("BookId")
.HasColumnType("int");
b.Property<int>("BookScriptType")
.HasColumnType("int");
b.Property<int?>("ClaimedPageCount")
.HasColumnType("int");
@ -3094,6 +3097,9 @@ namespace RMuseum.Migrations
b.Property<Guid?>("PDFFileId")
.HasColumnType("uniqueidentifier");
b.Property<int?>("PDFSourceId")
.HasColumnType("int");
b.Property<int>("PageCount")
.HasColumnType("int");
@ -3140,6 +3146,8 @@ namespace RMuseum.Migrations
b.HasIndex("PDFFileId");
b.HasIndex("PDFSourceId");
b.ToTable("PDFBooks");
});
@ -3178,6 +3186,28 @@ namespace RMuseum.Migrations
b.ToTable("PDFPages");
});
modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFSource", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Description")
.HasColumnType("nvarchar(max)");
b.Property<string>("Name")
.HasColumnType("nvarchar(max)");
b.Property<string>("Url")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("PDFSources");
});
modelBuilder.Entity("RMuseum.Models.UploadSession.UploadSession", b =>
{
b.Property<Guid>("Id")
@ -4804,6 +4834,10 @@ namespace RMuseum.Migrations
.WithMany()
.HasForeignKey("PDFFileId");
b.HasOne("RMuseum.Models.PDFLibrary.PDFSource", "PDFSource")
.WithMany()
.HasForeignKey("PDFSourceId");
b.Navigation("Book");
b.Navigation("CoverImage");
@ -4811,6 +4845,8 @@ namespace RMuseum.Migrations
b.Navigation("MultiVolumePDFCollection");
b.Navigation("PDFFile");
b.Navigation("PDFSource");
});
modelBuilder.Entity("RMuseum.Models.PDFLibrary.PDFPage", b =>

View File

@ -3710,6 +3710,18 @@
<member name="M:RMuseum.Migrations.VolumeCount.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Migrations.PDFNewEntities">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.PDFNewEntities.Up(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.PDFNewEntities.Down(Microsoft.EntityFrameworkCore.Migrations.MigrationBuilder)">
<inheritdoc />
</member>
<member name="M:RMuseum.Migrations.PDFNewEntities.BuildTargetModel(Microsoft.EntityFrameworkCore.ModelBuilder)">
<inheritdoc />
</member>
<member name="T:RMuseum.Models.Accounting.DonationExpenditure">
<summary>
donation expenditures