using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace InkForge.Sqlite.Migrations { /// public partial class _20240401_Initial : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "Blobs", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false) .Annotation("Sqlite:Autoincrement", true), Value = table.Column(type: "BLOB", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Blobs", x => x.Id); }); migrationBuilder.CreateTable( name: "Metadata", columns: table => new { Id = table.Column(type: "TEXT", nullable: false), Value = table.Column(type: "TEXT", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Metadata", x => x.Id); }); migrationBuilder.CreateTable( name: "Notes", columns: table => new { Id = table.Column(type: "INTEGER", nullable: false), Value_Created = table.Column(type: "TEXT", nullable: false), Value_ContentId = table.Column(type: "INTEGER", nullable: false), Value_Deleted = table.Column(type: "TEXT", nullable: true), Value_Name = table.Column(type: "TEXT", nullable: false), Value_Updated = table.Column(type: "TEXT", nullable: false), ParentId = table.Column(type: "INTEGER", nullable: true) }, constraints: table => { table.PrimaryKey("PK_Notes", x => x.Id); table.ForeignKey( name: "FK_Notes_Blobs_Value_ContentId", column: x => x.Value_ContentId, principalTable: "Blobs", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( 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", unique: true); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "Metadata"); migrationBuilder.DropTable( name: "Notes"); migrationBuilder.DropTable( name: "Blobs"); } } }