diff options
| author | Paweł Bernaciak <pawelbernaciak@zohomail.eu> | 2023-12-29 09:41:56 +0100 |
|---|---|---|
| committer | Paweł Bernaciak <pawelbernaciak@zohomail.eu> | 2023-12-29 09:41:56 +0100 |
| commit | 79f5eaf40b93d64be74d8b4f1ef80d19fadbfbe1 (patch) | |
| tree | ddf121e78bdd50673379b223abfdb448c4f81291 /CoreWiki/Migrations | |
| parent | 1a96616699ab41bf6343bc1acc45a836c3e6caf3 (diff) | |
Diffstat (limited to 'CoreWiki/Migrations')
| -rw-r--r-- | CoreWiki/Migrations/20231222134125_Initial.Designer.cs | 57 | ||||
| -rw-r--r-- | CoreWiki/Migrations/20231222134125_Initial.cs | 41 | ||||
| -rw-r--r-- | CoreWiki/Migrations/20231224183732_Initial.Designer.cs | 111 | ||||
| -rw-r--r-- | CoreWiki/Migrations/20231224183732_Initial.cs | 74 | ||||
| -rw-r--r-- | CoreWiki/Migrations/20231225202905_ViewCount.Designer.cs | 115 | ||||
| -rw-r--r-- | CoreWiki/Migrations/20231225202905_ViewCount.cs | 44 | ||||
| -rw-r--r-- | CoreWiki/Migrations/ApplicationDbContextModelSnapshot.cs | 70 |
7 files changed, 408 insertions, 104 deletions
diff --git a/CoreWiki/Migrations/20231222134125_Initial.Designer.cs b/CoreWiki/Migrations/20231222134125_Initial.Designer.cs deleted file mode 100644 index 8c6556e..0000000 --- a/CoreWiki/Migrations/20231222134125_Initial.Designer.cs +++ /dev/null @@ -1,57 +0,0 @@ -// <auto-generated /> -using System; -using CoreWiki.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace CoreWiki.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20231222134125_Initial")] - partial class Initial - { - /// <inheritdoc /> - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); - - modelBuilder.Entity("CoreWiki.Models.Article", b => - { - b.Property<string>("Slug") - .HasColumnType("TEXT"); - - b.Property<string>("Content") - .IsRequired() - .HasColumnType("TEXT"); - - b.Property<DateTime>("PublishedDateTime") - .HasColumnType("TEXT") - .HasColumnName("Published"); - - b.Property<string>("Topic") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("TEXT"); - - b.HasKey("Slug"); - - b.ToTable("Articles"); - - b.HasData( - new - { - Slug = "home-page", - Content = "Welcome to your new CoreWiki installation", - PublishedDateTime = new DateTime(2023, 12, 22, 13, 41, 24, 978, DateTimeKind.Utc).AddTicks(110), - Topic = "Home Page" - }); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/CoreWiki/Migrations/20231222134125_Initial.cs b/CoreWiki/Migrations/20231222134125_Initial.cs deleted file mode 100644 index 80c0c6e..0000000 --- a/CoreWiki/Migrations/20231222134125_Initial.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace CoreWiki.Migrations -{ - /// <inheritdoc /> - public partial class Initial : Migration - { - /// <inheritdoc /> - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Articles", - columns: table => new - { - Slug = table.Column<string>(type: "TEXT", nullable: false), - Topic = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false), - Published = table.Column<DateTime>(type: "TEXT", nullable: false), - Content = table.Column<string>(type: "TEXT", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Articles", x => x.Slug); - }); - - migrationBuilder.InsertData( - table: "Articles", - columns: new[] { "Slug", "Content", "Published", "Topic" }, - values: new object[] { "home-page", "Welcome to your new CoreWiki installation", new DateTime(2023, 12, 22, 13, 41, 24, 978, DateTimeKind.Utc).AddTicks(110), "Home Page" }); - } - - /// <inheritdoc /> - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Articles"); - } - } -} diff --git a/CoreWiki/Migrations/20231224183732_Initial.Designer.cs b/CoreWiki/Migrations/20231224183732_Initial.Designer.cs new file mode 100644 index 0000000..bdb4b35 --- /dev/null +++ b/CoreWiki/Migrations/20231224183732_Initial.Designer.cs @@ -0,0 +1,111 @@ +// <auto-generated /> +using System; +using CoreWiki.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CoreWiki.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231224183732_Initial")] + partial class Initial + { + /// <inheritdoc /> + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("CoreWiki.Models.Article", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<DateTime>("PublishedDateTime") + .HasColumnType("TEXT") + .HasColumnName("Published"); + + b.Property<string>("Slug") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("Topic") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Articles"); + + b.HasData( + new + { + Id = 1, + Content = "Welcome to your new CoreWiki installation", + PublishedDateTime = new DateTime(2023, 12, 24, 18, 37, 32, 413, DateTimeKind.Utc).AddTicks(8400), + Slug = "home-page", + Topic = "Home Page" + }); + }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<int>("ArticleId") + .HasColumnType("INTEGER"); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("DisplayName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("EMail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<DateTime>("SubmittedDateTime") + .HasColumnType("TEXT") + .HasColumnName("Submitted"); + + b.HasKey("Id"); + + b.HasIndex("ArticleId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.HasOne("CoreWiki.Models.Article", "Article") + .WithMany("Comments") + .HasForeignKey("ArticleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Article"); + }); + + modelBuilder.Entity("CoreWiki.Models.Article", b => + { + b.Navigation("Comments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CoreWiki/Migrations/20231224183732_Initial.cs b/CoreWiki/Migrations/20231224183732_Initial.cs new file mode 100644 index 0000000..312920a --- /dev/null +++ b/CoreWiki/Migrations/20231224183732_Initial.cs @@ -0,0 +1,74 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CoreWiki.Migrations +{ + /// <inheritdoc /> + public partial class Initial : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Articles", + columns: table => new + { + Id = table.Column<int>(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Slug = table.Column<string>(type: "TEXT", nullable: false), + Topic = table.Column<string>(type: "TEXT", maxLength: 100, nullable: false), + Published = table.Column<DateTime>(type: "TEXT", nullable: false), + Content = table.Column<string>(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Articles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Comment", + columns: table => new + { + Id = table.Column<int>(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + ArticleId = table.Column<int>(type: "INTEGER", nullable: false), + DisplayName = table.Column<string>(type: "TEXT", nullable: false), + EMail = table.Column<string>(type: "TEXT", nullable: false), + Content = table.Column<string>(type: "TEXT", nullable: false), + Submitted = table.Column<DateTime>(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Comment", x => x.Id); + table.ForeignKey( + name: "FK_Comment_Articles_ArticleId", + column: x => x.ArticleId, + principalTable: "Articles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.InsertData( + table: "Articles", + columns: new[] { "Id", "Content", "Published", "Slug", "Topic" }, + values: new object[] { 1, "Welcome to your new CoreWiki installation", new DateTime(2023, 12, 24, 18, 37, 32, 413, DateTimeKind.Utc).AddTicks(8400), "home-page", "Home Page" }); + + migrationBuilder.CreateIndex( + name: "IX_Comment_ArticleId", + table: "Comment", + column: "ArticleId"); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Comment"); + + migrationBuilder.DropTable( + name: "Articles"); + } + } +} diff --git a/CoreWiki/Migrations/20231225202905_ViewCount.Designer.cs b/CoreWiki/Migrations/20231225202905_ViewCount.Designer.cs new file mode 100644 index 0000000..65e1d31 --- /dev/null +++ b/CoreWiki/Migrations/20231225202905_ViewCount.Designer.cs @@ -0,0 +1,115 @@ +// <auto-generated /> +using System; +using CoreWiki.Models; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CoreWiki.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20231225202905_ViewCount")] + partial class ViewCount + { + /// <inheritdoc /> + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "7.0.2"); + + modelBuilder.Entity("CoreWiki.Models.Article", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<DateTime>("PublishedDateTime") + .HasColumnType("TEXT") + .HasColumnName("Published"); + + b.Property<string>("Slug") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("Topic") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("TEXT"); + + b.Property<int>("ViewCount") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Articles"); + + b.HasData( + new + { + Id = 1, + Content = "Welcome to your new CoreWiki installation", + PublishedDateTime = new DateTime(2023, 12, 25, 20, 29, 5, 642, DateTimeKind.Utc).AddTicks(7240), + Slug = "home-page", + Topic = "Home Page", + ViewCount = 0 + }); + }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<int>("ArticleId") + .HasColumnType("INTEGER"); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("DisplayName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("EMail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<DateTime>("SubmittedDateTime") + .HasColumnType("TEXT") + .HasColumnName("Submitted"); + + b.HasKey("Id"); + + b.HasIndex("ArticleId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.HasOne("CoreWiki.Models.Article", "Article") + .WithMany("Comments") + .HasForeignKey("ArticleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Article"); + }); + + modelBuilder.Entity("CoreWiki.Models.Article", b => + { + b.Navigation("Comments"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CoreWiki/Migrations/20231225202905_ViewCount.cs b/CoreWiki/Migrations/20231225202905_ViewCount.cs new file mode 100644 index 0000000..6d2f639 --- /dev/null +++ b/CoreWiki/Migrations/20231225202905_ViewCount.cs @@ -0,0 +1,44 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CoreWiki.Migrations +{ + /// <inheritdoc /> + public partial class ViewCount : Migration + { + /// <inheritdoc /> + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn<int>( + name: "ViewCount", + table: "Articles", + type: "INTEGER", + nullable: false, + defaultValue: 0); + + migrationBuilder.UpdateData( + table: "Articles", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "Published", "ViewCount" }, + values: new object[] { new DateTime(2023, 12, 25, 20, 29, 5, 642, DateTimeKind.Utc).AddTicks(7240), 0 }); + } + + /// <inheritdoc /> + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ViewCount", + table: "Articles"); + + migrationBuilder.UpdateData( + table: "Articles", + keyColumn: "Id", + keyValue: 1, + column: "Published", + value: new DateTime(2023, 12, 24, 18, 37, 32, 413, DateTimeKind.Utc).AddTicks(8400)); + } + } +} diff --git a/CoreWiki/Migrations/ApplicationDbContextModelSnapshot.cs b/CoreWiki/Migrations/ApplicationDbContextModelSnapshot.cs index 4808c70..004bfe7 100644 --- a/CoreWiki/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/CoreWiki/Migrations/ApplicationDbContextModelSnapshot.cs @@ -19,8 +19,9 @@ namespace CoreWiki.Migrations modelBuilder.Entity("CoreWiki.Models.Article", b => { - b.Property<string>("Slug") - .HasColumnType("TEXT"); + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); b.Property<string>("Content") .IsRequired() @@ -30,24 +31,81 @@ namespace CoreWiki.Migrations .HasColumnType("TEXT") .HasColumnName("Published"); + b.Property<string>("Slug") + .IsRequired() + .HasColumnType("TEXT"); + b.Property<string>("Topic") .IsRequired() .HasMaxLength(100) .HasColumnType("TEXT"); - b.HasKey("Slug"); + b.Property<int>("ViewCount") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); b.ToTable("Articles"); b.HasData( new { - Slug = "home-page", + Id = 1, Content = "Welcome to your new CoreWiki installation", - PublishedDateTime = new DateTime(2023, 12, 22, 13, 41, 24, 978, DateTimeKind.Utc).AddTicks(110), - Topic = "Home Page" + PublishedDateTime = new DateTime(2023, 12, 25, 20, 29, 5, 642, DateTimeKind.Utc).AddTicks(7240), + Slug = "home-page", + Topic = "Home Page", + ViewCount = 0 }); }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.Property<int>("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property<int>("ArticleId") + .HasColumnType("INTEGER"); + + b.Property<string>("Content") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("DisplayName") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<string>("EMail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property<DateTime>("SubmittedDateTime") + .HasColumnType("TEXT") + .HasColumnName("Submitted"); + + b.HasKey("Id"); + + b.HasIndex("ArticleId"); + + b.ToTable("Comment"); + }); + + modelBuilder.Entity("CoreWiki.Models.Comment", b => + { + b.HasOne("CoreWiki.Models.Article", "Article") + .WithMany("Comments") + .HasForeignKey("ArticleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Article"); + }); + + modelBuilder.Entity("CoreWiki.Models.Article", b => + { + b.Navigation("Comments"); + }); #pragma warning restore 612, 618 } } |
