Replace ReactiveUI
This commit is contained in:
parent
43b4d50e43
commit
5584ab4ec8
41 changed files with 472 additions and 1013 deletions
|
|
@ -1,172 +0,0 @@
|
|||
// <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("20240207000000__01_Initial")]
|
||||
partial class _01_Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.1");
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<byte[]>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("BLOB");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteEntity", b =>
|
||||
{
|
||||
b.Property<int?>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteVersionEntity", b =>
|
||||
{
|
||||
b.Property<int?>("Version")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
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 =>
|
||||
{
|
||||
b1.Property<int>("ParentId")
|
||||
.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("ParentId");
|
||||
|
||||
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.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteVersionEntityVersion");
|
||||
|
||||
b1.HasOne("InkForge.Data.Infrastructure.NoteEntity", "Parent")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
|
||||
b1.Navigation("Parent");
|
||||
});
|
||||
|
||||
b.Navigation("Value")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
// <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("20240214000000__02_Metadata")]
|
||||
partial class _02_Metadata
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.2");
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<byte[]>("Content")
|
||||
.IsRequired()
|
||||
.HasColumnType("BLOB");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.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.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 =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.Infrastructure.NoteVersionEntity", b =>
|
||||
{
|
||||
b.Property<int?>("Version")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
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 =>
|
||||
{
|
||||
b1.Property<int>("ParentId")
|
||||
.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("ParentId");
|
||||
|
||||
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.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteVersionEntityVersion");
|
||||
|
||||
b1.HasOne("InkForge.Data.Infrastructure.NoteEntity", "Parent")
|
||||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
|
||||
b1.Navigation("Parent");
|
||||
});
|
||||
|
||||
b.Navigation("Value")
|
||||
.IsRequired();
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace InkForge.Sqlite.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _02_Metadata : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Metadata",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Metadata", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "MetadataHistory",
|
||||
columns: table => new
|
||||
{
|
||||
Version = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Value = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Id = table.Column<string>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_MetadataHistory", x => x.Version);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_MetadataHistory_Id_Version",
|
||||
table: "MetadataHistory",
|
||||
columns: new[] { "Id", "Version" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "Metadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "MetadataHistory");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,8 +11,8 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||
namespace InkForge.Sqlite.Migrations
|
||||
{
|
||||
[DbContext(typeof(NoteDbContext))]
|
||||
[Migration("20240405000000__03_DropHistory")]
|
||||
partial class _03_DropHistory
|
||||
[Migration("20240401_Initial")]
|
||||
partial class _20240401_Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
|
|
@ -22,8 +22,9 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
|
|
@ -75,9 +76,8 @@ namespace InkForge.Sqlite.Migrations
|
|||
b1.Property<int>("NoteEntityId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<string>("ContentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
b1.Property<int>("ContentId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<DateTimeOffset>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
|
@ -94,20 +94,19 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b1.HasKey("NoteEntityId");
|
||||
|
||||
b1.HasIndex("ContentId");
|
||||
b1.HasIndex("ContentId")
|
||||
.IsUnique();
|
||||
|
||||
b1.ToTable("Notes");
|
||||
|
||||
b1.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
b1.HasOne("InkForge.Data.Blob", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("InkForge.Data.NoteEntity.Value#InkForge.Data.Note", "ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteEntityId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
});
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
|
@ -6,7 +6,7 @@ using Microsoft.EntityFrameworkCore.Migrations;
|
|||
namespace InkForge.Sqlite.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _01_Initial : Migration
|
||||
public partial class _20240401_Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
|
|
@ -15,25 +15,38 @@ namespace InkForge.Sqlite.Migrations
|
|||
name: "Blobs",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Content = table.Column<byte[]>(type: "BLOB", nullable: false)
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Value = table.Column<byte[]>(type: "BLOB", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Blobs", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Metadata",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Metadata", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Notes",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Id = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
Value_Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||
Value_ContentId = table.Column<int>(type: "INTEGER", 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),
|
||||
Value_Deleted = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
|
||||
Value_ContentId = table.Column<string>(type: "TEXT", nullable: false)
|
||||
ParentId = table.Column<int>(type: "INTEGER", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
|
|
@ -44,65 +57,30 @@ namespace InkForge.Sqlite.Migrations
|
|||
principalTable: "Blobs",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "NoteVersions",
|
||||
columns: table => new
|
||||
{
|
||||
Version = table.Column<int>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
Value_Created = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||
Value_ParentId = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Value_Name = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Value_Updated = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
|
||||
Value_Deleted = table.Column<DateTimeOffset>(type: "TEXT", nullable: true),
|
||||
Value_ContentId = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Id = table.Column<int>(type: "INTEGER", 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,
|
||||
name: "FK_Notes_Notes_ParentId",
|
||||
column: x => x.ParentId,
|
||||
principalTable: "Notes",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Notes_ParentId",
|
||||
table: "Notes",
|
||||
column: "ParentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Notes_Value_ContentId",
|
||||
table: "Notes",
|
||||
column: "Value_ContentId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_NoteVersions_Id_Version",
|
||||
table: "NoteVersions",
|
||||
columns: new[] { "Id", "Version" },
|
||||
column: "Value_ContentId",
|
||||
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");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "NoteVersions");
|
||||
name: "Metadata");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Notes");
|
||||
|
|
@ -1,149 +0,0 @@
|
|||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -19,8 +19,9 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
modelBuilder.Entity("InkForge.Data.Blob", b =>
|
||||
{
|
||||
b.Property<string>("Id")
|
||||
.HasColumnType("TEXT");
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<byte[]>("Value")
|
||||
.IsRequired()
|
||||
|
|
@ -28,7 +29,7 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Blobs", (string)null);
|
||||
b.ToTable("Blobs");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.MetadataEntity", b =>
|
||||
|
|
@ -42,7 +43,7 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Metadata", (string)null);
|
||||
b.ToTable("Metadata");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
|
|
@ -58,7 +59,7 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b.HasIndex("ParentId");
|
||||
|
||||
b.ToTable("Notes", (string)null);
|
||||
b.ToTable("Notes");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("InkForge.Data.NoteEntity", b =>
|
||||
|
|
@ -67,14 +68,13 @@ namespace InkForge.Sqlite.Migrations
|
|||
.WithMany()
|
||||
.HasForeignKey("ParentId");
|
||||
|
||||
b.OwnsOne("InkForge.Data.NoteEntity.Value#InkForge.Data.Note", "Value", b1 =>
|
||||
b.OwnsOne("InkForge.Data.Note", "Value", b1 =>
|
||||
{
|
||||
b1.Property<int>("NoteEntityId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<string>("ContentId")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
b1.Property<int>("ContentId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b1.Property<DateTimeOffset>("Created")
|
||||
.HasColumnType("TEXT");
|
||||
|
|
@ -91,20 +91,19 @@ namespace InkForge.Sqlite.Migrations
|
|||
|
||||
b1.HasKey("NoteEntityId");
|
||||
|
||||
b1.HasIndex("ContentId");
|
||||
b1.HasIndex("ContentId")
|
||||
.IsUnique();
|
||||
|
||||
b1.ToTable("Notes", (string)null);
|
||||
b1.ToTable("Notes");
|
||||
|
||||
b1.HasOne("InkForge.Data.Blob", "Content")
|
||||
.WithMany()
|
||||
.HasForeignKey("ContentId")
|
||||
b1.HasOne("InkForge.Data.Blob", null)
|
||||
.WithOne()
|
||||
.HasForeignKey("InkForge.Data.NoteEntity.Value#InkForge.Data.Note", "ContentId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b1.WithOwner()
|
||||
.HasForeignKey("NoteEntityId");
|
||||
|
||||
b1.Navigation("Content");
|
||||
});
|
||||
|
||||
b.Navigation("Parent");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue