Notes
This commit is contained in:
parent
4c2b5cca93
commit
43b4d50e43
28 changed files with 674 additions and 249 deletions
121
shared/migrations/InkForge.Sqlite/Migrations/20240405000000__03_DropHistory.Designer.cs
generated
Normal file
121
shared/migrations/InkForge.Sqlite/Migrations/20240405000000__03_DropHistory.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
// <auto-generated />
|
||||
using System;
|
||||
using InkForge.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InkForge.Sqlite.Migrations
|
||||
{
|
||||
[DbContext(typeof(NoteDbContext))]
|
||||
[Migration("20240405000000__03_DropHistory")]
|
||||
partial class _03_DropHistory
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.3");
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("BLOB");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.MetadataEntity", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Metadata");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
{
|
||||
b.HasOne("InkForge.Data.NoteEntity", "Parent")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.OwnsOne("InkForge.Data.Note", "Value", b1 =>
|
||||
{
|
||||
b1.Property<int>("NoteEntityId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<string>("ContentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<DateTimeOffset>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<DateTimeOffset?>("Deleted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<DateTimeOffset>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.HasKey("NoteEntityId");
|
||||
|
||||
b1.HasIndex("ContentId");
|
||||
|
||||
b1.ToTable("Notes");
|
||||
|
||||
b1.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteEntityId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
});
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Value")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InkForge.Sqlite.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _03_DropHistory : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "MetadataHistory");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "NoteVersions");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Content",
|
||||
table: "Blobs",
|
||||
newName: "Value");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Notes",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER")
|
||||
.OldAnnotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "ParentId",
|
||||
table: "Notes",
|
||||
type: "INTEGER",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Notes_ParentId",
|
||||
table: "Notes",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Notes_Notes_ParentId",
|
||||
table: "Notes",
|
||||
column: "ParentId",
|
||||
principalTable: "Notes",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Notes_Notes_ParentId",
|
||||
table: "Notes");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Notes_ParentId",
|
||||
table: "Notes");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ParentId",
|
||||
table: "Notes");
|
||||
|
||||
migrationBuilder.RenameColumn(
|
||||
name: "Value",
|
||||
table: "Blobs",
|
||||
newName: "Content");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "Id",
|
||||
table: "Notes",
|
||||
type: "INTEGER",
|
||||
nullable: false,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "INTEGER")
|
||||
.Annotation("Sqlite:Autoincrement", true);
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MetadataHistory",
|
||||
columns: table => new
|
||||
{
|
||||
Version = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Id = table.Column<string>(type: "TEXT", nullable: true),
|
||||
Value = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MetadataHistory", x => x.Version);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NoteVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Version = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Value_ContentId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value_ParentId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Value_Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||
Value_Deleted = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
|
||||
Value_Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value_Updated = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_NoteVersions", x => x.Version);
|
||||
table.ForeignKey(
|
||||
name: "FK_NoteVersions_Blobs_Value_ContentId",
|
||||
column: x => x.Value_ContentId,
|
||||
principalTable: "Blobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_NoteVersions_Notes_Value_ParentId",
|
||||
column: x => x.Value_ParentId,
|
||||
principalTable: "Notes",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataHistory_Id_Version",
|
||||
table: "MetadataHistory",
|
||||
columns: new[] { "Id", "Version" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NoteVersions_Id_Version",
|
||||
table: "NoteVersions",
|
||||
columns: new[] { "Id", "Version" },
|
||||
unique: true);
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NoteVersions_Value_ContentId",
|
||||
table: "NoteVersions",
|
||||
column: "Value_ContentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NoteVersions_Value_ParentId",
|
||||
table: "NoteVersions",
|
||||
column: "Value_ParentId");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -15,23 +15,23 @@ namespace InkForge.Sqlite.Migrations
|
|||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.3");
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<byte[]>("Content")
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("BLOB");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blobs");
|
||||
b.ToTable("Blobs", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.MetadataEntity", b =>
|
||||
modelBuilder.Entity("InkForge.Data.MetadataEntity", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
|
@ -42,63 +42,34 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Metadata");
|
||||
b.ToTable("Metadata", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.MetadataVersionEntity", b =>
|
||||
{
|
||||
b.Property<int?>("Version")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Version");
|
||||
|
||||
b.HasIndex("Id", "Version")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("MetadataHistory");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteEntity", b =>
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("ParentId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Notes");
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Notes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteVersionEntity", b =>
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
{
|
||||
b.Property<int?>("Version")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
b.HasOne("InkForge.Data.NoteEntity", "Parent")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Version");
|
||||
|
||||
b.HasIndex("Id", "Version")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("NoteVersions");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteEntity", b =>
|
||||
{
|
||||
b.OwnsOne("InkForge.Data.Domain.Note", "Value", b1 =>
|
||||
b.OwnsOne("InkForge.Data.NoteEntity.Value#InkForge.Data.Note", "Value", b1 =>
|
||||
{
|
||||
b1.Property<int>("ParentId")
|
||||
b1.Property<int>("NoteEntityId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<string>("ContentId")
|
||||
|
|
@ -118,64 +89,11 @@ namespace InkForge.Sqlite.Migrations
|
|||
b1.Property<DateTimeOffset>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.HasKey("ParentId");
|
||||
b1.HasKey("NoteEntityId");
|
||||
|
||||
b1.HasIndex("ContentId");
|
||||
|
||||
b1.ToTable("Notes");
|
||||
|
||||
b1.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner("Parent")
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
|
||||
b1.Navigation("Parent");
|
||||
});
|
||||
|
||||
b.Navigation("Value")
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteVersionEntity", b =>
|
||||
{
|
||||
b.OwnsOne("InkForge.Data.Domain.Note", "Value", b1 =>
|
||||
{
|
||||
b1.Property<int>("NoteVersionEntityVersion")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<string>("ContentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<DateTimeOffset>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<DateTimeOffset?>("Deleted")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.Property<int?>("ParentId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<DateTimeOffset>("Updated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b1.HasKey("NoteVersionEntityVersion");
|
||||
|
||||
b1.HasIndex("ContentId");
|
||||
|
||||
b1.HasIndex("ParentId");
|
||||
|
||||
b1.ToTable("NoteVersions");
|
||||
b1.ToTable("Notes", (string)null);
|
||||
|
||||
b1.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
|
|
@ -184,17 +102,13 @@ namespace InkForge.Sqlite.Migrations
|
|||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteVersionEntityVersion");
|
||||
|
||||
b1.HasOne("InkForge.Data.Infrastructure.NoteEntity", "Parent")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
.HasForeignKey("NoteEntityId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
|
||||
b1.Navigation("Parent");
|
||||
});
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
||||
b.Navigation("Value")
|
||||
.IsRequired();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue